Changeset 279358 in webkit
- Timestamp:
- Jun 28, 2021 6:34:20 PM (13 months ago)
- Location:
- trunk
- Files:
-
- 38 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/css-custom-properties-api/inline.html (modified) (2 diffs)
-
LayoutTests/fast/css/variables/test-suite/011.html (modified) (2 diffs)
-
LayoutTests/fast/css/variables/test-suite/013.html (modified) (2 diffs)
-
LayoutTests/fast/css/variables/test-suite/041.html (modified) (2 diffs)
-
LayoutTests/fast/css/variables/test-suite/043.html (modified) (2 diffs)
-
LayoutTests/fast/css/variables/test-suite/061.html (modified) (2 diffs)
-
LayoutTests/fast/css/variables/test-suite/100.html (modified) (2 diffs)
-
LayoutTests/fast/css/variables/test-suite/105.html (modified) (2 diffs)
-
LayoutTests/fast/css/variables/test-suite/136.html (modified) (2 diffs)
-
LayoutTests/fast/css/variables/test-suite/170.html (modified) (2 diffs)
-
LayoutTests/fast/css/variables/test-suite/171.html (modified) (2 diffs)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/at-property-animation-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/at-property-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/at-property-shadow-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/at-property.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/determine-registration-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/registered-property-cssom-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/var-reference-registered-properties-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-syntax/declarations-trim-whitespace-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-cssText-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-definition-expected.txt (modified) (4 diffs)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-definition.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-reference-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-reference.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-substitution-variable-declaration-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-substitution-variable-declaration.html (modified) (3 diffs)
-
LayoutTests/imported/w3c/web-platform-tests/css/cssom/variable-names-expected.txt (modified) (1 diff)
-
LayoutTests/platform/mac/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/CSSComputedStyleDeclaration.cpp (modified) (1 diff)
-
Source/WebCore/css/CSSCustomPropertyValue.cpp (modified) (4 diffs)
-
Source/WebCore/css/CSSCustomPropertyValue.h (modified) (6 diffs)
-
Source/WebCore/css/CSSVariableReferenceValue.cpp (modified) (1 diff)
-
Source/WebCore/css/calc/CSSCalcExpressionNodeParser.cpp (modified) (2 diffs)
-
Source/WebCore/css/parser/CSSParserImpl.cpp (modified) (3 diffs)
-
Source/WebCore/css/parser/CSSVariableParser.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r279356 r279358 1 2021-06-28 Darin Adler <darin@apple.com> 2 3 CSS parser "consume declaration" algorithm does not handle whitespace correctly 4 https://bugs.webkit.org/show_bug.cgi?id=227368 5 6 Reviewed by Sam Weinig. 7 8 * css-custom-properties-api/inline.html: Update expectations to expect leading 9 whitespace to be trimmed. 10 11 * fast/css/variables/test-suite/011.html: Updated to expect a variable reference 12 with no fallback tokens to be valid. Change in the CSS specification since this 13 test was written. 14 * fast/css/variables/test-suite/013.html: Ditto. 15 * fast/css/variables/test-suite/041.html: Ditto. 16 * fast/css/variables/test-suite/043.html: Ditto. 17 18 * fast/css/variables/test-suite/061.html: Updated to expect a value with no tokens 19 to be valid. Change in the CSS specification since this test was written. 20 21 * fast/css/variables/test-suite/100.html: Updated to expect a variable reference 22 with no fallback tokens to be valid. Change in the CSS specification since this 23 test was written. 24 * fast/css/variables/test-suite/105.html: Ditto. 25 * fast/css/variables/test-suite/136.html: Ditto. 26 27 * fast/css/variables/test-suite/170.html: Updated to expect a value with no tokens 28 to be valid. Change in the CSS specification since this test was written. 29 * fast/css/variables/test-suite/171.html: Ditto. 30 31 * platform/mac/TestExpectations: Removed a line for a test that no longer exists 32 (not changed in this patch). 33 1 34 2021-06-28 Cameron McCormack <heycam@apple.com> 2 35 -
trunk/LayoutTests/css-custom-properties-api/inline.html
r269360 r279358 21 21 test(function() { 22 22 // Nothing registered yet, whatever you specify works 23 assert_equals(computedStyle.getPropertyValue('--a'), ' 10em');24 assert_equals(computedStyle.getPropertyValue('--b'), ' 10em');23 assert_equals(computedStyle.getPropertyValue('--a'), '10em'); 24 assert_equals(computedStyle.getPropertyValue('--b'), '10em'); 25 25 26 26 inlineStyle.setProperty('--a', 'hello'); … … 58 58 assert_equals(inlineStyle.getPropertyValue('--b'), ''); 59 59 assert_equals(computedStyle.getPropertyValue('--a'), '160px'); 60 assert_equals(computedStyle.getPropertyValue('--b'), ' 10em');60 assert_equals(computedStyle.getPropertyValue('--b'), '10em'); 61 61 }, "Values can be removed from inline styles"); 62 62 -
trunk/LayoutTests/fast/css/variables/test-suite/011.html
r191128 r279358 3 3 Any copyright is dedicated to the Public Domain. 4 4 http://creativecommons.org/publicdomain/zero/1.0/ 5 --><html><head><title>CSS Test: Test a failing non-custom property declaration in an @supports rule where the property value contains a syntactically invalid variable reference due to havingno fallback tokens.</title>5 --><html><head><title>CSS Test: Test a non-custom property declaration in an @supports rule where the property value contains a variable reference with no fallback tokens.</title> 6 6 <link href="mailto:cam@mcc.id.au" rel="author" title="Cameron McCormack"> 7 7 <link href="http://www.w3.org/TR/css-variables-1/#using-variables" rel="help"> … … 9 9 <style> 10 10 body { color: red; } 11 @supports (color: var(--a )) and (not (color: var(--a,))) {11 @supports (color: var(--a,)) { 12 12 p { color: green; } 13 13 } -
trunk/LayoutTests/fast/css/variables/test-suite/013.html
r191128 r279358 3 3 Any copyright is dedicated to the Public Domain. 4 4 http://creativecommons.org/publicdomain/zero/1.0/ 5 --><html><head><title>CSS Test: Test a failing non-custom property declaration in an @supports rule where the property value contains a syntactically invalid variable reference due to havingno fallback tokens, just a comment.</title>5 --><html><head><title>CSS Test: Test a non-custom property declaration in an @supports rule where the property value contains a variable reference with no fallback tokens, just a comment.</title> 6 6 <link href="mailto:cam@mcc.id.au" rel="author" title="Cameron McCormack"> 7 7 <link href="http://www.w3.org/TR/css-variables-1/#using-variables" rel="help"> … … 9 9 <style> 10 10 body { color: red; } 11 @supports (color: var(--a )) and (not (color: var(--a,/**/))) {11 @supports (color: var(--a,/**/)) { 12 12 p { color: green; } 13 13 } -
trunk/LayoutTests/fast/css/variables/test-suite/041.html
r191128 r279358 3 3 Any copyright is dedicated to the Public Domain. 4 4 http://creativecommons.org/publicdomain/zero/1.0/ 5 --><html><head><title>CSS Test: Test a failingcustom property declaration in an @supports rule whose value contains a variable reference with no fallback tokens.</title>5 --><html><head><title>CSS Test: Test a custom property declaration in an @supports rule whose value contains a variable reference with no fallback tokens.</title> 6 6 <link href="mailto:cam@mcc.id.au" rel="author" title="Cameron McCormack"> 7 7 <link href="http://www.w3.org/TR/css-variables-1/#syntax" rel="help"> … … 9 9 <style> 10 10 body { color: red; } 11 @supports (--a: a) and (not (--a: var(--b,))) {11 @supports (--a: var(--b,)) { 12 12 p { color: green; } 13 13 } -
trunk/LayoutTests/fast/css/variables/test-suite/043.html
r191128 r279358 3 3 Any copyright is dedicated to the Public Domain. 4 4 http://creativecommons.org/publicdomain/zero/1.0/ 5 --><html><head><title>CSS Test: Test a failingcustom property declaration in an @supports rule whose value contains a variable reference with no fallback tokens, just a comment.</title>5 --><html><head><title>CSS Test: Test a custom property declaration in an @supports rule whose value contains a variable reference with no fallback tokens, just a comment.</title> 6 6 <link href="mailto:cam@mcc.id.au" rel="author" title="Cameron McCormack"> 7 7 <link href="http://www.w3.org/TR/css-variables-1/#syntax" rel="help"> … … 9 9 <style> 10 10 body { color: red; } 11 @supports (--a: a) and (not (--a: var(--b,/**/))) {11 @supports (--a: var(--b,/**/)) { 12 12 p { color: green; } 13 13 } -
trunk/LayoutTests/fast/css/variables/test-suite/061.html
r191128 r279358 3 3 Any copyright is dedicated to the Public Domain. 4 4 http://creativecommons.org/publicdomain/zero/1.0/ 5 --><html><head><title>CSS Test: Test a failingcustom property declaration in an @supports rule whose value contains no tokens.</title>5 --><html><head><title>CSS Test: Test a custom property declaration in an @supports rule whose value contains no tokens.</title> 6 6 <link href="mailto:cam@mcc.id.au" rel="author" title="Cameron McCormack"> 7 7 <link href="http://www.w3.org/TR/css-variables-1/#syntax" rel="help"> … … 9 9 <style> 10 10 body { color: red; } 11 @supports (--a: a) and (not (--a:)) {11 @supports (--a:) { 12 12 p { color: green; } 13 13 } -
trunk/LayoutTests/fast/css/variables/test-suite/100.html
r191128 r279358 3 3 Any copyright is dedicated to the Public Domain. 4 4 http://creativecommons.org/publicdomain/zero/1.0/ 5 --><html><head><title>CSS Test: Test declaring a non-custom property with invalid syntax due to havinga variable reference whose fallback contains nothing but a comment.</title>5 --><html><head><title>CSS Test: Test declaring a non-custom property with a variable reference whose fallback contains nothing but a comment.</title> 6 6 <link href="mailto:cam@mcc.id.au" rel="author" title="Cameron McCormack"> 7 7 <link href="http://www.w3.org/TR/css-variables-1/#using-variables" rel="help"> … … 9 9 <style> 10 10 body { 11 --a: crimson;11 --a: green; 12 12 color: red; 13 13 } 14 14 p { 15 color: green;16 15 color: var(--a,/**/); 17 16 } -
trunk/LayoutTests/fast/css/variables/test-suite/105.html
r191128 r279358 3 3 Any copyright is dedicated to the Public Domain. 4 4 http://creativecommons.org/publicdomain/zero/1.0/ 5 --><html><head><title>CSS Test: Test declaring a non-custom property with invalid syntax due to havinga variable reference whose fallback contains no tokens.</title>5 --><html><head><title>CSS Test: Test declaring a non-custom property with a variable reference whose fallback contains no tokens.</title> 6 6 <link href="mailto:cam@mcc.id.au" rel="author" title="Cameron McCormack"> 7 7 <link href="http://www.w3.org/TR/css-variables-1/#using-variables" rel="help"> … … 9 9 <style> 10 10 body { 11 --a: crimson;11 --a: green; 12 12 color: red; 13 13 } 14 14 p { 15 color: green;16 15 color: var(--a,); 17 16 } -
trunk/LayoutTests/fast/css/variables/test-suite/136.html
r191128 r279358 3 3 Any copyright is dedicated to the Public Domain. 4 4 http://creativecommons.org/publicdomain/zero/1.0/ 5 --><html><head><title>CSS Test: Test declaring a variable with invalid syntax due toa variable reference having no tokens in its fallback.</title>5 --><html><head><title>CSS Test: Test declaring a variable with a variable reference having no tokens in its fallback.</title> 6 6 <link href="mailto:cam@mcc.id.au" rel="author" title="Cameron McCormack"> 7 7 <link href="http://www.w3.org/TR/css-variables-1/#syntax" rel="help"> … … 10 10 p { 11 11 color: red; 12 --a: green;13 --b: crimson;12 --a: red; 13 --b: green; 14 14 --a: var(--b,); 15 15 color: var(--a); -
trunk/LayoutTests/fast/css/variables/test-suite/170.html
r191128 r279358 3 3 Any copyright is dedicated to the Public Domain. 4 4 http://creativecommons.org/publicdomain/zero/1.0/ 5 --><html><head><title>CSS Test: Test declaring a variable with invalid syntax due to havingno tokens.</title>5 --><html><head><title>CSS Test: Test declaring a variable with no tokens.</title> 6 6 <link href="mailto:cam@mcc.id.au" rel="author" title="Cameron McCormack"> 7 7 <link href="http://www.w3.org/TR/css-variables-1/#syntax" rel="help"> … … 12 12 } 13 13 p { 14 color: orange;15 --a: green;16 14 --a:; 17 color: var(--a) ;15 color: var(--a) green; 18 16 } 19 17 </style> -
trunk/LayoutTests/fast/css/variables/test-suite/171.html
r191128 r279358 3 3 Any copyright is dedicated to the Public Domain. 4 4 http://creativecommons.org/publicdomain/zero/1.0/ 5 --><html><head><title>CSS Test: Test declaring a variable with invalid syntax due toa variable reference having only a comment in its fallback.</title>5 --><html><head><title>CSS Test: Test declaring a variable with a variable reference having only a comment in its fallback.</title> 6 6 <link href="mailto:cam@mcc.id.au" rel="author" title="Cameron McCormack"> 7 7 <link href="http://www.w3.org/TR/css-variables-1/#syntax" rel="help"> … … 10 10 p { 11 11 color: red; 12 --a: green;13 --b: crimson;12 --a: crimson; 13 --b: green; 14 14 --a: var(--b,/**/); 15 15 color: var(--a); -
trunk/LayoutTests/imported/w3c/ChangeLog
r279344 r279358 1 2021-06-28 Darin Adler <darin@apple.com> 2 3 CSS parser "consume declaration" algorithm does not handle whitespace correctly 4 https://bugs.webkit.org/show_bug.cgi?id=227368 5 6 Reviewed by Sam Weinig. 7 8 * web-platform-tests/css/css-properties-values-api/at-property-animation-expected.txt: 9 * web-platform-tests/css/css-properties-values-api/at-property-expected.txt: 10 * web-platform-tests/css/css-properties-values-api/at-property-shadow-expected.txt: 11 * web-platform-tests/css/css-properties-values-api/determine-registration-expected.txt: 12 * web-platform-tests/css/css-properties-values-api/registered-property-cssom-expected.txt: 13 * web-platform-tests/css/css-properties-values-api/var-reference-registered-properties-expected.txt: 14 Regenerated to reflect the whitespace trimming: one new pass, no new failures. Some of 15 these tests will also need updates to match the newer CSS specification. Not doing those 16 here right now. 17 18 * web-platform-tests/css/css-properties-values-api/at-property.html: 19 Pulled down a newer version of this test from the WPT repository with expectations in line 20 with newer CSS specification. 21 22 * web-platform-tests/css/css-syntax/declarations-trim-whitespace-expected.txt: 23 * web-platform-tests/css/css-variables/variable-cssText-expected.txt: 24 Expect most tests to pass instead of fail. There are still some failures. Given my reading 25 of the CSS specification I suspect it is the tests that are incorrect. 26 27 * web-platform-tests/css/css-variables/variable-definition-expected.txt: 28 * web-platform-tests/css/css-variables/variable-definition.html: 29 Pulled down a newer version of this test from the WPT repository with expectations in line 30 with newer CSS specification. Some tests are still failing because of expectations about 31 trailing whitespace. Given my reading of the CSS specification I suspect it is the tests 32 that are incorrect. 33 34 * web-platform-tests/css/css-variables/variable-reference-expected.txt: 35 * web-platform-tests/css/css-variables/variable-reference.html: 36 * web-platform-tests/css/css-variables/variable-substitution-variable-declaration-expected.txt: 37 * web-platform-tests/css/css-variables/variable-substitution-variable-declaration.html: 38 Pulled down a newer version of these tests from the WPT repository with expectations in 39 line with newer CSS specification. 40 41 * web-platform-tests/css/cssom/variable-names-expected.txt: Expect tests to pass, not fail. 42 1 43 2021-06-28 Chris Dumez <cdumez@apple.com> 2 44 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/at-property-animation-expected.txt
r264522 r279358 5 5 FAIL Ongoing animation matches new keyframes against the current registration assert_equals: expected "0px" but got "" 6 6 FAIL Ongoing animation picks up redeclared intial value assert_equals: expected "200px" but got "" 7 FAIL Ongoing animation picks up redeclared inherits flag assert_equals: expected "200px" but got " 100px"8 FAIL Ongoing animation picks up redeclared meaning of 'unset' assert_equals: expected "200px" but got " 100px"7 FAIL Ongoing animation picks up redeclared inherits flag assert_equals: expected "200px" but got "100px" 8 FAIL Ongoing animation picks up redeclared meaning of 'unset' assert_equals: expected "200px" but got "100px" 9 9 FAIL Transitioning from initial value assert_equals: expected "rgb(255, 0, 0)" but got "" 10 FAIL Transitioning from specified value assert_equals: expected "rgb(0, 0, 255)" but got " blue"10 FAIL Transitioning from specified value assert_equals: expected "rgb(0, 0, 255)" but got "blue" 11 11 FAIL Transition triggered by initial value change assert_equals: expected "100px" but got "" 12 12 FAIL No transition when changing types assert_equals: expected "100px" but got "" 13 FAIL No transition when removing @property rule assert_equals: expected " 100px" but got "100px"13 FAIL No transition when removing @property rule assert_equals: expected " 100px" but got "100px" 14 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/at-property-expected.txt
r267650 r279358 57 57 PASS Rule not applied [<color>, notacolor, false] 58 58 PASS Rule not applied [<length>, 10em, false] 59 FAIL Non-inherited properties do not inherit assert_equals: expected " 40px" but got "40px"60 FAIL Inherited properties inherit assert_equals: expected "40px" but got " 40px" 59 FAIL Non-inherited properties do not inherit assert_equals: expected "0px" but got "40px" 60 PASS Inherited properties inherit 61 61 FAIL Initial values substituted as computed value assert_equals: expected "rgb(0, 128, 0)" but got "" 62 62 PASS Non-universal registration are invalid without an initial value 63 FAIL Initial value may be omitted for universal registration assert_equals: expected "" but got " calc(1px + 1px)"63 FAIL Initial value may be omitted for universal registration assert_equals: expected "" but got "calc(1px + 1px)" 64 64 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/at-property-shadow-expected.txt
r264522 r279358 1 1 2 FAIL @property rules in shadow trees should have no effect assert_equals: expected "2px" but got " calc(1px + 1px)"2 FAIL @property rules in shadow trees should have no effect assert_equals: expected "2px" but got "calc(1px + 1px)" 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/at-property.html
r264522 r279358 201 201 try { 202 202 target.style = `${name}: calc(1px + 1px);`; 203 assert_equals(getComputedStyle(target).getPropertyValue(name), ' calc(1px + 1px)');203 assert_equals(getComputedStyle(target).getPropertyValue(name), 'calc(1px + 1px)'); 204 204 } finally { 205 205 target.style = ''; -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/determine-registration-expected.txt
r264522 r279358 6 6 FAIL CSS.registerProperty determines the registration when uncontested The given initial value does not parse for the given syntax. 7 7 FAIL @property registrations are cleared when rule removed assert_equals: expected "10px" but got "" 8 FAIL Computed value becomes token sequence when @property is removed assert_equals: expected " 2px" but got "calc(1px + 1px)"9 FAIL Inherited status is reflected in computed styles when @property is removed assert_equals: expected " 0px" but got "10px"8 FAIL Computed value becomes token sequence when @property is removed assert_equals: expected " calc(1px + 1px)" but got "calc(1px + 1px)" 9 FAIL Inherited status is reflected in computed styles when @property is removed assert_equals: expected " 10px" but got "10px" 10 10 FAIL Invalid @property rule (missing syntax) does not overwrite previous valid rule assert_equals: expected "1px" but got "" 11 11 FAIL Invalid @property rule (missing inherits descriptor) does not overwrite previous valid rule assert_equals: expected "1px" but got "" -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/registered-property-cssom-expected.txt
r267650 r279358 1 1 2 PASS CSSOM setters function as expected for unregistered properties 2 FAIL CSSOM setters function as expected for unregistered properties assert_equals: expected " 10px" but got "10px" 3 3 FAIL CSS.registerProperty The given initial value does not parse for the given syntax. 4 FAIL Formerly valid values are still readable from inline styles but are computed as the unset value assert_equals: expected " rgb(0, 0, 255)" but got "hello"5 FAIL Values not matching the registered type can still be set assert_equals: expected "hi" but got " 5"6 FAIL Values can be removed from inline styles assert_equals: expected "rgb(255, 0, 0)" but got " red"4 FAIL Formerly valid values are still readable from inline styles but are computed as the unset value assert_equals: expected "5" but got "" 5 FAIL Values not matching the registered type can still be set assert_equals: expected "hi" but got "" 6 FAIL Values can be removed from inline styles assert_equals: expected "rgb(255, 0, 0)" but got "red" 7 7 FAIL Stylesheets can be modified by CSSOM assert_equals: expected "0px" but got "10px" 8 8 FAIL Valid values can be set on inline styles assert_equals: expected "rgb(255, 192, 203)" but got "pink" -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-properties-values-api/var-reference-registered-properties-expected.txt
r267650 r279358 1 1 2 PASS var() references work with registered properties 2 FAIL var() references work with registered properties assert_equals: expected " 20px" but got "20px" 3 3 FAIL References to registered var()-properties work in registered lists assert_equals: expected "1px, 10px, 2px" but got "0px" 4 4 FAIL References to mixed registered and unregistered var()-properties work in registered lists assert_equals: expected "1px, 20px, 10px, 2px" but got "0px" -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-syntax/declarations-trim-whitespace-expected.txt
r267650 r279358 1 1 2 2 PASS --foo-1:bar; 3 FAIL --foo-2: bar; assert_equals: expected "bar" but got " bar" 4 FAIL --foo-3:bar ; assert_equals: expected "bar" but got "bar " 5 FAIL --foo-4: bar ; assert_equals: expected "bar" but got " bar " 6 FAIL --foo-5: bar !important; assert_equals: expected "bar" but got " bar " 7 FAIL --foo-6: bar !important ; assert_equals: expected "bar" but got " bar " 3 PASS --foo-2: bar; 4 PASS --foo-3:bar ; 5 PASS --foo-4: bar ; 6 PASS --foo-5: bar !important; 7 PASS --foo-6: bar !important ; 8 8 PASS --foo-7:bar!important; 9 9 PASS --foo-8:bar!important ; 10 FAIL --foo-9:bar (then ws until end of rule) assert_equals: expected "bar" but got "bar " 10 PASS --foo-9:bar (then ws until end of rule) 11 11 foo -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-cssText-expected.txt
r271706 r279358 1 1 2 FAIL target1 assert_equals: expected "--var: var1;" but got "--var: var1;" 2 PASS target1 3 3 PASS target2 4 4 PASS target3 5 PASS target4 6 PASS target5 5 FAIL target4 assert_equals: expected "margin: var(--prop) !important;" but got "margin: var(--prop) !important;" 6 FAIL target5 assert_equals: expected "background: var(--prop) !important;" but got "background: var(--prop) !important;" 7 7 FAIL target6 assert_equals: expected "background: green;" but got "background-color: green;" 8 8 PASS target7 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-definition-expected.txt
r271706 r279358 4 4 PASS single char variable 5 5 PASS single char '-' variable 6 FAIL no char variable assert_equals: Expected Value should match actual value expected "value" but got "" 6 PASS no char variable 7 7 PASS white space value (single space) 8 FAIL white space value (double space) assert_equals: Expected Value should match actual value expected " " but got " " 8 PASS white space value (double space) 9 9 PASS overwrite 10 10 PASS can't overwrite with no value … … 16 16 PASS leading white space (single space) 17 17 PASS middle white space (single space) 18 PASS trailing white space (single space) 19 FAIL leading white space (double space) 2 assert_equals: Expected Value should match actual value expected " value" but got " value" 18 FAIL trailing white space (single space) assert_equals: Expected Value should match actual value expected "value " but got "value" 19 PASS leading white space (double space) 2 20 20 FAIL middle white space (double space) 2 assert_equals: Expected Value should match actual value expected "value1 value2" but got "value1 value2" 21 FAIL trailing white space (double space) 2 assert_equals: Expected Value should match actual value expected "value " but got "value "22 PASS !important 21 FAIL trailing white space (double space) 2 assert_equals: Expected Value should match actual value expected "value " but got "value" 22 FAIL !important assert_equals: Expected Value should match actual value expected "value1 " but got "value1" 23 23 PASS !important 2 24 PASS !important (with space) 24 FAIL !important (with space) assert_equals: Expected Value should match actual value expected "value1 " but got "value1" 25 25 PASS no variable (Computed Style) 26 26 PASS variable (Computed Style) 27 27 PASS single char variable (Computed Style) 28 28 PASS single char '-' variable (Computed Style) 29 FAIL no char variable (Computed Style) assert_equals: Expected Value should match actual value expected "value" but got "" 29 PASS no char variable (Computed Style) 30 30 PASS white space value (single space) (Computed Style) 31 FAIL white space value (double space) (Computed Style) assert_equals: Expected Value should match actual value expected " " but got " " 31 PASS white space value (double space) (Computed Style) 32 32 PASS overwrite (Computed Style) 33 33 PASS can't overwrite with no value (Computed Style) … … 39 39 PASS leading white space (single space) (Computed Style) 40 40 PASS middle white space (single space) (Computed Style) 41 PASS trailing white space (single space) (Computed Style) 42 FAIL leading white space (double space) 2 (Computed Style) assert_equals: Expected Value should match actual value expected " value" but got " value" 41 FAIL trailing white space (single space) (Computed Style) assert_equals: Expected Value should match actual value expected "value " but got "value" 42 PASS leading white space (double space) 2 (Computed Style) 43 43 FAIL middle white space (double space) 2 (Computed Style) assert_equals: Expected Value should match actual value expected "value1 value2" but got "value1 value2" 44 FAIL trailing white space (double space) 2 (Computed Style) assert_equals: Expected Value should match actual value expected "value " but got "value "45 PASS !important (Computed Style) 44 FAIL trailing white space (double space) 2 (Computed Style) assert_equals: Expected Value should match actual value expected "value " but got "value" 45 FAIL !important (Computed Style) assert_equals: Expected Value should match actual value expected "value1 " but got "value1" 46 46 PASS !important 2 (Computed Style) 47 PASS !important (with space) (Computed Style) 47 FAIL !important (with space) (Computed Style) assert_equals: Expected Value should match actual value expected "value1 " but got "value1" 48 48 PASS no variable (Cascading) 49 49 PASS variable (Cascading) 50 50 PASS single char variable (Cascading) 51 51 PASS single char '-' variable (Cascading) 52 FAIL no char variable (Cascading) assert_equals: Expected Value should match actual value expected "value" but got "" 52 PASS no char variable (Cascading) 53 53 PASS white space value (single space) (Cascading) 54 FAIL white space value (double space) (Cascading) assert_equals: Expected Value should match actual value expected " " but got " " 54 PASS white space value (double space) (Cascading) 55 55 PASS overwrite (Cascading) 56 56 PASS can't overwrite with no value (Cascading) … … 62 62 PASS leading white space (single space) (Cascading) 63 63 PASS middle white space (single space) (Cascading) 64 PASS trailing white space (single space) (Cascading) 65 FAIL leading white space (double space) 2 (Cascading) assert_equals: Expected Value should match actual value expected " value" but got " value" 64 FAIL trailing white space (single space) (Cascading) assert_equals: Expected Value should match actual value expected "value " but got "value" 65 PASS leading white space (double space) 2 (Cascading) 66 66 FAIL middle white space (double space) 2 (Cascading) assert_equals: Expected Value should match actual value expected "value1 value2" but got "value1 value2" 67 FAIL trailing white space (double space) 2 (Cascading) assert_equals: Expected Value should match actual value expected "value " but got "value "68 PASS !important (Cascading) 67 FAIL trailing white space (double space) 2 (Cascading) assert_equals: Expected Value should match actual value expected "value " but got "value" 68 FAIL !important (Cascading) assert_equals: Expected Value should match actual value expected "value1 " but got "value1" 69 69 PASS !important 2 (Cascading) 70 PASS !important (with space) (Cascading) 70 FAIL !important (with space) (Cascading) assert_equals: Expected Value should match actual value expected "value1 " but got "value1" 71 71 PASS basic CSSOM.setProperty 72 72 FAIL CSSOM.setProperty with space 1 assert_equals: Expected Value should match actual value expected "" but got "green" -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-definition.html
r271706 r279358 23 23 { varName:"--v", expectedValue:"value", style:"--v:value", testName:"single char variable"}, 24 24 { varName:"---", expectedValue:"value", style:"---:value", testName:"single char '-' variable"}, 25 { varName:"--", expectedValue:" value",style:"--:value", testName:"no char variable"},26 { varName:"--var", expectedValue:" ", style:"--var: ", testName:"white space value (single space)"},27 { varName:"--var", expectedValue:" ", style:"--var: ", testName:"white space value (double space)"},25 { varName:"--", expectedValue:"", style:"--:value", testName:"no char variable"}, 26 { varName:"--var", expectedValue:"", style:"--var: ", testName:"white space value (single space)"}, 27 { varName:"--var", expectedValue:"", style:"--var: ", testName:"white space value (double space)"}, 28 28 { varName:"--var", expectedValue:"value2", style:"--var:value1; --var:value2", testName:"overwrite"}, 29 { varName:"--var", expectedValue:" value", style:"--var:value;--var:;", testName:"can't overwrite with no value"},30 { varName:"--var", expectedValue:" ", style:"--var:value;--var: ;", testName:"can overwrite with space value"},29 { varName:"--var", expectedValue:"", style:"--var:value;--var:;", testName:"can't overwrite with no value"}, 30 { varName:"--var", expectedValue:"", style:"--var:value;--var: ;", testName:"can overwrite with space value"}, 31 31 { varName:"--var", expectedValue:"value1", style:"--var:value1; --Var:value2", testName:"case sensetivity"}, 32 32 { varName:"--Var", expectedValue:"value2", style:"--var:value1; --Var:value2", testName:"case sensetivity2"}, 33 33 { varName:"---var", expectedValue:"value", style:"---var:value;", testName:"parsing three dashes at start of variable"}, 34 34 { varName:"-var4" , expectedValue:"", style:"-var4:value3", testName:"parsing multiple dashes with one dash at start of variable"}, 35 { varName:"--var", expectedValue:" value", style:"--var: value", testName:" leading white space (single space)"},35 { varName:"--var", expectedValue:"value", style:"--var: value", testName:" leading white space (single space)"}, 36 36 { varName:"--var", expectedValue:"value1 value2", style:"--var:value1 value2", testName:" middle white space (single space)"}, 37 37 { varName:"--var", expectedValue:"value ", style:"--var:value ", testName:" trailing white space (single space)"}, 38 { varName:"--var", expectedValue:" value", style:"--var: value", testName:" leading white space (double space) 2"},38 { varName:"--var", expectedValue:"value", style:"--var: value", testName:" leading white space (double space) 2"}, 39 39 { varName:"--var", expectedValue:"value1 value2", style:"--var:value1 value2",testName:" middle white space (double space) 2"}, 40 40 { varName:"--var", expectedValue:"value ", style:"--var:value ", testName:" trailing white space (double space) 2"}, -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-reference-expected.txt
r271706 r279358 8 8 PASS width: var(--prop1, var(--prop2, var(--prop3, auto))); 9 9 PASS width: var(--prop1) var(--prop2) 10 PASS width: var(--prop,); 10 11 PASS width: var(); 11 12 PASS width: var(prop); 12 13 PASS width: var(-prop); 13 PASS width: var(--prop,);14 14 PASS width: var(--prop 20px); 15 15 PASS width: var(--prop, var(prop)); -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-reference.html
r271706 r279358 35 35 { cssText: "width: var(--prop1, var(--prop2, var(--prop3, auto)));", expectedPropertyValue: "var(--prop1, var(--prop2, var(--prop3, auto)))" }, 36 36 { cssText: "width: var(--prop1) var(--prop2)", expectedPropertyValue: "var(--prop1) var(--prop2)" }, 37 { cssText: "width: var(--prop,);", expectedPropertyValue: "var(--prop,)" }, 37 38 38 39 { cssText: "width: var();", expectedPropertyValue: "" }, 39 40 { cssText: "width: var(prop);", expectedPropertyValue: "" }, 40 41 { cssText: "width: var(-prop);", expectedPropertyValue: "" }, 41 { cssText: "width: var(--prop,);", expectedPropertyValue: "" },42 42 { cssText: "width: var(--prop 20px);", expectedPropertyValue: "" }, 43 43 { cssText: "width: var(--prop, var(prop));", expectedPropertyValue: "" }, -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-substitution-variable-declaration-expected.txt
r271706 r279358 30 30 PASS target10 --varA 31 31 PASS target10 --varB 32 FAIL target10 --varC assert_equals: expected "" but got " another good one"32 FAIL target10 --varC assert_equals: expected "" but got "another good one" 33 33 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-variables/variable-substitution-variable-declaration.html
r271706 r279358 102 102 103 103 var testcases = [ 104 { element: "target1", propertyName: "--var2", expectedPropertyValue: " 23px 13px 17px 10px" },104 { element: "target1", propertyName: "--var2", expectedPropertyValue: "23px 13px 17px 10px" }, 105 105 { element: "target1", propertyName: "margin-top", expectedPropertyValue: "23px" }, 106 106 { element: "target1", propertyName: "margin-right", expectedPropertyValue: "13px" }, … … 110 110 { element: "target2parent", propertyName: "--var1", expectedPropertyValue: "" }, 111 111 { element: "target2parent", propertyName: "--var2", expectedPropertyValue: "" }, 112 { element: "target2", propertyName: "--var1", expectedPropertyValue: " good" },112 { element: "target2", propertyName: "--var1", expectedPropertyValue: "good" }, 113 113 { element: "target2", propertyName: "--var2", expectedPropertyValue: "" }, 114 114 115 { element: "target3", propertyName: "--var1", expectedPropertyValue: " 5px" },116 { element: "target3", propertyName: "--var2", expectedPropertyValue: " 5px" },115 { element: "target3", propertyName: "--var1", expectedPropertyValue: "5px" }, 116 { element: "target3", propertyName: "--var2", expectedPropertyValue: "5px" }, 117 117 118 118 { element: "target4", propertyName: "--varA", expectedPropertyValue: "" }, 119 119 { element: "target4", propertyName: "--varB", expectedPropertyValue: "" }, 120 { element: "target4", propertyName: "--varC", expectedPropertyValue: " 13px" },120 { element: "target4", propertyName: "--varC", expectedPropertyValue: "13px" }, 121 121 122 122 { element: "target5", propertyName: "--varA", expectedPropertyValue: "" }, … … 133 133 134 134 { element: "target8", propertyName: "--varA", expectedPropertyValue: "" }, 135 { element: "target8", propertyName: "--varB", expectedPropertyValue: " 7px" },135 { element: "target8", propertyName: "--varB", expectedPropertyValue: "7px" }, 136 136 137 { element: "target9", propertyName: "--varA", expectedPropertyValue: " good" },137 { element: "target9", propertyName: "--varA", expectedPropertyValue: "good" }, 138 138 { element: "target9", propertyName: "--varB", expectedPropertyValue: "" }, 139 139 { element: "target9", propertyName: "--varC", expectedPropertyValue: "" }, -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/variable-names-expected.txt
r232005 r279358 1 1 2 FAIL custom property '--a' assert_equals: property value returned correctly from specified style getPropertyValue (after serialization/re-parsing) expected "value" but got " value" 2 PASS custom property '--a' 3 3 FAIL custom property '--a;b' assert_equals: appears on specified style (after serialization/re-parsing) expected 1 but got 0 4 FAIL custom property '---' assert_equals: property value returned correctly from specified style getPropertyValue (after serialization/re-parsing) expected "value" but got " value" 4 PASS custom property '---' 5 5 FAIL custom property '--\' assert_equals: appears on specified style (after serialization/re-parsing) expected 1 but got 0 6 FAIL custom property '--ab' assert_equals: property value returned correctly from specified style getPropertyValue (after serialization/re-parsing) expected "value" but got " value" 7 FAIL custom property '--0' assert_equals: property value returned correctly from specified style getPropertyValue (after serialization/re-parsing) expected "value" but got " value" 6 PASS custom property '--ab' 7 PASS custom property '--0' 8 8 -
trunk/LayoutTests/platform/mac/TestExpectations
r279356 r279358 1525 1525 webaudio/oscillator-sine.html [ Skip ] 1526 1526 1527 webkit.org/b/199013 [ Debug ] imported/w3c/web-platform-tests/websockets/Create-Secure-verify-url-set-non-default-port.any.html [ Pass Failure ]1528 1529 1527 webkit.org/b/190882 animations/change-one-anim.html [ Pass Failure ] 1530 1528 -
trunk/Source/WebCore/ChangeLog
r279355 r279358 1 2021-06-28 Darin Adler <darin@apple.com> 2 3 CSS parser "consume declaration" algorithm does not handle whitespace correctly 4 https://bugs.webkit.org/show_bug.cgi?id=227368 5 6 Reviewed by Sam Weinig. 7 8 Test: imported/w3c/web-platform-tests/css/css-syntax/declarations-trim-whitespace.html 9 10 To avoid creating regressions in CSS variable behavior, had to make 11 changes there to handle whitespace correctly at the same time as the 12 change to the "consume declaration" algorithm. 13 14 * css/CSSComputedStyleDeclaration.cpp: 15 (WebCore::ComputedStyleExtractor::customPropertyValue): Restructured 16 to not have a case for each variant custom value type. This lets us 17 support the new Empty value type without extra code here. 18 19 * css/CSSCustomPropertyValue.cpp: 20 (WebCore::CSSCustomPropertyValue::createEmpty): Added. Used for a new 21 Empty value type for properties that have empty string as their value, 22 which is a new capability added to the CSS specification. 23 (WebCore::CSSCustomPropertyValue::equals const): Removed unneeded pointer 24 comparison optimization. Added support for Empty value. 25 (WebCore::CSSCustomPropertyValue::customCSSText const): Updated to use 26 null string for m_stringValue instead of a separate m_serialized flag. 27 Added support for Empty value. 28 (WebCore::CSSCustomPropertyValue::tokens const): Added support for 29 Empty value. Also call directly to customCSSText instead of calling 30 through cssText. 31 32 * css/CSSCustomPropertyValue.h: Updated for the above, adding Empty value. 33 Removed m_serialized. Greatly simplified the copy constructor since Ref 34 now has a copy constructor. 35 36 * css/CSSVariableReferenceValue.cpp: 37 (WebCore::resolveVariableFallback): Consume whitespace after the comma, 38 matching what is now called for in the CSS specification. 39 40 * css/calc/CSSCalcExpressionNodeParser.cpp: 41 (WebCore::CSSCalcExpressionNodeParser::parseCalcFunction): Use 42 consumeCommaIncludingWhitespace to simplify the code. No behavior change, 43 just refactoring. 44 45 * css/parser/CSSParserImpl.cpp: 46 (WebCore::CSSParserImpl::consumeDeclaration): Updated algorithm to match 47 the CSS specification, trimming whitespace correctly. 48 (WebCore::CSSParserImpl::consumeCustomPropertyValue): Added support for 49 a custom property value with no declaration value, as now called for in 50 the CSS specification, using CSSCustomPropertyValue::createEmpty. 51 52 * css/parser/CSSVariableParser.cpp: 53 (WebCore::isValidVariableReference): Allow empty fallback, as now called 54 for in the CSS specification. 55 (WebCore::isValidConstantReference): Ditto. 56 1 57 2021-06-28 Dana Estra <destra@apple.com> 2 58 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r279218 r279358 2464 2464 return nullptr; 2465 2465 2466 auto* registered = styledElement->document().getCSSRegisteredCustomPropertySet().get(propertyName);2467 2466 auto* value = style->getCustomProperty(propertyName); 2468 2469 if (registered && !value) 2470 return registered->initialValueCopy(); 2471 2472 if (!value) 2473 return nullptr; 2474 2475 return WTF::switchOn(value->value(), [&](const Ref<CSSVariableReferenceValue>&) { 2476 ASSERT_NOT_REACHED(); 2477 return RefPtr<CSSValue>(); 2478 }, [&](const CSSValueID&) { 2479 return CSSCustomPropertyValue::create(*value); 2480 }, [&](const Ref<CSSVariableData>&) { 2481 return CSSCustomPropertyValue::create(*value); 2482 }, [&](const Length& value) { 2467 if (!value) { 2468 auto registered = styledElement->document().getCSSRegisteredCustomPropertySet().get(propertyName); 2469 return registered ? registered->initialValueCopy() : nullptr; 2470 } 2471 2472 return WTF::switchOn(value->value(), [&](const Length& value) -> Ref<CSSValue> { 2483 2473 return zoomAdjustedPixelValueForLength(value, *style); 2484 }, [&]( const Ref<StyleImage>&){2474 }, [&](auto&) -> Ref<CSSValue> { 2485 2475 return CSSCustomPropertyValue::create(*value); 2486 2476 }); -
trunk/Source/WebCore/css/CSSCustomPropertyValue.cpp
r266717 r279358 1 1 /* 2 * Copyright (C) 2016 Apple Inc.All rights reserved.2 * Copyright (C) 2016-2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #include "config.h" 27 27 #include "CSSCustomPropertyValue.h" 28 28 29 #include "CSSTokenizer.h" 29 30 30 31 namespace WebCore { 31 32 33 Ref<CSSCustomPropertyValue> CSSCustomPropertyValue::createEmpty(const AtomString& name) 34 { 35 return adoptRef(*new CSSCustomPropertyValue(name, Monostate { })); 36 } 37 32 38 bool CSSCustomPropertyValue::equals(const CSSCustomPropertyValue& other) const 33 39 { 34 if (this == &other)35 return true;36 40 if (m_name != other.m_name || m_value.index() != other.m_value.index()) 37 41 return false; 38 return WTF::switchOn(m_value, [&](const Ref<CSSVariableReferenceValue>& value) { 42 return WTF::switchOn(m_value, [&](const Monostate&) { 43 return true; 44 }, [&](const Ref<CSSVariableReferenceValue>& value) { 39 45 return value.get() == WTF::get<Ref<CSSVariableReferenceValue>>(other.m_value).get(); 40 46 }, [&](const CSSValueID& value) { … … 51 57 String CSSCustomPropertyValue::customCSSText() const 52 58 { 53 if ( !m_serialized) {54 m_serialized = true;55 56 WTF::switchOn(m_value, [&](const Ref<CSSVariableReferenceValue>& value) {59 if (m_stringValue.isNull()) { 60 WTF::switchOn(m_value, [&](const Monostate&) { 61 m_stringValue = emptyString(); 62 }, [&](const Ref<CSSVariableReferenceValue>& value) { 57 63 m_stringValue = value->cssText(); 58 64 }, [&](const CSSValueID& value) { … … 72 78 { 73 79 Vector<CSSParserToken> result; 74 75 WTF::switchOn(m_value, [&](const Ref<CSSVariableReferenceValue>&) { 80 WTF::switchOn(m_value, [&](const Monostate&) { 81 // Do nothing. 82 }, [&](const Ref<CSSVariableReferenceValue>&) { 76 83 ASSERT_NOT_REACHED(); 77 84 }, [&](const CSSValueID&) { 78 // Do nothing 85 // Do nothing. 79 86 }, [&](const Ref<CSSVariableData>& value) { 80 87 result.appendVector(value->tokens()); 81 }, [&](const Length&) { 82 CSSTokenizer tokenizer(cssText()); 83 84 auto tokenizerRange = tokenizer.tokenRange(); 85 while (!tokenizerRange.atEnd()) 86 result.append(tokenizerRange.consume()); 87 }, [&](const Ref<StyleImage>&) { 88 CSSTokenizer tokenizer(cssText()); 89 88 }, [&](auto&) { 89 CSSTokenizer tokenizer(customCSSText()); 90 90 auto tokenizerRange = tokenizer.tokenRange(); 91 91 while (!tokenizerRange.atEnd()) 92 92 result.append(tokenizerRange.consume()); 93 93 }); 94 95 94 return result; 96 95 } -
trunk/Source/WebCore/css/CSSCustomPropertyValue.h
r259988 r279358 1 1 /* 2 * Copyright (C) 2015 Apple Inc. All rights reserved.2 * Copyright (C) 2015-2021 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 36 36 37 37 class CSSParserToken; 38 class RenderStyle;39 38 40 39 class CSSCustomPropertyValue final : public CSSValue { 41 40 public: 42 using VariantValue = Variant<Ref<CSSVariableReferenceValue>, CSSValueID, Ref<CSSVariableData>, Length, Ref<StyleImage>>; 41 using VariantValue = Variant<Monostate, Ref<CSSVariableReferenceValue>, CSSValueID, Ref<CSSVariableData>, Length, Ref<StyleImage>>; 42 43 static Ref<CSSCustomPropertyValue> createEmpty(const AtomString& name); 43 44 44 45 static Ref<CSSCustomPropertyValue> createUnresolved(const AtomString& name, Ref<CSSVariableReferenceValue>&& value) … … 79 80 return adoptRef(*new CSSCustomPropertyValue(other)); 80 81 } 81 82 82 83 String customCSSText() const; 83 84 … … 90 91 91 92 Vector<CSSParserToken> tokens() const; 92 bool equals(const CSSCustomPropertyValue& other) const;93 bool equals(const CSSCustomPropertyValue&) const; 93 94 94 95 private: … … 97 98 , m_name(name) 98 99 , m_value(WTFMove(value)) 99 , m_serialized(false)100 100 { 101 101 } … … 104 104 : CSSValue(CustomPropertyClass) 105 105 , m_name(other.m_name) 106 , m_value( CSSValueUnset)106 , m_value(other.m_value) 107 107 , m_stringValue(other.m_stringValue) 108 , m_serialized(other.m_serialized)109 108 { 110 // No copy constructor for Ref<>, so we have to do this ourselves111 auto visitor = WTF::makeVisitor([&](const Ref<CSSVariableReferenceValue>& value) {112 m_value = value.copyRef();113 }, [&](const CSSValueID& value) {114 m_value = value;115 }, [&](const Ref<CSSVariableData>& value) {116 m_value = value.copyRef();117 }, [&](const Length& value) {118 m_value = value;119 }, [&](const Ref<StyleImage>& value) {120 m_value = value.copyRef();121 });122 WTF::visit(visitor, other.m_value);123 109 } 124 110 125 111 const AtomString m_name; 126 VariantValue m_value; 127 112 const VariantValue m_value; 128 113 mutable String m_stringValue; 129 mutable bool m_serialized { false }; // FIXME: Should use null m_stringValue instead of a separate boolean.130 114 }; 131 115 -
trunk/Source/WebCore/css/CSSVariableReferenceValue.cpp
r266989 r279358 69 69 return false; 70 70 ASSERT(range.peek().type() == CommaToken); 71 range.consume ();71 range.consumeIncludingWhitespace(); 72 72 return resolveTokenRange(range, result, builderState); 73 73 } -
trunk/Source/WebCore/css/calc/CSSCalcExpressionNodeParser.cpp
r278891 r279358 36 36 #include "CSSParserToken.h" 37 37 #include "CSSParserTokenRange.h" 38 #include "CSSPropertyParserHelpers.h" 38 39 #include "Logging.h" 39 40 #include <wtf/text/TextStream.h> … … 138 139 while (!tokens.atEnd()) { 139 140 tokens.consumeWhitespace(); 140 if (requireComma) { 141 if (tokens.consume().type() != CommaToken) 142 return false; 143 tokens.consumeWhitespace(); 144 } 141 if (requireComma && !CSSPropertyParserHelpers::consumeCommaIncludingWhitespace(tokens)) 142 return false; 145 143 146 144 RefPtr<CSSCalcExpressionNode> node; -
trunk/Source/WebCore/css/parser/CSSParserImpl.cpp
r278933 r279358 801 801 } 802 802 803 static void removeTrailingWhitespace(const CSSParserTokenRange& range, const CSSParserToken*& position) 804 { 805 while (position != range.begin() && position[-1].type() == WhitespaceToken) 806 --position; 807 } 808 809 // https://drafts.csswg.org/css-syntax/#consume-declaration 803 810 void CSSParserImpl::consumeDeclaration(CSSParserTokenRange range, StyleRuleType ruleType) 804 811 { … … 806 813 807 814 ASSERT(range.peek().type() == IdentToken); 808 const CSSParserToken& token = range.consumeIncludingWhitespace();809 CSSPropertyIDpropertyID = token.parseAsCSSPropertyID();815 auto& token = range.consumeIncludingWhitespace(); 816 auto propertyID = token.parseAsCSSPropertyID(); 810 817 if (range.consume().type() != ColonToken) 811 818 return; // Parse error 819 range.consumeWhitespace(); 820 821 auto declarationValueEnd = range.end(); 822 bool important = false; 823 if (!range.atEnd()) { 824 auto end = range.end(); 825 removeTrailingWhitespace(range, end); 826 declarationValueEnd = end; 827 if (end[-1].type() == IdentToken && equalIgnoringASCIICase(end[-1].value(), "important")) { 828 --end; 829 removeTrailingWhitespace(range, end); 830 if (end[-1].type() == DelimiterToken && end[-1].delimiter() == '!') { 831 important = true; 832 --end; 833 removeTrailingWhitespace(range, end); 834 declarationValueEnd = end; 835 } 836 } 837 } 838 839 size_t propertiesCount = m_parsedProperties.size(); 812 840 813 841 if (m_context.isPropertyRuntimeDisabled(propertyID) || isInternalCSSProperty(propertyID)) 814 842 propertyID = CSSPropertyInvalid; 815 843 816 bool important = false;817 const CSSParserToken* declarationValueEnd = range.end();818 const CSSParserToken* last = range.end() - 1;819 while (last->type() == WhitespaceToken)820 --last;821 if (last->type() == IdentToken && equalIgnoringASCIICase(last->value(), "important")) {822 --last;823 while (last->type() == WhitespaceToken)824 --last;825 if (last->type() == DelimiterToken && last->delimiter() == '!') {826 important = true;827 declarationValueEnd = last;828 }829 }830 831 size_t propertiesCount = m_parsedProperties.size();832 844 if (propertyID == CSSPropertyInvalid && CSSVariableParser::isValidVariableName(token)) { 833 845 AtomString variableName = token.value().toAtomString(); … … 850 862 void CSSParserImpl::consumeCustomPropertyValue(CSSParserTokenRange range, const AtomString& variableName, bool important) 851 863 { 852 if (RefPtr<CSSCustomPropertyValue> value = CSSVariableParser::parseDeclarationValue(variableName, range, m_context)) 864 if (range.atEnd()) 865 m_parsedProperties.append(CSSProperty(CSSPropertyCustom, CSSCustomPropertyValue::createEmpty(variableName), important)); 866 else if (auto value = CSSVariableParser::parseDeclarationValue(variableName, range, m_context)) 853 867 m_parsedProperties.append(CSSProperty(CSSPropertyCustom, WTFMove(value), important)); 854 868 } -
trunk/Source/WebCore/css/parser/CSSVariableParser.cpp
r246490 r279358 34 34 #include "CSSParserContext.h" 35 35 #include "CSSParserTokenRange.h" 36 #include "CSSPropertyParserHelpers.h" 36 37 37 38 namespace WebCore { … … 56 57 } 57 58 58 bool isValidVariableReference(CSSParserTokenRange, bool& hasAtApplyRule, const CSSParserContext&);59 bool isValidConstantReference(CSSParserTokenRange, bool& hasAtApplyRule, const CSSParserContext&);59 static bool isValidVariableReference(CSSParserTokenRange, bool& hasAtApplyRule, const CSSParserContext&); 60 static bool isValidConstantReference(CSSParserTokenRange, bool& hasAtApplyRule, const CSSParserContext&); 60 61 61 62 static bool classifyBlock(CSSParserTokenRange range, bool& hasReferences, bool& hasAtApplyRule, const CSSParserContext& parserContext, bool isTopLevelBlock = true) … … 127 128 return true; 128 129 129 if ( range.consume().type() != CommaToken)130 if (!CSSPropertyParserHelpers::consumeCommaIncludingWhitespace(range)) 130 131 return false; 131 132 if (range.atEnd()) 132 return false;133 return true; 133 134 134 135 bool hasReferences = false; … … 144 145 return true; 145 146 146 if ( range.consume().type() != CommaToken)147 if (!CSSPropertyParserHelpers::consumeCommaIncludingWhitespace(range)) 147 148 return false; 148 149 if (range.atEnd()) 149 return false;150 return true; 150 151 151 152 bool hasReferences = false;
Note: See TracChangeset
for help on using the changeset viewer.