Changeset 291244 in webkit
- Timestamp:
- Mar 14, 2022 12:18:11 PM (4 months ago)
- Location:
- trunk
- Files:
-
- 18 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt (modified) (1 diff)
-
LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt (modified) (1 diff)
-
LayoutTests/fast/css/getComputedStyle/getComputedStyle-text-decoration-expected.txt (modified) (1 diff)
-
LayoutTests/fast/css/getComputedStyle/getComputedStyle-text-decoration.html (modified) (3 diffs)
-
LayoutTests/fast/css/getComputedStyle/resources/property-names.js (modified) (1 diff)
-
LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand-expected.txt (modified) (1 diff)
-
LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand.html (modified) (6 diffs)
-
LayoutTests/svg/css/getComputedStyle-basic-expected.txt (modified) (2 diffs)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/CSSProperties.json (modified) (2 diffs)
-
Source/WebCore/css/StyleProperties.cpp (modified) (2 diffs)
-
Source/WebCore/css/parser/CSSPropertyParser.cpp (modified) (2 diffs)
-
Source/WebCore/editing/EditingStyle.cpp (modified) (20 diffs)
-
Source/WebCore/editing/cocoa/HTMLConverter.mm (modified) (2 diffs)
-
Source/WebCore/editing/ios/EditorIOS.mm (modified) (1 diff)
-
Source/WebCore/editing/markup.cpp (modified) (1 diff)
-
Source/WebCore/style/PropertyAllowlist.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r291236 r291244 1 2022-03-14 Oriol Brufau <obrufau@igalia.com> 2 3 [css] Implement 'text-decoration' as a shorthand. 4 https://bugs.webkit.org/show_bug.cgi?id=237175 5 6 Reviewed by Darin Adler. 7 8 Update tests to take into account that 'text-decoration' is a shorthand. 9 10 * fast/css/getComputedStyle/computed-style-expected.txt: 11 * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: 12 * fast/css/getComputedStyle/getComputedStyle-text-decoration-expected.txt: 13 * fast/css/getComputedStyle/getComputedStyle-text-decoration.html: 14 * fast/css/getComputedStyle/resources/property-names.js: 15 * fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand-expected.txt: 16 * fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand.html: 17 * svg/css/getComputedStyle-basic-expected.txt: 18 1 19 2022-03-14 Antoine Quint <graouts@webkit.org> 2 20 -
trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt
r290772 r291244 174 174 text-anchor: start; 175 175 text-combine-upright: none; 176 text-decoration: none; 176 text-decoration-color: rgb(0, 0, 0); 177 text-decoration-line: none; 178 text-decoration-style: solid; 179 text-decoration-thickness: auto; 177 180 text-emphasis-color: rgb(0, 0, 0); 178 181 text-emphasis-position: over right; -
trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
r290772 r291244 173 173 text-anchor: start 174 174 text-combine-upright: none 175 text-decoration: none 175 text-decoration-color: rgb(0, 0, 0) 176 text-decoration-line: none 177 text-decoration-style: solid 178 text-decoration-thickness: auto 176 179 text-emphasis-color: rgb(0, 0, 0) 177 180 text-emphasis-position: over right -
trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-text-decoration-expected.txt
r290772 r291244 5 5 6 6 Initial value: 7 PASS e.style.getPropertyCSSValue('text-decoration') is null 8 PASS computedStyle.textDecoration is 'none' 9 PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSPrimitiveValue]' 10 PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'none' 7 PASS e.style.textDecoration is '' 8 PASS e.style.getPropertyValue('text-decoration') is '' 9 PASS e.style.getPropertyCSSValue('text-decoration') is null 10 PASS e.style.textDecorationLine is '' 11 PASS e.style.getPropertyValue('text-decoration-line') is '' 12 PASS e.style.getPropertyCSSValue('text-decoration-line') is null 13 PASS computedStyle.textDecoration is 'none' 14 PASS computedStyle.getPropertyValue('text-decoration') is 'none' 15 PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSPrimitiveValue]' 16 PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'none' 17 PASS computedStyle.textDecorationLine is 'none' 18 PASS computedStyle.getPropertyValue('text-decoration-line') is 'none' 19 PASS computedStyle.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSPrimitiveValue]' 20 PASS computedStyle.getPropertyCSSValue('text-decoration-line').cssText is 'none' 11 21 12 22 Initial value (explicit): 13 23 PASS e.style.textDecoration is 'initial' 14 PASS e.style.getPropertyCSSValue('text-decoration').toString() is '[object CSSValue]' 15 PASS e.style.getPropertyCSSValue('text-decoration').cssText is 'initial' 16 PASS computedStyle.textDecoration is 'none' 17 PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSPrimitiveValue]' 18 PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'none' 24 PASS e.style.getPropertyValue('text-decoration') is 'initial' 25 PASS e.style.getPropertyCSSValue('text-decoration') is null 26 PASS e.style.textDecorationLine is 'initial' 27 PASS e.style.getPropertyValue('text-decoration-line') is 'initial' 28 PASS e.style.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSValue]' 29 PASS e.style.getPropertyCSSValue('text-decoration-line').cssText is 'initial' 30 PASS computedStyle.textDecoration is 'none' 31 PASS computedStyle.getPropertyValue('text-decoration') is 'none' 32 PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSPrimitiveValue]' 33 PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'none' 34 PASS computedStyle.textDecorationLine is 'none' 35 PASS computedStyle.getPropertyValue('text-decoration-line') is 'none' 36 PASS computedStyle.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSPrimitiveValue]' 37 PASS computedStyle.getPropertyCSSValue('text-decoration-line').cssText is 'none' 19 38 20 39 Value 'none': 21 40 PASS e.style.textDecoration is 'none' 22 PASS e.style.getPropertyCSSValue('text-decoration').toString() is '[object CSSPrimitiveValue]' 23 PASS e.style.getPropertyCSSValue('text-decoration').cssText is 'none' 24 PASS computedStyle.textDecoration is 'none' 25 PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSPrimitiveValue]' 26 PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'none' 41 PASS e.style.getPropertyValue('text-decoration') is 'none' 42 PASS e.style.getPropertyCSSValue('text-decoration') is null 43 PASS e.style.textDecorationLine is 'none' 44 PASS e.style.getPropertyValue('text-decoration-line') is 'none' 45 PASS e.style.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSPrimitiveValue]' 46 PASS e.style.getPropertyCSSValue('text-decoration-line').cssText is 'none' 47 PASS computedStyle.textDecoration is 'none' 48 PASS computedStyle.getPropertyValue('text-decoration') is 'none' 49 PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSPrimitiveValue]' 50 PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'none' 51 PASS computedStyle.textDecorationLine is 'none' 52 PASS computedStyle.getPropertyValue('text-decoration-line') is 'none' 53 PASS computedStyle.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSPrimitiveValue]' 54 PASS computedStyle.getPropertyCSSValue('text-decoration-line').cssText is 'none' 27 55 28 56 Value 'underline': 29 57 PASS e.style.textDecoration is 'underline' 30 PASS e.style.getPropertyCSSValue('text-decoration').toString() is '[object CSSValueList]' 31 PASS e.style.getPropertyCSSValue('text-decoration').cssText is 'underline' 58 PASS e.style.getPropertyValue('text-decoration') is 'underline' 59 PASS e.style.getPropertyCSSValue('text-decoration') is null 60 PASS e.style.textDecorationLine is 'underline' 61 PASS e.style.getPropertyValue('text-decoration-line') is 'underline' 62 PASS e.style.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSValueList]' 63 PASS e.style.getPropertyCSSValue('text-decoration-line').cssText is 'underline' 32 64 PASS computedStyle.textDecoration is 'underline' 65 PASS computedStyle.getPropertyValue('text-decoration') is 'underline' 33 66 PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSValueList]' 34 67 PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'underline' 68 PASS computedStyle.textDecorationLine is 'underline' 69 PASS computedStyle.getPropertyValue('text-decoration-line') is 'underline' 70 PASS computedStyle.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSValueList]' 71 PASS computedStyle.getPropertyCSSValue('text-decoration-line').cssText is 'underline' 35 72 36 73 Value 'overline': 37 74 PASS e.style.textDecoration is 'overline' 38 PASS e.style.getPropertyCSSValue('text-decoration').toString() is '[object CSSValueList]' 39 PASS e.style.getPropertyCSSValue('text-decoration').cssText is 'overline' 75 PASS e.style.getPropertyValue('text-decoration') is 'overline' 76 PASS e.style.getPropertyCSSValue('text-decoration') is null 77 PASS e.style.textDecorationLine is 'overline' 78 PASS e.style.getPropertyValue('text-decoration-line') is 'overline' 79 PASS e.style.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSValueList]' 80 PASS e.style.getPropertyCSSValue('text-decoration-line').cssText is 'overline' 40 81 PASS computedStyle.textDecoration is 'overline' 82 PASS computedStyle.getPropertyValue('text-decoration') is 'overline' 41 83 PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSValueList]' 42 84 PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'overline' 85 PASS computedStyle.textDecorationLine is 'overline' 86 PASS computedStyle.getPropertyValue('text-decoration-line') is 'overline' 87 PASS computedStyle.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSValueList]' 88 PASS computedStyle.getPropertyCSSValue('text-decoration-line').cssText is 'overline' 43 89 44 90 Value 'line-through': 45 91 PASS e.style.textDecoration is 'line-through' 46 PASS e.style.getPropertyCSSValue('text-decoration').toString() is '[object CSSValueList]' 47 PASS e.style.getPropertyCSSValue('text-decoration').cssText is 'line-through' 92 PASS e.style.getPropertyValue('text-decoration') is 'line-through' 93 PASS e.style.getPropertyCSSValue('text-decoration') is null 94 PASS e.style.textDecorationLine is 'line-through' 95 PASS e.style.getPropertyValue('text-decoration-line') is 'line-through' 96 PASS e.style.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSValueList]' 97 PASS e.style.getPropertyCSSValue('text-decoration-line').cssText is 'line-through' 48 98 PASS computedStyle.textDecoration is 'line-through' 99 PASS computedStyle.getPropertyValue('text-decoration') is 'line-through' 49 100 PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSValueList]' 50 101 PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'line-through' 102 PASS computedStyle.textDecorationLine is 'line-through' 103 PASS computedStyle.getPropertyValue('text-decoration-line') is 'line-through' 104 PASS computedStyle.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSValueList]' 105 PASS computedStyle.getPropertyCSSValue('text-decoration-line').cssText is 'line-through' 51 106 52 107 Value 'underline overline line-through': 53 108 PASS e.style.textDecoration is 'underline overline line-through' 54 PASS e.style.getPropertyCSSValue('text-decoration').toString() is '[object CSSValueList]' 55 PASS e.style.getPropertyCSSValue('text-decoration').cssText is 'underline overline line-through' 109 PASS e.style.getPropertyValue('text-decoration') is 'underline overline line-through' 110 PASS e.style.getPropertyCSSValue('text-decoration') is null 111 PASS e.style.textDecorationLine is 'underline overline line-through' 112 PASS e.style.getPropertyValue('text-decoration-line') is 'underline overline line-through' 113 PASS e.style.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSValueList]' 114 PASS e.style.getPropertyCSSValue('text-decoration-line').cssText is 'underline overline line-through' 56 115 PASS computedStyle.textDecoration is 'underline overline line-through' 116 PASS computedStyle.getPropertyValue('text-decoration') is 'underline overline line-through' 57 117 PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSValueList]' 58 118 PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'underline overline line-through' 119 PASS computedStyle.textDecorationLine is 'underline overline line-through' 120 PASS computedStyle.getPropertyValue('text-decoration-line') is 'underline overline line-through' 121 PASS computedStyle.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSValueList]' 122 PASS computedStyle.getPropertyCSSValue('text-decoration-line').cssText is 'underline overline line-through' 59 123 60 124 Value 'blink' (valid but ignored): 61 125 PASS e.style.textDecoration is 'blink' 62 PASS e.style.getPropertyCSSValue('text-decoration').toString() is '[object CSSValueList]' 63 PASS e.style.getPropertyCSSValue('text-decoration').cssText is 'blink' 64 PASS computedStyle.textDecoration is 'none' 65 PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSPrimitiveValue]' 66 PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'none' 126 PASS e.style.getPropertyValue('text-decoration') is 'blink' 127 PASS e.style.getPropertyCSSValue('text-decoration') is null 128 PASS e.style.textDecorationLine is 'blink' 129 PASS e.style.getPropertyValue('text-decoration-line') is 'blink' 130 PASS e.style.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSValueList]' 131 PASS e.style.getPropertyCSSValue('text-decoration-line').cssText is 'blink' 132 PASS computedStyle.textDecoration is 'none' 133 PASS computedStyle.getPropertyValue('text-decoration') is 'none' 134 PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSPrimitiveValue]' 135 PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'none' 136 PASS computedStyle.textDecorationLine is 'none' 137 PASS computedStyle.getPropertyValue('text-decoration-line') is 'none' 138 PASS computedStyle.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSPrimitiveValue]' 139 PASS computedStyle.getPropertyCSSValue('text-decoration-line').cssText is 'none' 67 140 68 141 Value '': 69 PASS e.style.getPropertyCSSValue('text-decoration') is null 70 PASS computedStyle.textDecoration is 'none' 71 PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSPrimitiveValue]' 72 PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'none' 142 PASS e.style.textDecoration is '' 143 PASS e.style.getPropertyValue('text-decoration') is '' 144 PASS e.style.getPropertyCSSValue('text-decoration') is null 145 PASS e.style.textDecorationLine is '' 146 PASS e.style.getPropertyValue('text-decoration-line') is '' 147 PASS e.style.getPropertyCSSValue('text-decoration-line') is null 148 PASS computedStyle.textDecoration is 'none' 149 PASS computedStyle.getPropertyValue('text-decoration') is 'none' 150 PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSPrimitiveValue]' 151 PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'none' 152 PASS computedStyle.textDecorationLine is 'none' 153 PASS computedStyle.getPropertyValue('text-decoration-line') is 'none' 154 PASS computedStyle.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSPrimitiveValue]' 155 PASS computedStyle.getPropertyCSSValue('text-decoration-line').cssText is 'none' 73 156 74 157 Parent gets 'underline' value: 75 158 PASS e.style.textDecoration is 'underline' 76 PASS e.style.getPropertyCSSValue('text-decoration').toString() is '[object CSSValueList]' 77 PASS e.style.getPropertyCSSValue('text-decoration').cssText is 'underline' 159 PASS e.style.getPropertyValue('text-decoration') is 'underline' 160 PASS e.style.getPropertyCSSValue('text-decoration') is null 161 PASS e.style.textDecorationLine is 'underline' 162 PASS e.style.getPropertyValue('text-decoration-line') is 'underline' 163 PASS e.style.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSValueList]' 164 PASS e.style.getPropertyCSSValue('text-decoration-line').cssText is 'underline' 78 165 PASS computedStyle.textDecoration is 'underline' 166 PASS computedStyle.getPropertyValue('text-decoration') is 'underline' 79 167 PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSValueList]' 80 168 PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'underline' 169 PASS computedStyle.textDecorationLine is 'underline' 170 PASS computedStyle.getPropertyValue('text-decoration-line') is 'underline' 171 PASS computedStyle.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSValueList]' 172 PASS computedStyle.getPropertyCSSValue('text-decoration-line').cssText is 'underline' 81 173 82 174 Ancestor should explicitly inherit value from parent when 'inherit' value is used: 83 175 PASS e.style.textDecoration is 'inherit' 84 PASS e.style.getPropertyCSSValue('text-decoration').toString() is '[object CSSValue]' 85 PASS e.style.getPropertyCSSValue('text-decoration').cssText is 'inherit' 176 PASS e.style.getPropertyValue('text-decoration') is 'inherit' 177 PASS e.style.getPropertyCSSValue('text-decoration') is null 178 PASS e.style.textDecorationLine is 'inherit' 179 PASS e.style.getPropertyValue('text-decoration-line') is 'inherit' 180 PASS e.style.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSValue]' 181 PASS e.style.getPropertyCSSValue('text-decoration-line').cssText is 'inherit' 86 182 PASS computedStyle.textDecoration is 'underline' 183 PASS computedStyle.getPropertyValue('text-decoration') is 'underline' 87 184 PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSValueList]' 88 185 PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'underline' 186 PASS computedStyle.textDecorationLine is 'underline' 187 PASS computedStyle.getPropertyValue('text-decoration-line') is 'underline' 188 PASS computedStyle.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSValueList]' 189 PASS computedStyle.getPropertyCSSValue('text-decoration-line').cssText is 'underline' 89 190 90 191 Ancestor should not implicitly inherit value from parent (i.e. when value is void): 91 PASS e.style.getPropertyCSSValue('text-decoration') is null 92 PASS computedStyle.textDecoration is 'none' 93 PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSPrimitiveValue]' 94 PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'none' 192 PASS e.style.textDecoration is '' 193 PASS e.style.getPropertyValue('text-decoration') is '' 194 PASS e.style.getPropertyCSSValue('text-decoration') is null 195 PASS e.style.textDecorationLine is '' 196 PASS e.style.getPropertyValue('text-decoration-line') is '' 197 PASS e.style.getPropertyCSSValue('text-decoration-line') is null 198 PASS computedStyle.textDecoration is 'none' 199 PASS computedStyle.getPropertyValue('text-decoration') is 'none' 200 PASS computedStyle.getPropertyCSSValue('text-decoration').toString() is '[object CSSPrimitiveValue]' 201 PASS computedStyle.getPropertyCSSValue('text-decoration').cssText is 'none' 202 PASS computedStyle.textDecorationLine is 'none' 203 PASS computedStyle.getPropertyValue('text-decoration-line') is 'none' 204 PASS computedStyle.getPropertyCSSValue('text-decoration-line').toString() is '[object CSSPrimitiveValue]' 205 PASS computedStyle.getPropertyCSSValue('text-decoration-line').cssText is 'none' 95 206 96 207 PASS successfullyParsed is true -
trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-text-decoration.html
r290772 r291244 6 6 <body> 7 7 <script> 8 function testElementStyle( propertyJS, propertyCSS,type, value)8 function testElementStyle(type, value) 9 9 { 10 10 if (type != null) { 11 shouldBe("e.style." + propertyJS, "'" + value + "'"); 12 shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').toString()", "'" + type + "'"); 13 shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').cssText", "'" + value + "'"); 14 } else 15 shouldBeNull("e.style.getPropertyCSSValue('" + propertyCSS + "')"); 11 shouldBe("e.style.textDecoration", "'" + value + "'"); 12 shouldBe("e.style.getPropertyValue('text-decoration')", "'" + value + "'"); 13 shouldBeNull("e.style.getPropertyCSSValue('text-decoration')"); 14 15 shouldBe("e.style.textDecorationLine", "'" + value + "'"); 16 shouldBe("e.style.getPropertyValue('text-decoration-line')", "'" + value + "'"); 17 shouldBe("e.style.getPropertyCSSValue('text-decoration-line').toString()", "'" + type + "'"); 18 shouldBe("e.style.getPropertyCSSValue('text-decoration-line').cssText", "'" + value + "'"); 19 } else { 20 shouldBe("e.style.textDecoration", "''"); 21 shouldBe("e.style.getPropertyValue('text-decoration')", "''"); 22 shouldBeNull("e.style.getPropertyCSSValue('text-decoration')"); 23 24 shouldBe("e.style.textDecorationLine", "''"); 25 shouldBe("e.style.getPropertyValue('text-decoration-line')", "''"); 26 shouldBeNull("e.style.getPropertyCSSValue('text-decoration-line')"); 27 } 16 28 } 17 29 18 function testComputedStyle( propertyJS, propertyCSS,type, value)30 function testComputedStyle(type, value) 19 31 { 20 32 computedStyle = window.getComputedStyle(e, null); 21 shouldBe("computedStyle." + propertyJS, "'" + value + "'"); 22 shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').toString()", "'" + type + "'"); 23 shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').cssText", "'" + value + "'"); 33 34 shouldBe("computedStyle.textDecoration", "'" + value + "'"); 35 shouldBe("computedStyle.getPropertyValue('text-decoration')", "'" + value + "'"); 36 shouldBe("computedStyle.getPropertyCSSValue('text-decoration').toString()", "'" + type + "'"); 37 shouldBe("computedStyle.getPropertyCSSValue('text-decoration').cssText", "'" + value + "'"); 38 39 shouldBe("computedStyle.textDecorationLine", "'" + value + "'"); 40 shouldBe("computedStyle.getPropertyValue('text-decoration-line')", "'" + value + "'"); 41 shouldBe("computedStyle.getPropertyCSSValue('text-decoration-line').toString()", "'" + type + "'"); 42 shouldBe("computedStyle.getPropertyCSSValue('text-decoration-line').cssText", "'" + value + "'"); 24 43 } 25 44 … … 33 52 debug("Initial value:"); 34 53 e = document.getElementById('test'); 35 testElementStyle( "textDecoration", "text-decoration",null, '');36 testComputedStyle(" textDecoration", "text-decoration", "[object CSSPrimitiveValue]", "none");54 testElementStyle(null, ''); 55 testComputedStyle("[object CSSPrimitiveValue]", "none"); 37 56 debug(''); 38 57 39 58 debug("Initial value (explicit):"); 40 59 e.style.textDecoration = 'initial'; 41 testElementStyle(" textDecoration", "text-decoration", "[object CSSValue]", "initial");42 testComputedStyle(" textDecoration", "text-decoration", "[object CSSPrimitiveValue]", "none");60 testElementStyle("[object CSSValue]", "initial"); 61 testComputedStyle("[object CSSPrimitiveValue]", "none"); 43 62 debug(''); 44 63 45 64 debug("Value 'none':"); 46 65 e.style.textDecoration = 'none'; 47 testElementStyle(" textDecoration", "text-decoration", "[object CSSPrimitiveValue]", "none");48 testComputedStyle(" textDecoration", "text-decoration", "[object CSSPrimitiveValue]", "none");66 testElementStyle("[object CSSPrimitiveValue]", "none"); 67 testComputedStyle("[object CSSPrimitiveValue]", "none"); 49 68 debug(''); 50 69 51 70 debug("Value 'underline':"); 52 71 e.style.textDecoration = 'underline'; 53 testElementStyle(" textDecoration", "text-decoration", "[object CSSValueList]", "underline");54 testComputedStyle(" textDecoration", "text-decoration", "[object CSSValueList]", "underline");72 testElementStyle("[object CSSValueList]", "underline"); 73 testComputedStyle("[object CSSValueList]", "underline"); 55 74 debug(''); 56 75 57 76 debug("Value 'overline':"); 58 77 e.style.textDecoration = 'overline'; 59 testElementStyle(" textDecoration", "text-decoration", "[object CSSValueList]", "overline");60 testComputedStyle(" textDecoration", "text-decoration", "[object CSSValueList]", "overline");78 testElementStyle("[object CSSValueList]", "overline"); 79 testComputedStyle("[object CSSValueList]", "overline"); 61 80 debug(''); 62 81 63 82 debug("Value 'line-through':"); 64 83 e.style.textDecoration = 'line-through'; 65 testElementStyle(" textDecoration", "text-decoration", "[object CSSValueList]", "line-through");66 testComputedStyle(" textDecoration", "text-decoration", "[object CSSValueList]", "line-through");84 testElementStyle("[object CSSValueList]", "line-through"); 85 testComputedStyle("[object CSSValueList]", "line-through"); 67 86 debug(''); 68 87 69 88 debug("Value 'underline overline line-through':"); 70 89 e.style.textDecoration = 'underline overline line-through'; 71 testElementStyle(" textDecoration", "text-decoration", "[object CSSValueList]", "underline overline line-through");72 testComputedStyle(" textDecoration", "text-decoration", "[object CSSValueList]", "underline overline line-through");90 testElementStyle("[object CSSValueList]", "underline overline line-through"); 91 testComputedStyle("[object CSSValueList]", "underline overline line-through"); 73 92 debug(''); 74 93 75 94 debug("Value 'blink' (valid but ignored):"); 76 95 e.style.textDecoration = 'blink'; 77 testElementStyle(" textDecoration", "text-decoration", "[object CSSValueList]", "blink");78 testComputedStyle(" textDecoration", "text-decoration", "[object CSSPrimitiveValue]", "none");96 testElementStyle("[object CSSValueList]", "blink"); 97 testComputedStyle("[object CSSPrimitiveValue]", "none"); 79 98 debug(''); 80 99 81 100 debug("Value '':"); 82 101 e.style.textDecoration = ''; 83 testElementStyle( "textDecoration", "text-decoration",null, '');84 testComputedStyle(" textDecoration", "text-decoration", "[object CSSPrimitiveValue]", "none");102 testElementStyle(null, ''); 103 testComputedStyle("[object CSSPrimitiveValue]", "none"); 85 104 debug(''); 86 105 … … 88 107 debug("Parent gets 'underline' value:"); 89 108 e = document.getElementById('test-parent'); 90 testElementStyle(" textDecoration", "text-decoration", "[object CSSValueList]", "underline");91 testComputedStyle(" textDecoration", "text-decoration", "[object CSSValueList]", "underline");109 testElementStyle("[object CSSValueList]", "underline"); 110 testComputedStyle("[object CSSValueList]", "underline"); 92 111 debug(''); 93 112 94 113 debug("Ancestor should explicitly inherit value from parent when 'inherit' value is used:"); 95 114 e = document.getElementById('test-ancestor'); 96 testElementStyle(" textDecoration", "text-decoration", "[object CSSValue]", "inherit");97 testComputedStyle(" textDecoration", "text-decoration", "[object CSSValueList]", "underline");115 testElementStyle("[object CSSValue]", "inherit"); 116 testComputedStyle("[object CSSValueList]", "underline"); 98 117 debug(''); 99 118 100 119 debug("Ancestor should not implicitly inherit value from parent (i.e. when value is void):"); 101 120 e.style.textDecoration = ''; 102 testElementStyle( "textDecoration", "text-decoration",null, '');103 testComputedStyle(" textDecoration", "text-decoration", "[object CSSPrimitiveValue]", "none");121 testElementStyle(null, ''); 122 testComputedStyle("[object CSSPrimitiveValue]", "none"); 104 123 debug(''); 105 124 -
trunk/LayoutTests/fast/css/getComputedStyle/resources/property-names.js
r290772 r291244 258 258 "text-align": true, 259 259 "text-anchor": true, 260 "text-decoration": true, 260 "text-decoration-color": true, 261 "text-decoration-line": true, 262 "text-decoration-style": true, 263 "text-decoration-thickness": true, 261 264 "text-indent": true, 262 265 "text-overflow": true, -
trunk/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand-expected.txt
r290772 r291244 6 6 Initial values: 7 7 PASS e.style.getPropertyCSSValue('-webkit-text-decoration') is null 8 PASS computedStyle.getProperty CSSValue('-webkit-text-decoration').cssTextis 'none solid rgb(0, 0, 0)'9 PASS checkComputedStyleValue( ) is true8 PASS computedStyle.getPropertyValue('-webkit-text-decoration') is 'none solid rgb(0, 0, 0)' 9 PASS checkComputedStyleValue('webkitTextDecoration', '-webkit-text-decoration') is true 10 10 11 11 CSS2.1 backwards compatibility ("-webkit-text-decoration: underline overline line-through blink;"): 12 PASS e.style.getProperty CSSValue('-webkit-text-decoration-line').cssTextis 'underline overline line-through blink'13 PASS computedStyle.getProperty CSSValue('-webkit-text-decoration-line').cssTextis 'underline overline line-through'14 PASS computedStyle.getProperty CSSValue('-webkit-text-decoration').cssTextis 'underline overline line-through solid rgb(0, 0, 0)'15 PASS checkComputedStyleValue( ) is true12 PASS e.style.getPropertyValue('-webkit-text-decoration-line') is 'underline overline line-through blink' 13 PASS computedStyle.getPropertyValue('-webkit-text-decoration-line') is 'underline overline line-through' 14 PASS computedStyle.getPropertyValue('-webkit-text-decoration') is 'underline overline line-through solid rgb(0, 0, 0)' 15 PASS checkComputedStyleValue('webkitTextDecoration', '-webkit-text-decoration') is true 16 16 17 17 CSS3 Shorthand ("-webkit-text-decoration: underline overline line-through blink dashed red;"): 18 PASS computedStyle.getProperty CSSValue('-webkit-text-decoration').cssTextis 'underline overline line-through dashed rgb(255, 0, 0)'19 PASS computedStyle.getProperty CSSValue('-webkit-text-decoration-line').cssTextis 'underline overline line-through'20 PASS computedStyle.getProperty CSSValue('-webkit-text-decoration-style').cssTextis 'dashed'21 PASS computedStyle.getProperty CSSValue('-webkit-text-decoration-color').cssTextis 'rgb(255, 0, 0)'22 PASS checkComputedStyleValue( ) is true18 PASS computedStyle.getPropertyValue('-webkit-text-decoration') is 'underline overline line-through dashed rgb(255, 0, 0)' 19 PASS computedStyle.getPropertyValue('-webkit-text-decoration-line') is 'underline overline line-through' 20 PASS computedStyle.getPropertyValue('-webkit-text-decoration-style') is 'dashed' 21 PASS computedStyle.getPropertyValue('-webkit-text-decoration-color') is 'rgb(255, 0, 0)' 22 PASS checkComputedStyleValue('webkitTextDecoration', '-webkit-text-decoration') is true 23 23 24 24 Omitting text decoration line resets to its initial value "none" ("-webkit-text-decoration: navy dotted;"): 25 PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration').cssText is 'none dotted rgb(0, 0, 128)' 26 PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-line').cssText is 'none' 27 PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-style').cssText is 'dotted' 28 PASS computedStyle.getPropertyCSSValue('-webkit-text-decoration-color').cssText is 'rgb(0, 0, 128)' 29 PASS checkComputedStyleValue() is true 25 PASS computedStyle.getPropertyValue('-webkit-text-decoration') is 'none dotted rgb(0, 0, 128)' 26 PASS computedStyle.getPropertyValue('-webkit-text-decoration-line') is 'none' 27 PASS computedStyle.getPropertyValue('-webkit-text-decoration-style') is 'dotted' 28 PASS computedStyle.getPropertyValue('-webkit-text-decoration-color') is 'rgb(0, 0, 128)' 29 PASS checkComputedStyleValue('webkitTextDecoration', '-webkit-text-decoration') is true 30 31 CSS2.1 backwards compatibility of non-prefixed shorthand ("text-decoration: underline overline line-through blink;"): 32 PASS e.style.getPropertyValue('text-decoration') is 'underline overline line-through blink' 33 PASS e.style.getPropertyValue('text-decoration-line') is 'underline overline line-through blink' 34 PASS e.style.getPropertyValue('text-decoration-thickness') is '' 35 PASS e.style.getPropertyValue('text-decoration-style') is '' 36 PASS e.style.getPropertyValue('text-decoration-color') is '' 37 PASS computedStyle.getPropertyValue('text-decoration') is 'underline overline line-through' 38 PASS computedStyle.getPropertyValue('text-decoration-line') is 'underline overline line-through' 39 PASS computedStyle.getPropertyValue('text-decoration-thickness') is 'auto' 40 PASS computedStyle.getPropertyValue('text-decoration-style') is 'solid' 41 PASS computedStyle.getPropertyValue('text-decoration-color') is 'rgb(0, 0, 0)' 42 PASS checkComputedStyleValue('textDecoration', 'text-decoration') is true 43 44 Setting CSS3 longhands to initial values ("text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid; text-decoration-color: currentcolor;"): 45 PASS e.style.getPropertyValue('text-decoration') is 'none' 46 PASS e.style.getPropertyValue('text-decoration-line') is 'none' 47 PASS e.style.getPropertyValue('text-decoration-thickness') is 'auto' 48 PASS e.style.getPropertyValue('text-decoration-style') is 'solid' 49 PASS e.style.getPropertyValue('text-decoration-color') is 'currentcolor' 50 PASS computedStyle.getPropertyValue('text-decoration') is 'none' 51 PASS computedStyle.getPropertyValue('text-decoration-line') is 'none' 52 PASS computedStyle.getPropertyValue('text-decoration-thickness') is 'auto' 53 PASS computedStyle.getPropertyValue('text-decoration-style') is 'solid' 54 PASS computedStyle.getPropertyValue('text-decoration-color') is 'rgb(0, 0, 0)' 55 PASS checkComputedStyleValue('textDecoration', 'text-decoration') is true 56 57 Setting CSS3 longhands to values backwards compatibile with CSS2.1 ("text-decoration-line: underline overline line-through blink; text-decoration-thickness: auto; text-decoration-style: solid; text-decoration-color: currentcolor;"): 58 PASS e.style.getPropertyValue('text-decoration') is 'underline overline line-through blink' 59 PASS e.style.getPropertyValue('text-decoration-line') is 'underline overline line-through blink' 60 PASS e.style.getPropertyValue('text-decoration-thickness') is 'auto' 61 PASS e.style.getPropertyValue('text-decoration-style') is 'solid' 62 PASS e.style.getPropertyValue('text-decoration-color') is 'currentcolor' 63 PASS computedStyle.getPropertyValue('text-decoration') is 'underline overline line-through' 64 PASS computedStyle.getPropertyValue('text-decoration-line') is 'underline overline line-through' 65 PASS computedStyle.getPropertyValue('text-decoration-thickness') is 'auto' 66 PASS computedStyle.getPropertyValue('text-decoration-style') is 'solid' 67 PASS computedStyle.getPropertyValue('text-decoration-color') is 'rgb(0, 0, 0)' 68 PASS checkComputedStyleValue('textDecoration', 'text-decoration') is true 69 70 Setting CSS3 longhands to values not backwards compatibile with CSS2.1 ("text-decoration-line: underline overline line-through blink; text-decoration-thickness: 16px; text-decoration-style: dotted; text-decoration-color: blue;"): 71 PASS e.style.getPropertyValue('text-decoration') is 'underline overline line-through blink' 72 PASS e.style.getPropertyValue('text-decoration-line') is 'underline overline line-through blink' 73 PASS e.style.getPropertyValue('text-decoration-thickness') is '16px' 74 PASS e.style.getPropertyValue('text-decoration-style') is 'dotted' 75 PASS e.style.getPropertyValue('text-decoration-color') is 'blue' 76 PASS computedStyle.getPropertyValue('text-decoration') is 'underline overline line-through' 77 PASS computedStyle.getPropertyValue('text-decoration-line') is 'underline overline line-through' 78 PASS computedStyle.getPropertyValue('text-decoration-thickness') is '16px' 79 PASS computedStyle.getPropertyValue('text-decoration-style') is 'dotted' 80 PASS computedStyle.getPropertyValue('text-decoration-color') is 'rgb(0, 0, 255)' 81 PASS checkComputedStyleValue('textDecoration', 'text-decoration') is true 30 82 31 83 PASS successfullyParsed is true -
trunk/LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand.html
r290772 r291244 8 8 function testElementStyle(propertyJS, propertyCSS, value) 9 9 { 10 shouldBe("e.style.getProperty CSSValue('" + propertyCSS + "').cssText", "'" + value + "'");10 shouldBe("e.style.getPropertyValue('" + propertyCSS + "')", "'" + value + "'"); 11 11 } 12 12 … … 14 14 { 15 15 computedStyle = window.getComputedStyle(e, null); 16 shouldBe("computedStyle.getProperty CSSValue('" + propertyCSS + "').cssText", "'" + value + "'");16 shouldBe("computedStyle.getPropertyValue('" + propertyCSS + "')", "'" + value + "'"); 17 17 } 18 18 19 function checkComputedStyleValue( ) {20 var before = window.getComputedStyle(e, null).getPropertyValue( '-webkit-text-decoration');21 e.style .webkitTextDecoration= 'none';22 e.style .webkitTextDecoration= before;23 return (window.getComputedStyle(e, null).getPropertyValue( '-webkit-text-decoration') == before);19 function checkComputedStyleValue(propertyJS, propertyCSS) { 20 var before = window.getComputedStyle(e, null).getPropertyValue(propertyCSS); 21 e.style[propertyJS] = 'none'; 22 e.style[propertyJS] = before; 23 return (window.getComputedStyle(e, null).getPropertyValue(propertyCSS) == before); 24 24 } 25 25 … … 37 37 shouldBeNull("e.style.getPropertyCSSValue('-webkit-text-decoration')"); 38 38 testComputedStyle("webkitTextDecoration", "-webkit-text-decoration", "none solid rgb(0, 0, 0)"); 39 shouldBe("checkComputedStyleValue( )", "true");39 shouldBe("checkComputedStyleValue('webkitTextDecoration', '-webkit-text-decoration')", "true"); 40 40 debug(''); 41 41 … … 45 45 testComputedStyle("webkitTextDecorationLine", "-webkit-text-decoration-line", "underline overline line-through"); 46 46 testComputedStyle("webkitTextDecoration", "-webkit-text-decoration", "underline overline line-through solid rgb(0, 0, 0)"); 47 shouldBe("checkComputedStyleValue( )", "true");47 shouldBe("checkComputedStyleValue('webkitTextDecoration', '-webkit-text-decoration')", "true"); 48 48 debug(''); 49 49 … … 54 54 testComputedStyle("webkitTextDecorationStyle", "-webkit-text-decoration-style", "dashed"); 55 55 testComputedStyle("webkitTextDecorationColor", "-webkit-text-decoration-color", "rgb(255, 0, 0)"); 56 shouldBe("checkComputedStyleValue( )", "true");56 shouldBe("checkComputedStyleValue('webkitTextDecoration', '-webkit-text-decoration')", "true"); 57 57 debug(''); 58 58 … … 63 63 testComputedStyle("webkitTextDecorationStyle", "-webkit-text-decoration-style", "dotted"); 64 64 testComputedStyle("webkitTextDecorationColor", "-webkit-text-decoration-color", "rgb(0, 0, 128)"); 65 shouldBe("checkComputedStyleValue()", "true"); 65 shouldBe("checkComputedStyleValue('webkitTextDecoration', '-webkit-text-decoration')", "true"); 66 debug(''); 67 68 debug('CSS2.1 backwards compatibility of non-prefixed shorthand ("text-decoration: underline overline line-through blink;"):'); 69 e.style.cssText = "text-decoration: underline overline line-through blink"; 70 testElementStyle("textDecoration", "text-decoration", "underline overline line-through blink"); 71 testElementStyle("textDecorationLine", "text-decoration-line", "underline overline line-through blink"); 72 testElementStyle("textDecorationThickness", "text-decoration-thickness", ""); 73 testElementStyle("textDecorationStyle", "text-decoration-style", ""); 74 testElementStyle("textDecorationColor", "text-decoration-color", ""); 75 testComputedStyle("textDecoration", "text-decoration", "underline overline line-through"); 76 testComputedStyle("textDecorationLine", "text-decoration-line", "underline overline line-through"); 77 testComputedStyle("textDecorationThickness", "text-decoration-thickness", "auto"); 78 testComputedStyle("textDecorationStyle", "text-decoration-style", "solid"); 79 testComputedStyle("textDecorationColor", "text-decoration-color", "rgb(0, 0, 0)"); 80 shouldBe("checkComputedStyleValue('textDecoration', 'text-decoration')", "true"); 81 debug(''); 82 83 debug('Setting CSS3 longhands to initial values ("text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid; text-decoration-color: currentcolor;"):'); 84 e.style.cssText = "text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid; text-decoration-color: currentcolor;"; 85 testElementStyle("textDecoration", "text-decoration", "none"); 86 testElementStyle("textDecorationLine", "text-decoration-line", "none"); 87 testElementStyle("textDecorationThickness", "text-decoration-thickness", "auto"); 88 testElementStyle("textDecorationStyle", "text-decoration-style", "solid"); 89 testElementStyle("textDecorationColor", "text-decoration-color", "currentcolor"); 90 testComputedStyle("textDecoration", "text-decoration", "none"); 91 testComputedStyle("textDecorationLine", "text-decoration-line", "none"); 92 testComputedStyle("textDecorationThickness", "text-decoration-thickness", "auto"); 93 testComputedStyle("textDecorationStyle", "text-decoration-style", "solid"); 94 testComputedStyle("textDecorationColor", "text-decoration-color", "rgb(0, 0, 0)"); 95 shouldBe("checkComputedStyleValue('textDecoration', 'text-decoration')", "true"); 96 debug(''); 97 98 debug('Setting CSS3 longhands to values backwards compatibile with CSS2.1 ("text-decoration-line: underline overline line-through blink; text-decoration-thickness: auto; text-decoration-style: solid; text-decoration-color: currentcolor;"):'); 99 e.style.cssText = "text-decoration-line: underline overline line-through blink; text-decoration-thickness: auto; text-decoration-style: solid; text-decoration-color: currentcolor;"; 100 testElementStyle("textDecoration", "text-decoration", "underline overline line-through blink"); 101 testElementStyle("textDecorationLine", "text-decoration-line", "underline overline line-through blink"); 102 testElementStyle("textDecorationThickness", "text-decoration-thickness", "auto"); 103 testElementStyle("textDecorationStyle", "text-decoration-style", "solid"); 104 testElementStyle("textDecorationColor", "text-decoration-color", "currentcolor"); 105 testComputedStyle("textDecoration", "text-decoration", "underline overline line-through"); 106 testComputedStyle("textDecorationLine", "text-decoration-line", "underline overline line-through"); 107 testComputedStyle("textDecorationThickness", "text-decoration-thickness", "auto"); 108 testComputedStyle("textDecorationStyle", "text-decoration-style", "solid"); 109 testComputedStyle("textDecorationColor", "text-decoration-color", "rgb(0, 0, 0)"); 110 shouldBe("checkComputedStyleValue('textDecoration', 'text-decoration')", "true"); 111 debug(''); 112 113 debug('Setting CSS3 longhands to values not backwards compatibile with CSS2.1 ("text-decoration-line: underline overline line-through blink; text-decoration-thickness: 16px; text-decoration-style: dotted; text-decoration-color: blue;"):'); 114 e.style.cssText = "text-decoration-line: underline overline line-through blink; text-decoration-thickness: 16px; text-decoration-style: dotted; text-decoration-color: blue;"; 115 testElementStyle("textDecoration", "text-decoration", "underline overline line-through blink"); 116 testElementStyle("textDecorationLine", "text-decoration-line", "underline overline line-through blink"); 117 testElementStyle("textDecorationThickness", "text-decoration-thickness", "16px"); 118 testElementStyle("textDecorationStyle", "text-decoration-style", "dotted"); 119 testElementStyle("textDecorationColor", "text-decoration-color", "blue"); 120 testComputedStyle("textDecoration", "text-decoration", "underline overline line-through"); 121 testComputedStyle("textDecorationLine", "text-decoration-line", "underline overline line-through"); 122 testComputedStyle("textDecorationThickness", "text-decoration-thickness", "16px"); 123 testComputedStyle("textDecorationStyle", "text-decoration-style", "dotted"); 124 testComputedStyle("textDecorationColor", "text-decoration-color", "rgb(0, 0, 255)"); 125 shouldBe("checkComputedStyleValue('textDecoration', 'text-decoration')", "true"); 66 126 debug(''); 67 127 -
trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt
r290772 r291244 345 345 rect: style.getPropertyValue(text-combine-upright) : none 346 346 rect: style.getPropertyCSSValue(text-combine-upright) : [object CSSPrimitiveValue] 347 rect: style.getPropertyValue(text-decoration) : none 348 rect: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue] 347 rect: style.getPropertyValue(text-decoration-color) : rgb(0, 0, 0) 348 rect: style.getPropertyCSSValue(text-decoration-color) : [object CSSPrimitiveValue] 349 rect: style.getPropertyValue(text-decoration-line) : none 350 rect: style.getPropertyCSSValue(text-decoration-line) : [object CSSPrimitiveValue] 351 rect: style.getPropertyValue(text-decoration-style) : solid 352 rect: style.getPropertyCSSValue(text-decoration-style) : [object CSSPrimitiveValue] 353 rect: style.getPropertyValue(text-decoration-thickness) : auto 354 rect: style.getPropertyCSSValue(text-decoration-thickness) : [object CSSPrimitiveValue] 349 355 rect: style.getPropertyValue(text-emphasis-color) : rgb(0, 0, 0) 350 356 rect: style.getPropertyCSSValue(text-emphasis-color) : [object CSSPrimitiveValue] … … 855 861 g: style.getPropertyValue(text-combine-upright) : none 856 862 g: style.getPropertyCSSValue(text-combine-upright) : [object CSSPrimitiveValue] 857 g: style.getPropertyValue(text-decoration) : none 858 g: style.getPropertyCSSValue(text-decoration) : [object CSSPrimitiveValue] 863 g: style.getPropertyValue(text-decoration-color) : rgb(0, 0, 0) 864 g: style.getPropertyCSSValue(text-decoration-color) : [object CSSPrimitiveValue] 865 g: style.getPropertyValue(text-decoration-line) : none 866 g: style.getPropertyCSSValue(text-decoration-line) : [object CSSPrimitiveValue] 867 g: style.getPropertyValue(text-decoration-style) : solid 868 g: style.getPropertyCSSValue(text-decoration-style) : [object CSSPrimitiveValue] 869 g: style.getPropertyValue(text-decoration-thickness) : auto 870 g: style.getPropertyCSSValue(text-decoration-thickness) : [object CSSPrimitiveValue] 859 871 g: style.getPropertyValue(text-emphasis-color) : rgb(0, 0, 0) 860 872 g: style.getPropertyCSSValue(text-emphasis-color) : [object CSSPrimitiveValue] -
trunk/Source/WebCore/ChangeLog
r291241 r291244 1 2022-03-14 Oriol Brufau <obrufau@igalia.com> 2 3 [css] Implement 'text-decoration' as a shorthand. 4 https://bugs.webkit.org/show_bug.cgi?id=237175 5 6 Reviewed by Darin Adler. 7 8 The 'text-decoration' property was considered to be a longhand, sharing 9 a computed value with 'text-decoration-line'. 10 11 This patch switches 'text-decoration' to be shorthand instead. 12 According to the CSS Text Decoration spec, the longhands should be 13 'text-decoration-line', 'text-decoration-thickness', 14 'text-decoration-style' and 'text-decoration-color'. 15 I tried that in https://commits.webkit.org/r290756, but it got reverted 16 because of a performance regression. So as a first step, here I'm making 17 'text-decoration-line' be the only longhand. 18 19 There is a bunch of editing code that was getting/setting/removing 20 'text-decoration' as a longhand, so I'm switching that to instead 21 use 'text-decoration-line'. 22 23 Tests: fast/css/getComputedStyle/computed-style.html 24 fast/css/getComputedStyle/computed-style-without-renderer.html 25 fast/css/getComputedStyle/getComputedStyle-text-decoration.html 26 fast/css3-text/css3-text-decoration/getComputedStyle/getComputedStyle-text-decoration-shorthand.html 27 imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml.html 28 imported/w3c/web-platform-tests/css/css-variables/variable-presentation-attribute.html 29 imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree.html 30 svg/css/getComputedStyle-basic.xhtml 31 32 * css/CSSProperties.json: 33 * css/StyleProperties.cpp: 34 (WebCore::StyleProperties::getPropertyValue const): 35 (WebCore::StyleProperties::asText const): 36 * css/parser/CSSPropertyParser.cpp: 37 (WebCore::CSSPropertyParser::parseSingleValue): 38 (WebCore::CSSPropertyParser::parseShorthand): 39 * editing/EditingStyle.cpp: 40 (WebCore::HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent): 41 (WebCore::EditingStyle::init): 42 (WebCore::EditingStyle::styleWithResolvedTextDecorations const): 43 (WebCore::EditingStyle::collapseTextDecorationProperties): 44 (WebCore::textDecorationValueList): 45 (WebCore::EditingStyle::conflictsWithInlineStyleOfElement const): 46 (WebCore::EditingStyle::styleIsPresentInComputedStyleOfNode const): 47 (WebCore::EditingStyle::mergeStyle): 48 (WebCore::reconcileTextDecorationProperties): 49 (WebCore::StyleChange::StyleChange): 50 (WebCore::StyleChange::extractTextStyles): 51 (WebCore::extractPropertiesNotIn): 52 * editing/cocoa/HTMLConverter.mm: 53 (HTMLConverterCaches::propertyValueForNode): 54 (HTMLConverter::computedAttributesForElement): 55 * editing/ios/EditorIOS.mm: 56 (WebCore::Editor::removeUnchangeableStyles): 57 * editing/markup.cpp: 58 (WebCore::serializePreservingVisualAppearanceInternal): 59 * style/PropertyAllowlist.cpp: 60 (WebCore::Style::isValidCueStyleProperty): 61 1 62 2022-03-14 Tim Nguyen <ntim@apple.com> 2 63 -
trunk/Source/WebCore/css/CSSProperties.json
r290884 r291244 4616 4616 }, 4617 4617 "text-decoration": { 4618 "values": [ 4619 "underline", 4620 "overline", 4621 "line-through", 4622 { 4623 "value": "blink", 4624 "status": "not considering" 4625 } 4626 ], 4627 "codegen-properties": { 4628 "converter": "TextDecoration" 4618 "codegen-properties": { 4619 "longhands": [ 4620 "text-decoration-line" 4621 ] 4629 4622 }, 4630 4623 "specification": { … … 6855 6848 ] 6856 6849 }, 6850 "values": [ 6851 "underline", 6852 "overline", 6853 "line-through", 6854 { 6855 "value": "blink", 6856 "status": "not considering" 6857 } 6858 ], 6857 6859 "specification": { 6858 6860 "category": "css-text-decor", -
trunk/Source/WebCore/css/StyleProperties.cpp
r290772 r291244 276 276 case CSSPropertyFontVariant: 277 277 return fontVariantValue(); 278 case CSSPropertyTextDecoration: 279 if (auto line = getPropertyCSSValue(CSSPropertyTextDecorationLine)) 280 return line->cssText(); 281 return String(); 282 case CSSPropertyWebkitTextDecoration: 283 return getShorthandValue(webkitTextDecorationShorthand()); 278 284 case CSSPropertyTextDecorationSkip: 279 285 return textDecorationSkipValue(); … … 1434 1440 shorthandPropertyID = CSSPropertyScrollPaddingInline; 1435 1441 break; 1442 case CSSPropertyTextDecorationLine: 1443 shorthandPropertyID = CSSPropertyTextDecoration; 1444 break; 1436 1445 case CSSPropertyTransitionProperty: 1437 1446 case CSSPropertyTransitionDuration: -
trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp
r290884 r291244 4474 4474 return nullptr; 4475 4475 return consumeFilter(m_range, m_context, AllowedFilterFunctions::ColorFilters); 4476 case CSSPropertyTextDecoration:4477 4476 case CSSPropertyWebkitTextDecorationsInEffect: 4478 4477 case CSSPropertyTextDecorationLine: … … 6286 6285 case CSSPropertyTransition: 6287 6286 return consumeAnimationShorthand(transitionShorthandForParsing(), important); 6288 case CSSPropertyTextDecoration: 6287 case CSSPropertyTextDecoration: { 6288 auto line = consumeTextDecorationLine(m_range); 6289 if (!line || !m_range.atEnd()) 6290 return false; 6291 addProperty(CSSPropertyTextDecorationLine, property, line.releaseNonNull(), important); 6292 return true; 6293 } 6289 6294 case CSSPropertyWebkitTextDecoration: 6290 6295 // FIXME-NEWPARSER: We need to unprefix -line/-style/-color ASAP and get rid -
trunk/Source/WebCore/editing/EditingStyle.cpp
r290772 r291244 95 95 // Non-inheritable properties 96 96 CSSPropertyBackgroundColor, 97 CSSPropertyTextDecoration ,97 CSSPropertyTextDecorationLine, 98 98 }; 99 99 … … 221 221 public: 222 222 HTMLTextDecorationEquivalent(CSSValueID primitiveValue, const QualifiedName& tagName) 223 : HTMLElementEquivalent(CSSPropertyTextDecoration , primitiveValue, tagName)223 : HTMLElementEquivalent(CSSPropertyTextDecorationLine, primitiveValue, tagName) 224 224 , m_isUnderline(primitiveValue == CSSValueUnderline) 225 225 { … … 236 236 auto& mutableStyle = *style.m_mutableStyle; 237 237 return mutableStyle.getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect) 238 || mutableStyle.getPropertyCSSValue(CSSPropertyTextDecoration );238 || mutableStyle.getPropertyCSSValue(CSSPropertyTextDecorationLine); 239 239 } 240 240 … … 248 248 RefPtr<CSSValue> styleValue = style.m_mutableStyle->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect); 249 249 if (!styleValue) 250 styleValue = style.m_mutableStyle->getPropertyCSSValue(CSSPropertyTextDecoration );250 styleValue = style.m_mutableStyle->getPropertyCSSValue(CSSPropertyTextDecorationLine); 251 251 return is<CSSValueList>(styleValue) && downcast<CSSValueList>(*styleValue).hasValue(m_primitiveValue.get()); 252 252 } … … 511 511 m_mutableStyle->setProperty(CSSPropertyBackgroundColor, value->cssText()); 512 512 if (RefPtr<CSSValue> value = computedStyleAtPosition.propertyValue(CSSPropertyWebkitTextDecorationsInEffect)) { 513 m_mutableStyle->setProperty(CSSPropertyTextDecoration , value->cssText());513 m_mutableStyle->setProperty(CSSPropertyTextDecorationLine, value->cssText()); 514 514 m_mutableStyle->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); 515 515 } … … 596 596 597 597 if (valueList->length()) 598 style->setProperty(CSSPropertyTextDecoration , valueList.ptr());598 style->setProperty(CSSPropertyTextDecorationLine, valueList.ptr()); 599 599 else 600 style->setProperty(CSSPropertyTextDecoration , CSSValuePool::singleton().createIdentifierValue(CSSValueNone));600 style->setProperty(CSSPropertyTextDecorationLine, CSSValuePool::singleton().createIdentifierValue(CSSValueNone)); 601 601 602 602 return style; … … 780 780 781 781 if (textDecorationsInEffect->isValueList()) 782 m_mutableStyle->setProperty(CSSPropertyTextDecoration , textDecorationsInEffect->cssText(), m_mutableStyle->propertyIsImportant(CSSPropertyTextDecoration));782 m_mutableStyle->setProperty(CSSPropertyTextDecorationLine, textDecorationsInEffect->cssText(), m_mutableStyle->propertyIsImportant(CSSPropertyTextDecorationLine)); 783 783 else 784 m_mutableStyle->removeProperty(CSSPropertyTextDecoration );784 m_mutableStyle->removeProperty(CSSPropertyTextDecorationLine); 785 785 m_mutableStyle->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); 786 786 } … … 788 788 // CSS properties that create a visual difference only when applied to text. 789 789 static const CSSPropertyID textOnlyProperties[] = { 790 CSSPropertyTextDecoration ,790 CSSPropertyTextDecorationLine, 791 791 CSSPropertyWebkitTextDecorationsInEffect, 792 792 CSSPropertyFontStyle, … … 853 853 static RefPtr<CSSValueList> textDecorationValueList(const StyleProperties& properties) 854 854 { 855 RefPtr<CSSValue> value = properties.getPropertyCSSValue(CSSPropertyTextDecoration );855 RefPtr<CSSValue> value = properties.getPropertyCSSValue(CSSPropertyTextDecorationLine); 856 856 if (!is<CSSValueList>(value)) 857 857 return nullptr; … … 897 897 conflicts = true; 898 898 if (newValueList->length()) 899 newInlineStyle->setProperty(CSSPropertyTextDecoration , WTFMove(newValueList));899 newInlineStyle->setProperty(CSSPropertyTextDecorationLine, WTFMove(newValueList)); 900 900 else 901 newInlineStyle->removeProperty(CSSPropertyTextDecoration );901 newInlineStyle->removeProperty(CSSPropertyTextDecorationLine); 902 902 903 903 if (extractedStyle) { 904 bool isImportant = inlineStyle->propertyIsImportant(CSSPropertyTextDecoration );905 extractedStyle->setProperty(CSSPropertyTextDecoration , extractedValueList->cssText(), isImportant);904 bool isImportant = inlineStyle->propertyIsImportant(CSSPropertyTextDecorationLine); 905 extractedStyle->setProperty(CSSPropertyTextDecorationLine, extractedValueList->cssText(), isImportant); 906 906 } 907 907 } … … 917 917 continue; 918 918 919 if (propertyID == CSSPropertyWebkitTextDecorationsInEffect && inlineStyle->getPropertyCSSValue(CSSPropertyTextDecoration )) {919 if (propertyID == CSSPropertyWebkitTextDecorationsInEffect && inlineStyle->getPropertyCSSValue(CSSPropertyTextDecorationLine)) { 920 920 if (!newInlineStyle) 921 921 return true; 922 922 conflicts = true; 923 newInlineStyle->removeProperty(CSSPropertyTextDecoration );923 newInlineStyle->removeProperty(CSSPropertyTextDecorationLine); 924 924 if (extractedStyle) 925 extractedStyle->setProperty(CSSPropertyTextDecoration , inlineStyle->getPropertyValue(CSSPropertyTextDecoration), inlineStyle->propertyIsImportant(CSSPropertyTextDecoration));925 extractedStyle->setProperty(CSSPropertyTextDecorationLine, inlineStyle->getPropertyValue(CSSPropertyTextDecorationLine), inlineStyle->propertyIsImportant(CSSPropertyTextDecorationLine)); 926 926 } 927 927 … … 1050 1050 bool hasUnderline = false; 1051 1051 bool hasLineThrough = false; 1052 if (RefPtr<CSSValue> value = computedStyle.propertyValue(CSSPropertyTextDecoration )) {1052 if (RefPtr<CSSValue> value = computedStyle.propertyValue(CSSPropertyTextDecorationLine)) { 1053 1053 if (value->isValueList()) { 1054 1054 auto& cssValuePool = CSSValuePool::singleton(); … … 1284 1284 1285 1285 // text decorations never override values. 1286 if ((property.id() == CSSPropertyTextDecoration || property.id() == CSSPropertyWebkitTextDecorationsInEffect)1286 if ((property.id() == CSSPropertyTextDecorationLine || property.id() == CSSPropertyWebkitTextDecorationsInEffect) 1287 1287 && is<CSSValueList>(*property.value()) && value) { 1288 1288 if (is<CSSValueList>(*value)) { … … 1689 1689 { 1690 1690 RefPtr<CSSValue> textDecorationsInEffect = style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect); 1691 RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(CSSPropertyTextDecoration );1691 RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(CSSPropertyTextDecorationLine); 1692 1692 // We shouldn't have both text-decoration and -webkit-text-decorations-in-effect because that wouldn't make sense. 1693 1693 ASSERT(!textDecorationsInEffect || !textDecoration); 1694 1694 if (textDecorationsInEffect) { 1695 style->setProperty(CSSPropertyTextDecoration , textDecorationsInEffect->cssText());1695 style->setProperty(CSSPropertyTextDecorationLine, textDecorationsInEffect->cssText()); 1696 1696 style->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); 1697 1697 textDecoration = textDecorationsInEffect; … … 1700 1700 // If text-decoration is set to "none", remove the property because we don't want to add redundant "text-decoration: none". 1701 1701 if (textDecoration && !textDecoration->isValueList()) 1702 style->removeProperty(CSSPropertyTextDecoration );1702 style->removeProperty(CSSPropertyTextDecorationLine); 1703 1703 } 1704 1704 … … 1735 1735 RefPtr<CSSValue> value = computedStyle.propertyValue(CSSPropertyWebkitTextDecorationsInEffect); 1736 1736 if (!is<CSSValueList>(value)) 1737 value = computedStyle.propertyValue(CSSPropertyTextDecoration );1737 value = computedStyle.propertyValue(CSSPropertyTextDecorationLine); 1738 1738 1739 1739 RefPtr<CSSValueList> valueList; … … 1754 1754 if (shouldAddStrikeThrough && !hasLineThrough) 1755 1755 valueList->append(WTFMove(lineThrough)); 1756 mutableStyle->setProperty(CSSPropertyTextDecoration , valueList.get());1756 mutableStyle->setProperty(CSSPropertyTextDecorationLine, valueList.get()); 1757 1757 } else { 1758 1758 m_applyUnderline = shouldAddUnderline && !hasUnderline; … … 1816 1816 // Assuming reconcileTextDecorationProperties has been called, there should not be -webkit-text-decorations-in-effect 1817 1817 // Furthermore, text-decoration: none has been trimmed so that text-decoration property is always a CSSValueList. 1818 RefPtr<CSSValue> textDecoration = style.getPropertyCSSValue(CSSPropertyTextDecoration );1818 RefPtr<CSSValue> textDecoration = style.getPropertyCSSValue(CSSPropertyTextDecorationLine); 1819 1819 if (is<CSSValueList>(textDecoration)) { 1820 1820 auto& cssValuePool = CSSValuePool::singleton(); … … 1829 1829 1830 1830 // If trimTextDecorations, delete underline and line-through 1831 setTextDecorationProperty(style, newTextDecoration.get(), CSSPropertyTextDecoration );1831 setTextDecorationProperty(style, newTextDecoration.get(), CSSPropertyTextDecorationLine); 1832 1832 } 1833 1833 … … 1898 1898 1899 1899 RefPtr<CSSValue> baseTextDecorationsInEffect = extractPropertyValue(baseStyle, CSSPropertyWebkitTextDecorationsInEffect); 1900 diffTextDecorations(mutableStyle, CSSPropertyTextDecoration , baseTextDecorationsInEffect.get());1900 diffTextDecorations(mutableStyle, CSSPropertyTextDecorationLine, baseTextDecorationsInEffect.get()); 1901 1901 diffTextDecorations(mutableStyle, CSSPropertyWebkitTextDecorationsInEffect, baseTextDecorationsInEffect.get()); 1902 1902 -
trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm
r290772 r291244 642 642 inherit = true; 643 643 break; 644 case CSSPropertyTextDecoration :644 case CSSPropertyTextDecorationLine: 645 645 if (element.hasTagName(uTag) || element.hasTagName(insTag)) 646 646 return "underline"; … … 1038 1038 } 1039 1039 1040 String textDecoration = _caches->propertyValueForNode(element, CSSPropertyTextDecoration );1040 String textDecoration = _caches->propertyValueForNode(element, CSSPropertyTextDecorationLine); 1041 1041 if (textDecoration.length()) { 1042 1042 if (textDecoration.contains("underline")) -
trunk/Source/WebCore/editing/ios/EditorIOS.mm
r290005 r291244 160 160 defaultStyle->removeProperty(CSSPropertyFontVariantCaps); 161 161 // FIXME: we should handle also pasted quoted text, strikethrough, etc. <rdar://problem/9255115> 162 defaultStyle->removeProperty(CSSPropertyTextDecoration );162 defaultStyle->removeProperty(CSSPropertyTextDecorationLine); 163 163 defaultStyle->removeProperty(CSSPropertyWebkitTextDecorationsInEffect); // implements underline 164 164 -
trunk/Source/WebCore/editing/markup.cpp
r290772 r291244 936 936 // This assertion is caused at least when we select all text of a <body> element whose 937 937 // 'text-decoration' property is "inherit", and copy it. 938 if (!propertyMissingOrEqualToNone(fullySelectedRootStyle->style(), CSSPropertyTextDecoration ))939 fullySelectedRootStyle->style()->setProperty(CSSPropertyTextDecoration , CSSValueNone);938 if (!propertyMissingOrEqualToNone(fullySelectedRootStyle->style(), CSSPropertyTextDecorationLine)) 939 fullySelectedRootStyle->style()->setProperty(CSSPropertyTextDecorationLine, CSSValueNone); 940 940 if (!propertyMissingOrEqualToNone(fullySelectedRootStyle->style(), CSSPropertyWebkitTextDecorationsInEffect)) 941 941 fullySelectedRootStyle->style()->setProperty(CSSPropertyWebkitTextDecorationsInEffect, CSSValueNone); -
trunk/Source/WebCore/style/PropertyAllowlist.cpp
r291037 r291244 134 134 case CSSPropertyVisibility: 135 135 case CSSPropertyWhiteSpace: 136 case CSSPropertyTextDecoration :136 case CSSPropertyTextDecorationLine: 137 137 case CSSPropertyTextShadow: 138 138 case CSSPropertyBorderStyle:
Note: See TracChangeset
for help on using the changeset viewer.