Changeset 276262 in webkit
- Timestamp:
- Apr 19, 2021, 10:51:46 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/css/calc-parsing-expected.txt (modified) (2 diffs)
-
LayoutTests/fast/css/calc-parsing.html (modified) (1 diff)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-values/minmax-length-percent-serialize-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/CSSCalculationValue.cpp (modified) (2 diffs)
-
Source/WebCore/css/CSSCalculationValue.h (modified) (1 diff)
-
Source/WebCore/platform/CalculationValue.cpp (modified) (1 diff)
-
Source/WebCore/platform/CalculationValue.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r276261 r276262 1 2021-04-19 Darin Adler <darin@apple.com> 2 3 Nullptr crash in CSSCalcValue::category() via HTMLConverterCaches::floatPropertyValueForNode 4 https://bugs.webkit.org/show_bug.cgi?id=221392 5 6 Reviewed by Simon Fraser. 7 8 * fast/css/calc-parsing-expected.txt: Updated for change below. 9 * fast/css/calc-parsing.html: Added more test cases so this covers the affected cases of computed 10 style for calc expressions that mix percentages and numbers. Alternatively, we could remove this 11 entire test case because the web platform tests also cover this pretty well. 12 1 13 2021-04-19 Chris Gambrell <cgambrell@apple.com> 2 14 -
trunk/LayoutTests/fast/css/calc-parsing-expected.txt
r253105 r276262 1 Tests parsing of various valid and invalid calc expressions.1 Tests parsing and re-serializing of various valid and invalid calc expressions. 2 2 3 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". … … 5 5 6 6 7 testDiv.style["width"] = "calc(100px)" 8 PASS testDiv.style['width'] is "calc(100px)" 9 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "100px" 10 11 testDiv.style["width"] = "max(100px + 200px)" 12 PASS testDiv.style['width'] is "max(300px)" 13 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "300px" 14 15 testDiv.style["width"] = "max(100px , 200px)" 16 PASS testDiv.style['width'] is "max(200px)" 17 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "200px" 18 19 testDiv.style["width"] = "max(100px,200px)" 20 PASS testDiv.style['width'] is "max(200px)" 21 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "200px" 22 23 testDiv.style["width"] = "clamp(100px,123px,200px)" 24 PASS testDiv.style['width'] is "clamp(100px, 123px, 200px)" 25 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "123px" 26 27 testDiv.style["width"] = "clamp(100px,300px,200px)" 28 PASS testDiv.style['width'] is "clamp(100px, 300px, 200px)" 29 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "200px" 30 31 testDiv.style["width"] = "clamp(200px,300px,100px)" 32 PASS testDiv.style['width'] is "clamp(200px, 300px, 100px)" 33 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "200px" 34 35 testDiv.style["width"] = "clamp((50px + 50px),40px,200px)" 36 PASS testDiv.style['width'] is "clamp(100px, 40px, 200px)" 37 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "100px" 38 39 testDiv.style["width"] = "clamp(50px + 50px,40px,200px)" 40 PASS testDiv.style['width'] is "clamp(100px, 40px, 200px)" 41 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "100px" 42 43 testDiv.style["width"] = "calc(100px, 200px)" 44 PASS testDiv.style['width'] is "999px" 45 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "999px" 46 47 testDiv.style["width"] = "calc(100px 200px)" 48 PASS testDiv.style['width'] is "999px" 49 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "999px" 50 51 testDiv.style["width"] = "calc(100px ( 200px)" 52 PASS testDiv.style['width'] is "999px" 53 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "999px" 54 55 testDiv.style["width"] = "min(100px 200px)" 56 PASS testDiv.style['width'] is "999px" 57 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "999px" 58 59 testDiv.style["width"] = "max(100px 200px)" 60 PASS testDiv.style['width'] is "999px" 61 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "999px" 62 63 testDiv.style["width"] = "max(100px,, 200px)" 64 PASS testDiv.style['width'] is "999px" 65 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "999px" 66 67 testDiv.style["width"] = "max(100px, , 200px)" 68 PASS testDiv.style['width'] is "999px" 69 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "999px" 70 71 testDiv.style["width"] = "max(100px, 200px,)" 72 PASS testDiv.style['width'] is "999px" 73 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "999px" 74 75 testDiv.style["width"] = "clamp(200px,300px)" 76 PASS testDiv.style['width'] is "999px" 77 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "999px" 78 79 testDiv.style["width"] = "clamp(200px,300px,)" 80 PASS testDiv.style['width'] is "999px" 81 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "999px" 82 83 testDiv.style["width"] = "clamp(200px,,300px)" 84 PASS testDiv.style['width'] is "999px" 85 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "999px" 86 87 testDiv.style["width"] = "clamp((),,300px)" 88 PASS testDiv.style['width'] is "999px" 89 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "999px" 90 91 testDiv.style["width"] = "clamp(1px,2px,2px,4px)" 92 PASS testDiv.style['width'] is "999px" 93 PASS window.getComputedStyle(testDiv).getPropertyValue('width') is "999px" 7 element.style["width"] = "calc(100px)" 8 PASS element.style['width'] is "calc(100px)" 9 PASS getComputedStyle(element).getPropertyValue('width') is "100px" 10 11 element.style["width"] = "max(100px + 200px)" 12 PASS element.style['width'] is "max(300px)" 13 PASS getComputedStyle(element).getPropertyValue('width') is "300px" 14 15 element.style["width"] = "max(100px , 200px)" 16 PASS element.style['width'] is "max(200px)" 17 PASS getComputedStyle(element).getPropertyValue('width') is "200px" 18 19 element.style["width"] = "max(100px,200px)" 20 PASS element.style['width'] is "max(200px)" 21 PASS getComputedStyle(element).getPropertyValue('width') is "200px" 22 23 element.style["width"] = "clamp(100px,123px,200px)" 24 PASS element.style['width'] is "clamp(100px, 123px, 200px)" 25 PASS getComputedStyle(element).getPropertyValue('width') is "123px" 26 27 element.style["width"] = "clamp(100px,300px,200px)" 28 PASS element.style['width'] is "clamp(100px, 300px, 200px)" 29 PASS getComputedStyle(element).getPropertyValue('width') is "200px" 30 31 element.style["width"] = "clamp(200px,300px,100px)" 32 PASS element.style['width'] is "clamp(200px, 300px, 100px)" 33 PASS getComputedStyle(element).getPropertyValue('width') is "200px" 34 35 element.style["width"] = "clamp((50px + 50px),40px,200px)" 36 PASS element.style['width'] is "clamp(100px, 40px, 200px)" 37 PASS getComputedStyle(element).getPropertyValue('width') is "100px" 38 39 element.style["width"] = "clamp(50px + 50px,40px,200px)" 40 PASS element.style['width'] is "clamp(100px, 40px, 200px)" 41 PASS getComputedStyle(element).getPropertyValue('width') is "100px" 42 43 element.style["width"] = "min(100px,0%)" 44 PASS element.style['width'] is "min(100px, 0%)" 45 PASS getComputedStyle(element).getPropertyValue('width') is "0px" 46 47 element.style["width"] = "max(100px,0%)" 48 PASS element.style['width'] is "max(100px, 0%)" 49 PASS getComputedStyle(element).getPropertyValue('width') is "100px" 50 51 element.style["width"] = "clamp(100px,0%,1%)" 52 PASS element.style['width'] is "clamp(100px, 0%, 1%)" 53 PASS getComputedStyle(element).getPropertyValue('width') is "100px" 54 55 element.style["width"] = "calc(100px, 200px)" 56 PASS element.style['width'] is "999px" 57 PASS getComputedStyle(element).getPropertyValue('width') is "999px" 58 59 element.style["width"] = "calc(100px 200px)" 60 PASS element.style['width'] is "999px" 61 PASS getComputedStyle(element).getPropertyValue('width') is "999px" 62 63 element.style["width"] = "calc(100px ( 200px)" 64 PASS element.style['width'] is "999px" 65 PASS getComputedStyle(element).getPropertyValue('width') is "999px" 66 67 element.style["width"] = "min(100px 200px)" 68 PASS element.style['width'] is "999px" 69 PASS getComputedStyle(element).getPropertyValue('width') is "999px" 70 71 element.style["width"] = "max(100px 200px)" 72 PASS element.style['width'] is "999px" 73 PASS getComputedStyle(element).getPropertyValue('width') is "999px" 74 75 element.style["width"] = "max(100px,, 200px)" 76 PASS element.style['width'] is "999px" 77 PASS getComputedStyle(element).getPropertyValue('width') is "999px" 78 79 element.style["width"] = "max(100px, , 200px)" 80 PASS element.style['width'] is "999px" 81 PASS getComputedStyle(element).getPropertyValue('width') is "999px" 82 83 element.style["width"] = "max(100px, 200px,)" 84 PASS element.style['width'] is "999px" 85 PASS getComputedStyle(element).getPropertyValue('width') is "999px" 86 87 element.style["width"] = "clamp(200px,300px)" 88 PASS element.style['width'] is "999px" 89 PASS getComputedStyle(element).getPropertyValue('width') is "999px" 90 91 element.style["width"] = "clamp(200px,300px,)" 92 PASS element.style['width'] is "999px" 93 PASS getComputedStyle(element).getPropertyValue('width') is "999px" 94 95 element.style["width"] = "clamp(200px,,300px)" 96 PASS element.style['width'] is "999px" 97 PASS getComputedStyle(element).getPropertyValue('width') is "999px" 98 99 element.style["width"] = "clamp((),,300px)" 100 PASS element.style['width'] is "999px" 101 PASS getComputedStyle(element).getPropertyValue('width') is "999px" 102 103 element.style["width"] = "clamp(1px,2px,2px,4px)" 104 PASS element.style['width'] is "999px" 105 PASS getComputedStyle(element).getPropertyValue('width') is "999px" 106 107 element.style["min-width"] = "calc(100px)" 108 PASS element.style['min-width'] is "calc(100px)" 109 PASS getComputedStyle(element).getPropertyValue('min-width') is "100px" 110 111 element.style["min-width"] = "max(100px + 200px)" 112 PASS element.style['min-width'] is "max(300px)" 113 PASS getComputedStyle(element).getPropertyValue('min-width') is "300px" 114 115 element.style["min-width"] = "max(100px , 200px)" 116 PASS element.style['min-width'] is "max(200px)" 117 PASS getComputedStyle(element).getPropertyValue('min-width') is "200px" 118 119 element.style["min-width"] = "max(100px,200px)" 120 PASS element.style['min-width'] is "max(200px)" 121 PASS getComputedStyle(element).getPropertyValue('min-width') is "200px" 122 123 element.style["min-width"] = "clamp(100px,123px,200px)" 124 PASS element.style['min-width'] is "clamp(100px, 123px, 200px)" 125 PASS getComputedStyle(element).getPropertyValue('min-width') is "123px" 126 127 element.style["min-width"] = "clamp(100px,300px,200px)" 128 PASS element.style['min-width'] is "clamp(100px, 300px, 200px)" 129 PASS getComputedStyle(element).getPropertyValue('min-width') is "200px" 130 131 element.style["min-width"] = "clamp(200px,300px,100px)" 132 PASS element.style['min-width'] is "clamp(200px, 300px, 100px)" 133 PASS getComputedStyle(element).getPropertyValue('min-width') is "200px" 134 135 element.style["min-width"] = "clamp((50px + 50px),40px,200px)" 136 PASS element.style['min-width'] is "clamp(100px, 40px, 200px)" 137 PASS getComputedStyle(element).getPropertyValue('min-width') is "100px" 138 139 element.style["min-width"] = "clamp(50px + 50px,40px,200px)" 140 PASS element.style['min-width'] is "clamp(100px, 40px, 200px)" 141 PASS getComputedStyle(element).getPropertyValue('min-width') is "100px" 142 143 element.style["min-width"] = "min(100px,0%)" 144 PASS element.style['min-width'] is "min(100px, 0%)" 145 PASS getComputedStyle(element).getPropertyValue('min-width') is "min(100px, 0%)" 146 147 element.style["min-width"] = "max(100px,0%)" 148 PASS element.style['min-width'] is "max(100px, 0%)" 149 PASS getComputedStyle(element).getPropertyValue('min-width') is "max(100px, 0%)" 150 151 element.style["min-width"] = "clamp(100px,0%,1%)" 152 PASS element.style['min-width'] is "clamp(100px, 0%, 1%)" 153 PASS getComputedStyle(element).getPropertyValue('min-width') is "clamp(100px, 0%, 1%)" 154 155 element.style["min-width"] = "calc(100px, 200px)" 156 PASS element.style['min-width'] is "999px" 157 PASS getComputedStyle(element).getPropertyValue('min-width') is "999px" 158 159 element.style["min-width"] = "calc(100px 200px)" 160 PASS element.style['min-width'] is "999px" 161 PASS getComputedStyle(element).getPropertyValue('min-width') is "999px" 162 163 element.style["min-width"] = "calc(100px ( 200px)" 164 PASS element.style['min-width'] is "999px" 165 PASS getComputedStyle(element).getPropertyValue('min-width') is "999px" 166 167 element.style["min-width"] = "min(100px 200px)" 168 PASS element.style['min-width'] is "999px" 169 PASS getComputedStyle(element).getPropertyValue('min-width') is "999px" 170 171 element.style["min-width"] = "max(100px 200px)" 172 PASS element.style['min-width'] is "999px" 173 PASS getComputedStyle(element).getPropertyValue('min-width') is "999px" 174 175 element.style["min-width"] = "max(100px,, 200px)" 176 PASS element.style['min-width'] is "999px" 177 PASS getComputedStyle(element).getPropertyValue('min-width') is "999px" 178 179 element.style["min-width"] = "max(100px, , 200px)" 180 PASS element.style['min-width'] is "999px" 181 PASS getComputedStyle(element).getPropertyValue('min-width') is "999px" 182 183 element.style["min-width"] = "max(100px, 200px,)" 184 PASS element.style['min-width'] is "999px" 185 PASS getComputedStyle(element).getPropertyValue('min-width') is "999px" 186 187 element.style["min-width"] = "clamp(200px,300px)" 188 PASS element.style['min-width'] is "999px" 189 PASS getComputedStyle(element).getPropertyValue('min-width') is "999px" 190 191 element.style["min-width"] = "clamp(200px,300px,)" 192 PASS element.style['min-width'] is "999px" 193 PASS getComputedStyle(element).getPropertyValue('min-width') is "999px" 194 195 element.style["min-width"] = "clamp(200px,,300px)" 196 PASS element.style['min-width'] is "999px" 197 PASS getComputedStyle(element).getPropertyValue('min-width') is "999px" 198 199 element.style["min-width"] = "clamp((),,300px)" 200 PASS element.style['min-width'] is "999px" 201 PASS getComputedStyle(element).getPropertyValue('min-width') is "999px" 202 203 element.style["min-width"] = "clamp(1px,2px,2px,4px)" 204 PASS element.style['min-width'] is "999px" 205 PASS getComputedStyle(element).getPropertyValue('min-width') is "999px" 94 206 PASS successfullyParsed is true 95 207 -
trunk/LayoutTests/fast/css/calc-parsing.html
r253105 r276262 5 5 <div id="testDiv"></div> 6 6 <script> 7 description("Tests parsing of various valid and invalid calc expressions.");7 description("Tests parsing and re-serializing of various valid and invalid calc expressions."); 8 8 9 var testDiv= document.getElementById("testDiv");9 var element = document.getElementById("testDiv"); 10 10 11 function test Expression(expression, specifiedValue, computedValue)11 function testProperty(propertyName) 12 12 { 13 debug(''); 14 testDiv.style["width"] = '999px'; 13 function testExpression(expression, specifiedValue, computedValue) 14 { 15 debug(''); 16 element.style[propertyName] = '999px'; 15 17 16 evalAndLog(`testDiv.style["width"] = "${expression}"`); 17 shouldBeEqualToString("testDiv.style['width']", `${specifiedValue}`); 18 shouldBeEqualToString("window.getComputedStyle(testDiv).getPropertyValue('width')", `${computedValue}`); 18 evalAndLog(`element.style["${propertyName}"] = "${expression}"`); 19 shouldBeEqualToString(`element.style['${propertyName}']`, `${specifiedValue}`); 20 shouldBeEqualToString(`getComputedStyle(element).getPropertyValue('${propertyName}')`, `${computedValue}`); 21 } 22 23 // Valid expressions. 24 testExpression('calc(100px)', 'calc(100px)', '100px'); 25 testExpression('max(100px + 200px)', 'max(300px)', '300px'); 26 testExpression('max(100px , 200px)', 'max(200px)', '200px'); 27 testExpression('max(100px,200px)', 'max(200px)', '200px'); 28 testExpression('clamp(100px,123px,200px)', 'clamp(100px, 123px, 200px)', '123px'); 29 testExpression('clamp(100px,300px,200px)', 'clamp(100px, 300px, 200px)', '200px'); 30 testExpression('clamp(200px,300px,100px)', 'clamp(200px, 300px, 100px)', '200px'); 31 testExpression('clamp((50px + 50px),40px,200px)', 'clamp(100px, 40px, 200px)', '100px'); 32 testExpression('clamp(50px + 50px,40px,200px)', 'clamp(100px, 40px, 200px)', '100px'); 33 testExpression('min(100px,0%)', 'min(100px, 0%)', propertyName == 'width' ? '0px' : "min(100px, 0%)"); 34 testExpression('max(100px,0%)', 'max(100px, 0%)', propertyName == 'width' ? '100px' : "max(100px, 0%)"); 35 testExpression('clamp(100px,0%,1%)', 'clamp(100px, 0%, 1%)', propertyName == 'width' ? '100px' : "clamp(100px, 0%, 1%)"); 36 37 // Non-parsing expressions. 38 testExpression('calc(100px, 200px)', '999px', '999px'); 39 testExpression('calc(100px 200px)', '999px', '999px'); 40 testExpression('calc(100px ( 200px)', '999px', '999px'); 41 testExpression('min(100px 200px)', '999px', '999px'); 42 testExpression('max(100px 200px)', '999px', '999px'); 43 testExpression('max(100px,, 200px)', '999px', '999px'); 44 testExpression('max(100px, , 200px)', '999px', '999px'); 45 testExpression('max(100px, 200px,)', '999px', '999px'); 46 testExpression('clamp(200px,300px)', '999px', '999px'); 47 testExpression('clamp(200px,300px,)', '999px', '999px'); 48 testExpression('clamp(200px,,300px)', '999px', '999px'); 49 testExpression('clamp((),,300px)', '999px', '999px'); 50 testExpression('clamp(1px,2px,2px,4px)', '999px', '999px'); 19 51 } 20 52 21 // Valid expressions. 22 testExpression('calc(100px)', 'calc(100px)', '100px'); 23 testExpression('max(100px + 200px)', 'max(300px)', '300px'); 24 testExpression('max(100px , 200px)', 'max(200px)', '200px'); 25 testExpression('max(100px,200px)', 'max(200px)', '200px'); 26 testExpression('clamp(100px,123px,200px)', 'clamp(100px, 123px, 200px)', '123px'); 27 testExpression('clamp(100px,300px,200px)', 'clamp(100px, 300px, 200px)', '200px'); 28 testExpression('clamp(200px,300px,100px)', 'clamp(200px, 300px, 100px)', '200px'); 29 testExpression('clamp((50px + 50px),40px,200px)', 'clamp(100px, 40px, 200px)', '100px'); 30 testExpression('clamp(50px + 50px,40px,200px)', 'clamp(100px, 40px, 200px)', '100px'); 31 32 // Non-parsing expression. 33 testExpression('calc(100px, 200px)', '999px', '999px'); 34 testExpression('calc(100px 200px)', '999px', '999px'); 35 36 testExpression('calc(100px ( 200px)', '999px', '999px'); 37 38 testExpression('min(100px 200px)', '999px', '999px'); 39 testExpression('max(100px 200px)', '999px', '999px'); 40 testExpression('max(100px,, 200px)', '999px', '999px'); 41 testExpression('max(100px, , 200px)', '999px', '999px'); 42 testExpression('max(100px, 200px,)', '999px', '999px'); 43 44 testExpression('clamp(200px,300px)', '999px', '999px'); 45 testExpression('clamp(200px,300px,)', '999px', '999px'); 46 testExpression('clamp(200px,,300px)', '999px', '999px'); 47 testExpression('clamp((),,300px)', '999px', '999px'); 48 testExpression('clamp(1px,2px,2px,4px)', '999px', '999px'); 53 testProperty("width"); 54 testProperty("min-width"); 49 55 </script> 50 56 <script src="../../resources/js-test-post.js"></script> -
trunk/LayoutTests/imported/w3c/ChangeLog
r276242 r276262 1 2021-04-19 Darin Adler <darin@apple.com> 2 3 Nullptr crash in CSSCalcValue::category() via HTMLConverterCaches::floatPropertyValueForNode 4 https://bugs.webkit.org/show_bug.cgi?id=221392 5 6 Reviewed by Simon Fraser. 7 8 * web-platform-tests/css/css-values/minmax-length-percent-serialize-expected.txt: 9 Updated to reflect 8 tests passing that were failing before. 10 1 11 2021-04-19 Youenn Fablet <youenn@apple.com> 2 12 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-values/minmax-length-percent-serialize-expected.txt
r267650 r276262 16 16 PASS 'max(1px + 1%)' as a used value should serialize as '2px'. 17 17 PASS 'min(20px, 10%)' as a specified value should serialize as 'min(20px, 10%)'. 18 FAIL 'min(20px, 10%)' as a computed value should serialize as 'min(20px, 10%)'. assert_not_equals: 'min(20px, 10%)' should be valid in text-indent. got disallowed value "" 18 PASS 'min(20px, 10%)' as a computed value should serialize as 'min(20px, 10%)'. 19 19 PASS 'min(20px, 10%)' as a used value should serialize as '10px'. 20 20 PASS 'min(1em, 10%)' as a specified value should serialize as 'min(1em, 10%)'. 21 FAIL 'min(1em, 10%)' as a computed value should serialize as 'min(16px, 10%)'. assert_not_equals: 'min(1em, 10%)' should be valid in text-indent. got disallowed value "" 21 PASS 'min(1em, 10%)' as a computed value should serialize as 'min(16px, 10%)'. 22 22 PASS 'min(1em, 10%)' as a used value should serialize as '10px'. 23 23 PASS 'min(10%, 20px)' as a specified value should serialize as 'min(10%, 20px)'. 24 FAIL 'min(10%, 20px)' as a computed value should serialize as 'min(10%, 20px)'. assert_not_equals: 'min(10%, 20px)' should be valid in text-indent. got disallowed value "" 24 PASS 'min(10%, 20px)' as a computed value should serialize as 'min(10%, 20px)'. 25 25 PASS 'min(10%, 20px)' as a used value should serialize as '10px'. 26 26 PASS 'min(10%, 1em)' as a specified value should serialize as 'min(10%, 1em)'. 27 FAIL 'min(10%, 1em)' as a computed value should serialize as 'min(10%, 16px)'. assert_not_equals: 'min(10%, 1em)' should be valid in text-indent. got disallowed value "" 27 PASS 'min(10%, 1em)' as a computed value should serialize as 'min(10%, 16px)'. 28 28 PASS 'min(10%, 1em)' as a used value should serialize as '10px'. 29 29 PASS 'max(20px, 10%)' as a specified value should serialize as 'max(20px, 10%)'. 30 FAIL 'max(20px, 10%)' as a computed value should serialize as 'max(20px, 10%)'. assert_not_equals: 'max(20px, 10%)' should be valid in text-indent. got disallowed value "" 30 PASS 'max(20px, 10%)' as a computed value should serialize as 'max(20px, 10%)'. 31 31 PASS 'max(20px, 10%)' as a used value should serialize as '20px'. 32 32 PASS 'max(1em, 10%)' as a specified value should serialize as 'max(1em, 10%)'. 33 FAIL 'max(1em, 10%)' as a computed value should serialize as 'max(16px, 10%)'. assert_not_equals: 'max(1em, 10%)' should be valid in text-indent. got disallowed value "" 33 PASS 'max(1em, 10%)' as a computed value should serialize as 'max(16px, 10%)'. 34 34 PASS 'max(1em, 10%)' as a used value should serialize as '16px'. 35 35 PASS 'max(10%, 20px)' as a specified value should serialize as 'max(10%, 20px)'. 36 FAIL 'max(10%, 20px)' as a computed value should serialize as 'max(10%, 20px)'. assert_not_equals: 'max(10%, 20px)' should be valid in text-indent. got disallowed value "" 36 PASS 'max(10%, 20px)' as a computed value should serialize as 'max(10%, 20px)'. 37 37 PASS 'max(10%, 20px)' as a used value should serialize as '20px'. 38 38 PASS 'max(10%, 1em)' as a specified value should serialize as 'max(10%, 1em)'. 39 FAIL 'max(10%, 1em)' as a computed value should serialize as 'max(10%, 16px)'. assert_not_equals: 'max(10%, 1em)' should be valid in text-indent. got disallowed value "" 39 PASS 'max(10%, 1em)' as a computed value should serialize as 'max(10%, 16px)'. 40 40 PASS 'max(10%, 1em)' as a used value should serialize as '16px'. 41 41 PASS 'min(10% + 30px, 5em + 5%)' as a specified value should serialize as 'min(10% + 30px, 5% + 5em)'. -
trunk/Source/WebCore/ChangeLog
r276260 r276262 1 2021-04-19 Darin Adler <darin@apple.com> 2 3 Nullptr crash in CSSCalcValue::category() via HTMLConverterCaches::floatPropertyValueForNode 4 https://bugs.webkit.org/show_bug.cgi?id=221392 5 6 Reviewed by Simon Fraser. 7 8 * css/CSSCalculationValue.cpp: 9 (WebCore::CSSCalcOperationNode::createCalcExpression const): Pass in a destination category 10 when creating a CalcExpressionOperation. 11 (WebCore::createCSS): Pass the destination category from the CalcExpressionOperation when 12 creating a CSSCalcOperationNode. 13 14 * css/CSSCalculationValue.h: Moved the CalculationCategory enumeration from here to 15 CalculationValue.h. 16 17 * platform/CalculationValue.cpp: 18 (WebCore::operator==): Include destination category when comparing. 19 20 * platform/CalculationValue.h: Moved CalculationCategory here. Added a destination 21 category constructor argument, data members, and getter function to the 22 CalcExpressionOperation class. 23 1 24 2021-04-19 Antti Koivisto <antti@apple.com> 2 25 -
trunk/Source/WebCore/css/CSSCalculationValue.cpp
r276052 r276262 1368 1368 nodes.uncheckedAppend(WTFMove(node)); 1369 1369 } 1370 return makeUnique<CalcExpressionOperation>(WTFMove(nodes), m_operator); 1370 1371 // Reverse the operation we did when creating this node, recovering a suitable destination category for otherwise-ambiguous min/max/clamp nodes. 1372 // Note that this category is really only good enough for that purpose and is not accurate for other node types; we could use a boolean instead. 1373 auto destinationCategory = CalculationCategory::Other; 1374 if (category() == CalculationCategory::PercentLength) 1375 destinationCategory = CalculationCategory::Length; 1376 else if (category() == CalculationCategory::PercentNumber) 1377 destinationCategory = CalculationCategory::Number; 1378 1379 return makeUnique<CalcExpressionOperation>(WTFMove(nodes), m_operator, destinationCategory); 1371 1380 } 1372 1381 … … 2037 2046 if (children.isEmpty()) 2038 2047 return nullptr; 2039 return CSSCalcOperationNode::createMinOrMaxOrClamp(op, WTFMove(children), CalculationCategory::Other);2048 return CSSCalcOperationNode::createMinOrMaxOrClamp(op, WTFMove(children), operationNode.destinationCategory()); 2040 2049 } 2041 2050 } -
trunk/Source/WebCore/css/CSSCalculationValue.h
r253079 r276262 44 44 class CSSToLengthConversionData; 45 45 class RenderStyle; 46 47 // FIXME: Unify with CSSPrimitiveValue::UnitCategory.48 enum class CalculationCategory : uint8_t {49 Number = 0,50 Length,51 Percent,52 PercentNumber,53 PercentLength,54 Angle,55 Time,56 Frequency,57 // TODO:58 // Flex,59 // Resolution60 Other61 };62 46 63 47 class CSSCalcExpressionNode : public RefCounted<CSSCalcExpressionNode> { -
trunk/Source/WebCore/platform/CalculationValue.cpp
r253105 r276262 181 181 bool operator==(const CalcExpressionOperation& a, const CalcExpressionOperation& b) 182 182 { 183 if (a.getOperator() != b.getOperator() )183 if (a.getOperator() != b.getOperator() || a.destinationCategory() != b.destinationCategory()) 184 184 return false; 185 // Maybe Vectors of unique_ptrs should always do deep compare?185 // FIXME: Would be nice to have a helper function for doing a deep compare on a vector of pointers. 186 186 if (a.children().size() != b.children().size()) 187 187 return false; -
trunk/Source/WebCore/platform/CalculationValue.h
r253105 r276262 43 43 namespace WebCore { 44 44 45 // FIXME: Find a way to unify this with CSSPrimitiveValue::UnitCategory? 46 enum class CalculationCategory : uint8_t { 47 Number, 48 Length, 49 Percent, 50 PercentNumber, 51 PercentLength, 52 Angle, 53 Time, 54 Frequency, 55 Other 56 }; 57 45 58 // Don't change these values; parsing uses them. 46 59 enum class CalcOperator : uint8_t { … … 152 165 class CalcExpressionOperation final : public CalcExpressionNode { 153 166 public: 154 CalcExpressionOperation(Vector<std::unique_ptr<CalcExpressionNode>>&& children, CalcOperator );167 CalcExpressionOperation(Vector<std::unique_ptr<CalcExpressionNode>>&& children, CalcOperator, CalculationCategory destinationCategory = CalculationCategory::Other); 155 168 156 169 CalcOperator getOperator() const { return m_operator; } 170 CalculationCategory destinationCategory() const { return m_destinationCategory; } 157 171 158 172 const Vector<std::unique_ptr<CalcExpressionNode>>& children() const { return m_children; } … … 165 179 Vector<std::unique_ptr<CalcExpressionNode>> m_children; 166 180 CalcOperator m_operator; 181 CalculationCategory m_destinationCategory { CalculationCategory::Other }; 167 182 }; 168 183 … … 238 253 } 239 254 240 inline CalcExpressionOperation::CalcExpressionOperation(Vector<std::unique_ptr<CalcExpressionNode>>&& children, CalcOperator op )255 inline CalcExpressionOperation::CalcExpressionOperation(Vector<std::unique_ptr<CalcExpressionNode>>&& children, CalcOperator op, CalculationCategory destinationCategory) 241 256 : CalcExpressionNode(CalcExpressionNodeType::Operation) 242 257 , m_children(WTFMove(children)) 243 258 , m_operator(op) 259 , m_destinationCategory(destinationCategory) 244 260 { 245 261 }
Note:
See TracChangeset
for help on using the changeset viewer.