Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,3 +1,36 @@
+2021-08-30 Johnson Zhou <[email protected]>
+
+ Rebaseline for CSS Typed OM, CSSUnparsedValue partially implemented.
+ https://bugs.webkit.org/show_bug.cgi?id=229069
+
+ Reviewed by Alex Christensen.
+
+ * web-platform-tests/css/css-typed-om/idlharness-expected.txt:
+ * web-platform-tests/css/css-typed-om/set-var-reference-thcrash-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-normalization/normalize-ident.tentative-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-normalization/normalize-image-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-normalization/normalize-numeric.tentative-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-normalization/normalize-tokens.tentative-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-objects/parse-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-objects/parse-invalid-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-objects/parseAll-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-objects/parseAll-invalid-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-serialization/cssKeywordValue.tentative-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-serialization/cssPositionValue-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-serialization/cssStyleValue-cssom-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-serialization/cssStyleValue-string-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-serialization/cssUnitValue.tentative-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-serialization/cssUnparsedValue-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-indexed-getter-setter-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-iterable-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-length-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-invalid-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-variable-expected.txt:
+ * web-platform-tests/css/css-typed-om/stylevalue-subclasses/numeric-objects/parse.tentative-expected.txt:
+ * web-platform-tests/css/css-typed-om/the-stylepropertymap/inline/get-expected.txt:
+
2021-08-30 Chris Dumez <[email protected]>
Resync COOP / COEP WPT tests from upstream
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/idlharness-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/idlharness-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/idlharness-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -34,8 +34,8 @@
PASS CSSStyleValue interface: existence and properties of interface prototype object's "constructor" property
PASS CSSStyleValue interface: existence and properties of interface prototype object's @@unscopables property
PASS CSSStyleValue interface: stringifier
-FAIL CSSStyleValue interface: operation parse(USVString, USVString) assert_own_property: interface object missing static operation expected property "parse" missing
-FAIL CSSStyleValue interface: operation parseAll(USVString, USVString) assert_own_property: interface object missing static operation expected property "parseAll" missing
+PASS CSSStyleValue interface: operation parse(USVString, USVString)
+PASS CSSStyleValue interface: operation parseAll(USVString, USVString)
PASS StylePropertyMapReadOnly interface: existence and properties of interface object
PASS StylePropertyMapReadOnly interface object length
PASS StylePropertyMapReadOnly interface object name
@@ -79,16 +79,16 @@
PASS CSSUnparsedValue interface: existence and properties of interface prototype object
PASS CSSUnparsedValue interface: existence and properties of interface prototype object's "constructor" property
PASS CSSUnparsedValue interface: existence and properties of interface prototype object's @@unscopables property
-FAIL CSSUnparsedValue interface: iterable<CSSUnparsedSegment> undefined is not an object (evaluating 'iteratorDesc.writable')
-FAIL CSSUnparsedValue interface: attribute length assert_true: The prototype object must have a property "length" expected true got false
-FAIL CSSVariableReferenceValue interface: existence and properties of interface object assert_own_property: self does not have own property "CSSVariableReferenceValue" expected property "CSSVariableReferenceValue" missing
-FAIL CSSVariableReferenceValue interface object length assert_own_property: self does not have own property "CSSVariableReferenceValue" expected property "CSSVariableReferenceValue" missing
-FAIL CSSVariableReferenceValue interface object name assert_own_property: self does not have own property "CSSVariableReferenceValue" expected property "CSSVariableReferenceValue" missing
-FAIL CSSVariableReferenceValue interface: existence and properties of interface prototype object assert_own_property: self does not have own property "CSSVariableReferenceValue" expected property "CSSVariableReferenceValue" missing
-FAIL CSSVariableReferenceValue interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "CSSVariableReferenceValue" expected property "CSSVariableReferenceValue" missing
-FAIL CSSVariableReferenceValue interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "CSSVariableReferenceValue" expected property "CSSVariableReferenceValue" missing
-FAIL CSSVariableReferenceValue interface: attribute variable assert_own_property: self does not have own property "CSSVariableReferenceValue" expected property "CSSVariableReferenceValue" missing
-FAIL CSSVariableReferenceValue interface: attribute fallback assert_own_property: self does not have own property "CSSVariableReferenceValue" expected property "CSSVariableReferenceValue" missing
+PASS CSSUnparsedValue interface: iterable<CSSUnparsedSegment>
+PASS CSSUnparsedValue interface: attribute length
+PASS CSSVariableReferenceValue interface: existence and properties of interface object
+PASS CSSVariableReferenceValue interface object length
+PASS CSSVariableReferenceValue interface object name
+PASS CSSVariableReferenceValue interface: existence and properties of interface prototype object
+PASS CSSVariableReferenceValue interface: existence and properties of interface prototype object's "constructor" property
+PASS CSSVariableReferenceValue interface: existence and properties of interface prototype object's @@unscopables property
+PASS CSSVariableReferenceValue interface: attribute variable
+PASS CSSVariableReferenceValue interface: attribute fallback
FAIL CSSKeywordValue interface: existence and properties of interface object assert_own_property: self does not have own property "CSSKeywordValue" expected property "CSSKeywordValue" missing
FAIL CSSKeywordValue interface object length assert_own_property: self does not have own property "CSSKeywordValue" expected property "CSSKeywordValue" missing
FAIL CSSKeywordValue interface object name assert_own_property: self does not have own property "CSSKeywordValue" expected property "CSSKeywordValue" missing
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/set-var-reference-thcrash-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/set-var-reference-thcrash-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/set-var-reference-thcrash-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,3 +1,3 @@
-FAIL Do not crash when referencing a variable with CSSVariableReferenceValue Can't find variable: CSSVariableReferenceValue
+FAIL Do not crash when referencing a variable with CSSVariableReferenceValue target.attributeStyleMap.set is not a function. (In 'target.attributeStyleMap.set('color', unparsed)', 'target.attributeStyleMap.set' is undefined)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-normalization/normalize-ident.tentative-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-normalization/normalize-ident.tentative-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-normalization/normalize-ident.tentative-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,4 +1,4 @@
-FAIL CSS identifiers are normalized from String to CSSKeywordValues CSSStyleValue.parse is not a function. (In 'CSSStyleValue.parse('width', 'auto')', 'CSSStyleValue.parse' is undefined)
+FAIL CSS identifiers are normalized from String to CSSKeywordValues auto cannot be parsed as a width
FAIL CSS identifiers are normalized from CSSOM to CSSKeywordValues Can't find variable: CSSKeywordValue
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-normalization/normalize-image-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-normalization/normalize-image-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-normalization/normalize-image-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,5 +1,5 @@
-FAIL Normalizing a valid <url> returns a CSSImageValue CSSStyleValue.parse is not a function. (In 'CSSStyleValue.parse('background-image', 'url("' + gTestUrl + '")')', 'CSSStyleValue.parse' is undefined)
-FAIL Normalizing a bad <url> returns a CSSImageValue CSSStyleValue.parse is not a function. (In 'CSSStyleValue.parse('background-image', 'url("' + gBadTestUrl + '")')', 'CSSStyleValue.parse' is undefined)
-FAIL Normalizing a <gradient> returns a CSSImageValue CSSStyleValue.parse is not a function. (In 'CSSStyleValue.parse('background-image', 'linear-gradient(red, orange)')', 'CSSStyleValue.parse' is undefined)
+FAIL Normalizing a valid <url> returns a CSSImageValue url("/media/1x1-green.png") cannot be parsed as a background-image
+FAIL Normalizing a bad <url> returns a CSSImageValue url("http://localhost:8800/css/css-typed-om/stylevalue-normalization/normalize-image.html") cannot be parsed as a background-image
+FAIL Normalizing a <gradient> returns a CSSImageValue linear-gradient(red, orange) cannot be parsed as a background-image
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-normalization/normalize-numeric.tentative-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-normalization/normalize-numeric.tentative-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-normalization/normalize-numeric.tentative-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -4,5 +4,5 @@
FAIL Normalizing a <dimension> returns a CSSUnitValue with the correct unit CSS.px is not a function. (In 'CSS.px(3.14)', 'CSS.px' is undefined)
FAIL Normalizing a <number> with a unitless zero returns 0 CSS.number is not a function. (In 'CSS.number(0)', 'CSS.number' is undefined)
FAIL Normalizing a <calc> returns simplified _expression_ Can't find variable: CSSMathSum
-FAIL Normalizing a <dimension> with a unitless zero returns 0px CSSStyleValue.parse is not a function. (In 'CSSStyleValue.parse('width', '0px')', 'CSSStyleValue.parse' is undefined)
+FAIL Normalizing a <dimension> with a unitless zero returns 0px 0px cannot be parsed as a width
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-normalization/normalize-tokens.tentative-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-normalization/normalize-tokens.tentative-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-normalization/normalize-tokens.tentative-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,5 +1,18 @@
-CONSOLE MESSAGE: ReferenceError: Can't find variable: CSSVariableReferenceValue
-Harness Error (FAIL), message = ReferenceError: Can't find variable: CSSVariableReferenceValue
+FAIL Normalizing "var(--A)" on a CSS property returns correct CSSUnparsedValue var(--A) cannot be parsed as a color
+FAIL Normalizing "var(--A)" on a shorthand returns correct CSSUnparsedValue var(--A) cannot be parsed as a margin
+FAIL Normalizing "var(--A)" on a list-valued property returns correct CSSUnparsedValue var(--A) cannot be parsed as a transition-duration
+FAIL Normalizing "var(--A)" on a custom property returns correct CSSUnparsedValue Property String is not a valid CSS property.
+FAIL Normalizing "var(--A, 1em)" on a CSS property returns correct CSSUnparsedValue var(--A, 1em) cannot be parsed as a color
+FAIL Normalizing "var(--A, 1em)" on a shorthand returns correct CSSUnparsedValue var(--A, 1em) cannot be parsed as a margin
+FAIL Normalizing "var(--A, 1em)" on a list-valued property returns correct CSSUnparsedValue var(--A, 1em) cannot be parsed as a transition-duration
+FAIL Normalizing "var(--A, 1em)" on a custom property returns correct CSSUnparsedValue Property String is not a valid CSS property.
+FAIL Normalizing "var(--A, var(--B))" on a CSS property returns correct CSSUnparsedValue var(--A, var(--B)) cannot be parsed as a color
+FAIL Normalizing "var(--A, var(--B))" on a shorthand returns correct CSSUnparsedValue var(--A, var(--B)) cannot be parsed as a margin
+FAIL Normalizing "var(--A, var(--B))" on a list-valued property returns correct CSSUnparsedValue var(--A, var(--B)) cannot be parsed as a transition-duration
+FAIL Normalizing "var(--A, var(--B))" on a custom property returns correct CSSUnparsedValue Property String is not a valid CSS property.
+FAIL Normalizing "calc(42px + var(--foo, 15em) + var(--bar, var(--far) + 15px))" on a CSS property returns correct CSSUnparsedValue calc(42px + var(--foo, 15em) + var(--bar, var(--far) + 15px)) cannot be parsed as a color
+FAIL Normalizing "calc(42px + var(--foo, 15em) + var(--bar, var(--far) + 15px))" on a shorthand returns correct CSSUnparsedValue calc(42px + var(--foo, 15em) + var(--bar, var(--far) + 15px)) cannot be parsed as a margin
+FAIL Normalizing "calc(42px + var(--foo, 15em) + var(--bar, var(--far) + 15px))" on a list-valued property returns correct CSSUnparsedValue calc(42px + var(--foo, 15em) + var(--bar, var(--far) + 15px)) cannot be parsed as a transition-duration
+FAIL Normalizing "calc(42px + var(--foo, 15em) + var(--bar, var(--far) + 15px))" on a custom property returns correct CSSUnparsedValue Property String is not a valid CSS property.
-
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-objects/parse-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-objects/parse-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-objects/parse-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,7 +1,7 @@
-FAIL CSSStyleValue.parse() with a valid property returns a CSSStyleValue CSSStyleValue.parse is not a function. (In 'CSSStyleValue.parse('width', '10px')', 'CSSStyleValue.parse' is undefined)
-FAIL CSSStyleValue.parse() is not case sensitive CSSStyleValue.parse is not a function. (In 'CSSStyleValue.parse('WiDtH', '10px')', 'CSSStyleValue.parse' is undefined)
-FAIL CSSStyleValue.parse() with a valid list-valued property returns a CSSStyleValue CSSStyleValue.parse is not a function. (In 'CSSStyleValue.parse('transition-duration', '1s, 2s, 3s')', 'CSSStyleValue.parse' is undefined)
-FAIL CSSStyleValue.parse() with a valid shorthand property returns a CSSStyleValue CSSStyleValue.parse is not a function. (In 'CSSStyleValue.parse('margin', '1px 2px 3px 4px')', 'CSSStyleValue.parse' is undefined)
-FAIL CSSStyleValue.parse() with a valid custom property returns a CSSStyleValue CSSStyleValue.parse is not a function. (In 'CSSStyleValue.parse('--foo', 'auto')', 'CSSStyleValue.parse' is undefined)
+FAIL CSSStyleValue.parse() with a valid property returns a CSSStyleValue 10px cannot be parsed as a width
+FAIL CSSStyleValue.parse() is not case sensitive 10px cannot be parsed as a WiDtH
+FAIL CSSStyleValue.parse() with a valid list-valued property returns a CSSStyleValue 1s, 2s, 3s cannot be parsed as a transition-duration
+FAIL CSSStyleValue.parse() with a valid shorthand property returns a CSSStyleValue 1px 2px 3px 4px cannot be parsed as a margin
+FAIL CSSStyleValue.parse() with a valid custom property returns a CSSStyleValue Property String is not a valid CSS property.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-objects/parse-invalid-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-objects/parse-invalid-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-objects/parse-invalid-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,7 +1,11 @@
PASS CSSStyleValue.parse() with empty property name throws TypeError
PASS CSSStyleValue.parse() with unsupported property name throws TypeError
-PASS CSSStyleValue.parse() with invalid value for valid property throws TypeError
-PASS CSSStyleValue.parse() with invalid value for shorthand property throws TypeError
+FAIL CSSStyleValue.parse() with invalid value for valid property throws TypeError assert_throws_js: function "() => CSSStyleValue.parse('width', '10deg')" threw object "SyntaxError: 10deg cannot be parsed as a width" ("SyntaxError") expected instance of function "function TypeError() {
+ [native code]
+}" ("TypeError")
+FAIL CSSStyleValue.parse() with invalid value for shorthand property throws TypeError assert_throws_js: function "() => CSSStyleValue.parse('margin', '10deg')" threw object "SyntaxError: 10deg cannot be parsed as a margin" ("SyntaxError") expected instance of function "function TypeError() {
+ [native code]
+}" ("TypeError")
PASS CSSStyleValue.parse() with invalid value for custom property throws TypeError
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-objects/parseAll-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-objects/parseAll-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-objects/parseAll-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,7 +1,7 @@
-FAIL CSSStyleValue.parseAll() with a valid property returns a list with a single CSSStyleValue CSSStyleValue.parseAll is not a function. (In 'CSSStyleValue.parseAll('width', '10px')', 'CSSStyleValue.parseAll' is undefined)
-FAIL CSSStyleValue.parseAll() is not case sensitive CSSStyleValue.parseAll is not a function. (In 'CSSStyleValue.parseAll('WiDtH', '10px')', 'CSSStyleValue.parseAll' is undefined)
-FAIL CSSStyleValue.parseAll() with a valid list-valued property returns a list with a single CSSStyleValue CSSStyleValue.parseAll is not a function. (In 'CSSStyleValue.parseAll('transition-duration', '1s, 2s, 3s')', 'CSSStyleValue.parseAll' is undefined)
-FAIL CSSStyleValue.parseAll() with a valid shorthand property returns a CSSStyleValue CSSStyleValue.parseAll is not a function. (In 'CSSStyleValue.parseAll('margin', '1px 2px 3px 4px')', 'CSSStyleValue.parseAll' is undefined)
-FAIL CSSStyleValue.parseAll() with a valid custom property returns a list with a single CSSStyleValue CSSStyleValue.parseAll is not a function. (In 'CSSStyleValue.parseAll('--foo', 'auto')', 'CSSStyleValue.parseAll' is undefined)
+FAIL CSSStyleValue.parseAll() with a valid property returns a list with a single CSSStyleValue assert_equals: Result must be a list with one element expected 1 but got 0
+FAIL CSSStyleValue.parseAll() is not case sensitive assert_equals: Result must be a list with one element expected 1 but got 0
+FAIL CSSStyleValue.parseAll() with a valid list-valued property returns a list with a single CSSStyleValue assert_equals: Result must be a list with three elements expected 3 but got 0
+FAIL CSSStyleValue.parseAll() with a valid shorthand property returns a CSSStyleValue 1px 2px 3px 4px cannot be parsed as a margin
+FAIL CSSStyleValue.parseAll() with a valid custom property returns a list with a single CSSStyleValue Property String is not a valid CSS property.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-objects/parseAll-invalid-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-objects/parseAll-invalid-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-objects/parseAll-invalid-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,7 +1,11 @@
PASS CSSStyleValue.parseAll() with empty property name throws TypeError
PASS CSSStyleValue.parseAll() with unsupported property name throws TypeError
-PASS CSSStyleValue.parseAll() with invalid value for valid property throws TypeError
-PASS CSSStyleValue.parseAll() with invalid value for shorthand property throws TypeError
+FAIL CSSStyleValue.parseAll() with invalid value for valid property throws TypeError assert_throws_js: function "() => CSSStyleValue.parseAll('width', '10deg')" threw object "SyntaxError: 10deg cannot be parsed as a width" ("SyntaxError") expected instance of function "function TypeError() {
+ [native code]
+}" ("TypeError")
+FAIL CSSStyleValue.parseAll() with invalid value for shorthand property throws TypeError assert_throws_js: function "() => CSSStyleValue.parseAll('margin', '10deg')" threw object "SyntaxError: 10deg cannot be parsed as a margin" ("SyntaxError") expected instance of function "function TypeError() {
+ [native code]
+}" ("TypeError")
PASS CSSStyleValue.parseAll() with invalid value for custom property throws TypeError
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/crashtests/cssTransform-Internal-value-expected.png
(Binary files differ)
Index: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/crashtests/cssTransform-Internal-value-expected.png
===================================================================
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/crashtests/cssTransform-Internal-value-expected.png 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/crashtests/cssTransform-Internal-value-expected.png 2021-08-31 01:08:48 UTC (rev 281786)
Property changes on: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/crashtests/cssTransform-Internal-value-expected.png
___________________________________________________________________
Added: svn:mime-type
+image/png
\ No newline at end of property
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/cssKeywordValue.tentative-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/cssKeywordValue.tentative-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/cssKeywordValue.tentative-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,6 +1,6 @@
FAIL CSSKeywordValue constructed from IDL serializes correctly Can't find variable: CSSKeywordValue
FAIL CSSKeywordValue constructed from IDL serializes to escaped strings Can't find variable: CSSKeywordValue
-FAIL CSSKeywordValue from DOMString modified through "value" setter serializes correctly CSSStyleValue.parse is not a function. (In 'CSSStyleValue.parse('width', 'auto')', 'CSSStyleValue.parse' is undefined)
+FAIL CSSKeywordValue from DOMString modified through "value" setter serializes correctly auto cannot be parsed as a width
FAIL CSSKeywordValue from CSSOM modified through "value" setter serializes correctly assert_equals: expected "lemon" but got "auto"
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/cssPositionValue-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/cssPositionValue-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/cssPositionValue-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,7 +1,7 @@
FAIL CSSPositionValue with length and percent serializes by concantenating x and y Can't find variable: CSSPositionValue
-FAIL CSSPositionValue from DOMString modified by "x" setter serializes to its new value CSSStyleValue.parse is not a function. (In 'CSSStyleValue.parse('object-position', '1px 1px')', 'CSSStyleValue.parse' is undefined)
-FAIL CSSPositionValue from DOMString modified by "y" setter serializes to its new value CSSStyleValue.parse is not a function. (In 'CSSStyleValue.parse('object-position', '1px 1px')', 'CSSStyleValue.parse' is undefined)
+FAIL CSSPositionValue from DOMString modified by "x" setter serializes to its new value 1px 1px cannot be parsed as a object-position
+FAIL CSSPositionValue from DOMString modified by "y" setter serializes to its new value 1px 1px cannot be parsed as a object-position
FAIL CSSPositionValue from CSSOM modified by "x" setter serializes to its new value CSS.percent is not a function. (In 'CSS.percent(-3.14)', 'CSS.percent' is undefined)
FAIL CSSPositionValue from CSSOM modified by "y" setter serializes to its new value CSS.percent is not a function. (In 'CSS.percent(-3.14)', 'CSS.percent' is undefined)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/cssStyleValue-string-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/cssStyleValue-string-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/cssStyleValue-string-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,4 +1,4 @@
-FAIL CSSStyleValue parsed from string serializes to given string CSSStyleValue.parse is not a function. (In 'CSSStyleValue.parse('color', 'red')', 'CSSStyleValue.parse' is undefined)
-FAIL Shorthand CSSStyleValue parsed from string serializes to given string CSSStyleValue.parse is not a function. (In 'CSSStyleValue.parse('background', 'blue')', 'CSSStyleValue.parse' is undefined)
+FAIL CSSStyleValue parsed from string serializes to given string red cannot be parsed as a color
+FAIL Shorthand CSSStyleValue parsed from string serializes to given string blue cannot be parsed as a background
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/cssUnitValue.tentative-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/cssUnitValue.tentative-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/cssUnitValue.tentative-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -3,6 +3,6 @@
FAIL CSSUnitValue with unit "percent" constructed from IDL serializes correctly assert_equals: expected "3.14%" but got "3percent"
FAIL CSSUnitValue with unit "number" constructed from IDL serializes correctly assert_equals: expected "3.14" but got "3number"
FAIL CSSUnitValue with integer values constructed from IDL serializes correctly assert_equals: expected "3" but got "3number"
-FAIL CSSKeywordValue from DOMString modified by "value" setter serializes correctly CSSStyleValue.parse is not a function. (In 'CSSStyleValue.parse('width', '1px')', 'CSSStyleValue.parse' is undefined)
+FAIL CSSKeywordValue from DOMString modified by "value" setter serializes correctly 1px cannot be parsed as a width
FAIL CSSKeywordValue from CSSOM modified by "value" setter serializes correctly assert_equals: expected "3.14px" but got "3px"
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/cssUnparsedValue-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/cssUnparsedValue-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-serialization/cssUnparsedValue-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,5 +1,5 @@
-FAIL CSSUnparsedValue containing strings serializes to its concatenated contents assert_equals: expected "lemonade" but got "lem,on,ade"
-FAIL CSSUnparsedValue containing variable references serializes its concatenated contents Can't find variable: CSSVariableReferenceValue
-FAIL CSSUnparsedValue containing mix of strings and variable references serializes to its concatenated contents Can't find variable: CSSVariableReferenceValue
+PASS CSSUnparsedValue containing strings serializes to its concatenated contents
+FAIL CSSUnparsedValue containing variable references serializes its concatenated contents assert_equals: expected "var(--A,var(--B))var(--C)" but got "var(--A, var(--B))var(--C)"
+FAIL CSSUnparsedValue containing mix of strings and variable references serializes to its concatenated contents assert_equals: expected "foobar var(--A,baz var(--B)lemon)var(--C,ade)" but got "foobar var(--A, baz var(--B)lemon)var(--C, ade)"
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,5 +1,6 @@
-CONSOLE MESSAGE: ReferenceError: Can't find variable: CSSVariableReferenceValue
-Harness Error (FAIL), message = ReferenceError: Can't find variable: CSSVariableReferenceValue
+PASS CSSUnparsedValue can be constructed from no arguments
+PASS CSSUnparsedValue can be constructed from a single empty string
+PASS CSSUnparsedValue can be constructed from a single CSSVariableReferenceValue
+PASS CSSUnparsedValue can be constructed from a mix of strings and CSSVariableReferenceValues
-
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-indexed-getter-setter-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-indexed-getter-setter-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-indexed-getter-setter-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,8 +1,8 @@
PASS Getting invalid index in CSSUnparsedValue returns undefined
-FAIL Can update fragment in CSSUnparsedValue to a String Can't find variable: CSSVariableReferenceValue
-FAIL Can update fragment in CSSUnparsedValue to a CSSVariableReference Can't find variable: CSSVariableReferenceValue
-PASS Setting one past the last fragment in a CSSUnparsedValue to a String appends the new fragment
-FAIL Setting one past the last fragment in a CSSUnparsedValue to a CSSVariableReferenceValue appends the new fragment Can't find variable: CSSVariableReferenceValue
-FAIL Setting out of range index in CSSUnparsedValue throws RangeError assert_throws_js: function "() => result[3] = 'foo'" did not throw
+PASS Can update fragment in CSSUnparsedValue to a String
+PASS Can update fragment in CSSUnparsedValue to a CSSVariableReference
+FAIL Setting one past the last fragment in a CSSUnparsedValue to a String appends the new fragment Index 0 exceeds index range for unparsed segments.
+FAIL Setting one past the last fragment in a CSSUnparsedValue to a CSSVariableReferenceValue appends the new fragment Index 1 exceeds index range for unparsed segments.
+PASS Setting out of range index in CSSUnparsedValue throws RangeError
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-iterable-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-iterable-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-iterable-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,4 +1,4 @@
-FAIL Iterating over an empty CSSUnparsedValue produces nothing Spread syntax requires ...iterable[Symbol.iterator] to be a function
-FAIL Iterating over a CSSUnparsedValue produces all fragments Can't find variable: CSSVariableReferenceValue
+PASS Iterating over an empty CSSUnparsedValue produces nothing
+PASS Iterating over a CSSUnparsedValue produces all fragments
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-length-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-length-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-length-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,6 +1,6 @@
-FAIL Length of CSSUnparsedValue with no fragments is zero assert_equals: length expected (number) 0 but got (undefined) undefined
-FAIL Length of CSSUnparsedValue with multiple fragments is the number of fragments Can't find variable: CSSVariableReferenceValue
-FAIL Length of CSSUnparsedValue updates when fragments are appended assert_equals: initial length expected (number) 1 but got (undefined) undefined
-FAIL Length of CSSUnparsedValue does not change when fragments are modified assert_equals: initial length expected (number) 1 but got (undefined) undefined
+PASS Length of CSSUnparsedValue with no fragments is zero
+PASS Length of CSSUnparsedValue with multiple fragments is the number of fragments
+FAIL Length of CSSUnparsedValue updates when fragments are appended Index 1 exceeds index range for unparsed segments.
+PASS Length of CSSUnparsedValue does not change when fragments are modified
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,5 +1,5 @@
-FAIL CSSVariableReferenceValue can be constructed with no fallback Can't find variable: CSSVariableReferenceValue
-FAIL CSSVariableReferenceValue can be constructed with null fallback Can't find variable: CSSVariableReferenceValue
-FAIL CSSVariableReferenceValue can be constructed with valid fallback Can't find variable: CSSVariableReferenceValue
+PASS CSSVariableReferenceValue can be constructed with no fallback
+PASS CSSVariableReferenceValue can be constructed with null fallback
+PASS CSSVariableReferenceValue can be constructed with valid fallback
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-invalid-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-invalid-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-invalid-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,8 +1,4 @@
-FAIL Constructing a CSSVariableReferenceValue with an empty variable name throws a TypeError assert_throws_js: function "() => new CSSVariableReferenceValue('')" threw object "ReferenceError: Can't find variable: CSSVariableReferenceValue" ("ReferenceError") expected instance of function "function TypeError() {
- [native code]
-}" ("TypeError")
-FAIL Constructing a CSSVariableReferenceValue with an invalid variable name throws SyntaxError assert_throws_js: function "() => new CSSVariableReferenceValue('bar')" threw object "ReferenceError: Can't find variable: CSSVariableReferenceValue" ("ReferenceError") expected instance of function "function TypeError() {
- [native code]
-}" ("TypeError")
+PASS Constructing a CSSVariableReferenceValue with an empty variable name throws a TypeError
+PASS Constructing a CSSVariableReferenceValue with an invalid variable name throws SyntaxError
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-variable-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-variable-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-variable-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,5 +1,5 @@
-FAIL CSSVariableReferenceValue.variable can updated to a valid custom property name Can't find variable: CSSVariableReferenceValue
-FAIL Updating CSSVariableReferenceValue.variable to the empty string throws TypeError Can't find variable: CSSVariableReferenceValue
-FAIL Updating CSSVariableReferenceValue.variable to an invalid custom property name throws TypeError Can't find variable: CSSVariableReferenceValue
+PASS CSSVariableReferenceValue.variable can updated to a valid custom property name
+PASS Updating CSSVariableReferenceValue.variable to the empty string throws TypeError
+PASS Updating CSSVariableReferenceValue.variable to an invalid custom property name throws TypeError
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/numeric-objects/parse.tentative-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/numeric-objects/parse.tentative-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/numeric-objects/parse.tentative-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,9 +1,9 @@
-FAIL Parsing an invalid string throws SyntaxError assert_throws_dom: function "() => CSSNumericValue.parse('%#(')" threw object "TypeError: CSSNumericValue.parse('%# is not a function. (In 'CSSNumericValue.parse('%#(')', 'CSSNumericValue.parse('%#' is undefined)" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12
-FAIL Parsing a string with a non numeric token throws SyntaxError assert_throws_dom: function "() => CSSNumericValue.parse('auto')" threw object "TypeError: CSSNumericValue.parse is not a function. (In 'CSSNumericValue.parse('auto')', 'CSSNumericValue.parse' is undefined)" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12
-FAIL Parsing a string with left over numeric tokens throws SyntaxError assert_throws_dom: function "() => CSSNumericValue.parse('1 2')" threw object "TypeError: CSSNumericValue.parse is not a function. (In 'CSSNumericValue.parse('1 2')', 'CSSNumericValue.parse' is undefined)" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12
-FAIL Parsing a calc with incompatible units throws a SyntaxError assert_throws_dom: function "() => CSSNumericValue.parse('calc(calc(1px * 2s) + 3%)')" threw object "TypeError: CSSNumericValue.parse is not a function. (In 'CSSNumericValue.parse('calc(calc(1px * 2s) + 3%)')', 'CSSNumericValue.parse' is undefined)" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12
-FAIL Parsing ignores surrounding spaces CSSNumericValue.parse is not a function. (In 'CSSNumericValue.parse(' 1px ')', 'CSSNumericValue.parse' is undefined)
+FAIL Parsing an invalid string throws SyntaxError assert_throws_dom: function "() => CSSNumericValue.parse('%#(')" threw object "TypeError: Not enough arguments" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12
+FAIL Parsing a string with a non numeric token throws SyntaxError assert_throws_dom: function "() => CSSNumericValue.parse('auto')" threw object "TypeError: Not enough arguments" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12
+FAIL Parsing a string with left over numeric tokens throws SyntaxError assert_throws_dom: function "() => CSSNumericValue.parse('1 2')" threw object "TypeError: Not enough arguments" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12
+FAIL Parsing a calc with incompatible units throws a SyntaxError assert_throws_dom: function "() => CSSNumericValue.parse('calc(calc(1px * 2s) + 3%)')" threw object "TypeError: Not enough arguments" that is not a DOMException SyntaxError: property "code" is equal to undefined, expected 12
+FAIL Parsing ignores surrounding spaces Not enough arguments
FAIL Parsing min() is successful Can't find variable: CSSMathMin
FAIL Parsing max() is successful Can't find variable: CSSMathMax
FAIL Parsing clamp() is successful Can't find variable: CSSMathMax
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/inline/get-expected.txt (281785 => 281786)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/inline/get-expected.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/the-stylepropertymap/inline/get-expected.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -2,8 +2,8 @@
FAIL Getting a custom property not in the inline style returns null assert_equals: expected null but got object ""
PASS Getting a valid property not in the inline style returns null
PASS Getting a valid property from inline style returns the correct entry
-PASS Getting a valid custom property from inline style returns the correct entry
-FAIL Getting a list-valued property from inline style returns only the first value assert_equals: expected "CSSUnitValue" but got "CSSUnparsedValue"
+FAIL Getting a valid custom property from inline style returns the correct entry assert_equals: expected "CSSUnparsedValue" but got "CSSStyleValue"
+FAIL Getting a list-valued property from inline style returns only the first value assert_equals: expected "CSSUnitValue" but got "CSSStyleValue"
PASS Declared StylePropertyMap.get is not case-sensitive
PASS Declared StylePropertyMap.get reflects changes in the inline style
Modified: trunk/Source/WebCore/CMakeLists.txt (281785 => 281786)
--- trunk/Source/WebCore/CMakeLists.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/CMakeLists.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -726,6 +726,7 @@
css/StyleSheetList.idl
css/typedom/CSSNumericValue.idl
+ css/typedom/CSSOMVariableReferenceValue.idl
css/typedom/CSSStyleImageValue.idl
css/typedom/CSSStyleValue.idl
css/typedom/CSSUnitValue.idl
Modified: trunk/Source/WebCore/ChangeLog (281785 => 281786)
--- trunk/Source/WebCore/ChangeLog 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/ChangeLog 2021-08-31 01:08:48 UTC (rev 281786)
@@ -1,3 +1,63 @@
+2021-08-30 Johnson Zhou <[email protected]>
+
+ Addition of CSSUnparsedValue. (TypedOM)
+ https://bugs.webkit.org/show_bug.cgi?id=229069
+
+ Reviewed by Alex Christensen.
+
+ * CMakeLists.txt:
+ * DerivedSources-input.xcfilelist:
+ * DerivedSources-output.xcfilelist:
+ * DerivedSources.make:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSCSSStyleValueCustom.cpp:
+ (WebCore::toJSNewlyCreated):
+ * bindings/js/WebCoreBuiltinNames.h:
+ * css/typedom/CSSNumericValue.h:
+ (WebCore::CSSNumericValue::getType const):
+ * css/typedom/CSSOMVariableReferenceValue.cpp: Copied from Source/WebCore/css/typedom/CSSUnparsedValue.cpp.
+ (WebCore::CSSOMVariableReferenceValue::create):
+ (WebCore::CSSOMVariableReferenceValue::setVariable):
+ (WebCore::CSSOMVariableReferenceValue::toString const):
+ * css/typedom/CSSOMVariableReferenceValue.h: Copied from Source/WebCore/css/typedom/CSSUnparsedValue.h.
+ * css/typedom/CSSOMVariableReferenceValue.idl: Copied from Source/WebCore/css/typedom/CSSStyleValue.idl.
+ * css/typedom/CSSStyleImageValue.cpp:
+ (WebCore::CSSStyleImageValue::CSSStyleImageValue):
+ * css/typedom/CSSStyleImageValue.h:
+ * css/typedom/CSSStyleValue.cpp:
+ (WebCore::CSSStyleValue::parseStyleValue):
+ (WebCore::CSSStyleValue::parse):
+ (WebCore::CSSStyleValue::parseAll):
+ (WebCore::CSSStyleValue::create):
+ (WebCore::CSSStyleValue::CSSStyleValue):
+ (WebCore::CSSStyleValue::reifyValue):
+ (WebCore::CSSStyleValue::toString const):
+ * css/typedom/CSSStyleValue.h:
+ (WebCore::CSSStyleValue::getType const):
+ (WebCore::CSSStyleValue::isUnitValue): Deleted.
+ (WebCore::CSSStyleValue::isUnparsedValue): Deleted.
+ (WebCore::CSSStyleValue::isImageValue): Deleted.
+ * css/typedom/CSSStyleValue.idl:
+ * css/typedom/CSSUnitValue.h:
+ * css/typedom/CSSUnparsedValue.cpp:
+ (WebCore::CSSUnparsedValue::create):
+ (WebCore::CSSUnparsedValue::CSSUnparsedValue):
+ (WebCore::CSSUnparsedValue::toString const):
+ (WebCore::CSSUnparsedValue::item):
+ (WebCore::CSSUnparsedValue::setItem):
+ * css/typedom/CSSUnparsedValue.h:
+ (WebCore::CSSUnparsedValue::length const):
+ (isType):
+ * css/typedom/CSSUnparsedValue.idl:
+ * css/typedom/StylePropertyMapReadOnly.cpp:
+ (WebCore::StylePropertyMapReadOnly::reifyValue):
+ (WebCore::StylePropertyMapReadOnly::customPropertyValueOrDefault):
+ * css/typedom/StylePropertyMapReadOnly.h:
+ * dom/StyledElement.cpp:
+ * html/CustomPaintImage.cpp:
+ (WebCore::extractComputedProperty):
+
2021-08-30 Kiet Ho <[email protected]>
Remove hardcoded CSSUnitType enum values
Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (281785 => 281786)
--- trunk/Source/WebCore/DerivedSources-input.xcfilelist 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist 2021-08-31 01:08:48 UTC (rev 281786)
@@ -735,6 +735,7 @@
$(PROJECT_DIR)/css/quirks.css
$(PROJECT_DIR)/css/svg.css
$(PROJECT_DIR)/css/typedom/CSSNumericValue.idl
+$(PROJECT_DIR)/css/typedom/CSSOMVariableReferenceValue.idl
$(PROJECT_DIR)/css/typedom/CSSStyleImageValue.idl
$(PROJECT_DIR)/css/typedom/CSSStyleValue.idl
$(PROJECT_DIR)/css/typedom/CSSUnitValue.idl
Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (281785 => 281786)
--- trunk/Source/WebCore/DerivedSources-output.xcfilelist 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist 2021-08-31 01:08:48 UTC (rev 281786)
@@ -314,6 +314,8 @@
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSNamespaceRule.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSNumericValue.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSNumericValue.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSOMVariableReferenceValue.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSOMVariableReferenceValue.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSPageRule.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSPageRule.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSPaintCallback.cpp
Modified: trunk/Source/WebCore/DerivedSources.make (281785 => 281786)
--- trunk/Source/WebCore/DerivedSources.make 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/DerivedSources.make 2021-08-31 01:08:48 UTC (rev 281786)
@@ -612,6 +612,7 @@
$(WebCore)/css/typedom/CSSStyleValue.idl \
$(WebCore)/css/typedom/CSSUnitValue.idl \
$(WebCore)/css/typedom/CSSUnparsedValue.idl \
+ $(WebCore)/css/typedom/CSSOMVariableReferenceValue.idl \
$(WebCore)/dom/AbortAlgorithm.idl \
$(WebCore)/dom/AbortController.idl \
$(WebCore)/dom/AbortSignal.idl \
Modified: trunk/Source/WebCore/Sources.txt (281785 => 281786)
--- trunk/Source/WebCore/Sources.txt 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/Sources.txt 2021-08-31 01:08:48 UTC (rev 281786)
@@ -775,6 +775,7 @@
css/typedom/CSSStyleValue.cpp
css/typedom/CSSUnitValue.cpp
css/typedom/CSSUnparsedValue.cpp
+css/typedom/CSSOMVariableReferenceValue.cpp
cssjit/SelectorCompiler.cpp
display/compositing/DisplayLayerController.cpp
display/css/DisplayBox.cpp
@@ -3601,6 +3602,7 @@
JSTreeWalker.cpp
JSCSSStyleImageValue.cpp
JSCSSNumericValue.cpp
+JSCSSOMVariableReferenceValue.cpp
JSCSSStyleValue.cpp
JSCSSUnitValue.cpp
JSCSSUnparsedValue.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (281785 => 281786)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-08-31 01:08:48 UTC (rev 281786)
@@ -748,6 +748,7 @@
29AE213521ABA48A00869283 /* AXIsolatedObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 29AE213321ABA48A00869283 /* AXIsolatedObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
29D7BCFA1444AF7D0070619C /* AccessibilitySpinButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 29D7BCF91444AF7D0070619C /* AccessibilitySpinButton.h */; };
29FAF4B6195AB08900A522DC /* TextUndoInsertionMarkupMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 29FAF4B5195AB08900A522DC /* TextUndoInsertionMarkupMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 2ABFFFF326C535C00048875B /* CSSOMVariableReferenceValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ABFFFF126C535BD0048875B /* CSSOMVariableReferenceValue.h */; };
2B365C841525119E0091D27B /* RenderSVGEllipse.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B4235A015250F6000DBBCD8 /* RenderSVGEllipse.h */; };
2BE8E2C712A589EC00FAD550 /* HTMLMetaCharsetParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BE8E2C612A589EC00FAD550 /* HTMLMetaCharsetParser.h */; };
2C85653424C0F73C00A37673 /* FilterEffectRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C85653324C0F73C00A37673 /* FilterEffectRenderer.h */; };
@@ -7193,6 +7194,9 @@
2A66438E26A006AE00C147A1 /* FormDataEvent.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = FormDataEvent.idl; sourceTree = "<group>"; };
2A66439026A006AF00C147A1 /* FormDataEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FormDataEvent.h; sourceTree = "<group>"; };
2A66439126A006AF00C147A1 /* FormDataEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FormDataEvent.cpp; sourceTree = "<group>"; };
+ 2ABFFFEF26C535BC0048875B /* CSSOMVariableReferenceValue.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CSSOMVariableReferenceValue.cpp; sourceTree = "<group>"; };
+ 2ABFFFF126C535BD0048875B /* CSSOMVariableReferenceValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSOMVariableReferenceValue.h; sourceTree = "<group>"; };
+ 2ABFFFF226C535BD0048875B /* CSSOMVariableReferenceValue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSOMVariableReferenceValue.idl; sourceTree = "<group>"; };
2B42359F15250F6000DBBCD8 /* RenderSVGEllipse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGEllipse.cpp; sourceTree = "<group>"; };
2B4235A015250F6000DBBCD8 /* RenderSVGEllipse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGEllipse.h; sourceTree = "<group>"; };
2BE8E2C612A589EC00FAD550 /* HTMLMetaCharsetParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLMetaCharsetParser.h; sourceTree = "<group>"; };
@@ -20149,6 +20153,9 @@
E329276222543F5800308A9A /* CSSNumericValue.cpp */,
4BAFD0DF219220AB00C0AB64 /* CSSNumericValue.h */,
4BAFD0DB2192202200C0AB64 /* CSSNumericValue.idl */,
+ 2ABFFFEF26C535BC0048875B /* CSSOMVariableReferenceValue.cpp */,
+ 2ABFFFF126C535BD0048875B /* CSSOMVariableReferenceValue.h */,
+ 2ABFFFF226C535BD0048875B /* CSSOMVariableReferenceValue.idl */,
E329276022543F5800308A9A /* CSSStyleImageValue.cpp */,
4B43864F219CD56100F8D3C5 /* CSSStyleImageValue.h */,
4B43864D219CD52D00F8D3C5 /* CSSStyleImageValue.idl */,
@@ -31601,6 +31608,7 @@
314BE3A11B30F6B700141982 /* CSSNamedImageValue.h in Headers */,
94E839511DFB2A0E007BC6A7 /* CSSNamespaceRule.h in Headers */,
4BAFD0E0219220AB00C0AB64 /* CSSNumericValue.h in Headers */,
+ 2ABFFFF326C535C00048875B /* CSSOMVariableReferenceValue.h in Headers */,
A80E6D000A1989CA007FB8C5 /* CSSPageRule.h in Headers */,
4B5BDD9B21658A1500DD4262 /* CSSPaintCallback.h in Headers */,
4B6E87692176D69200420E5E /* CSSPaintImageValue.h in Headers */,
Modified: trunk/Source/WebCore/bindings/js/JSCSSStyleValueCustom.cpp (281785 => 281786)
--- trunk/Source/WebCore/bindings/js/JSCSSStyleValueCustom.cpp 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/bindings/js/JSCSSStyleValueCustom.cpp 2021-08-31 01:08:48 UTC (rev 281786)
@@ -38,15 +38,17 @@
JSValue toJSNewlyCreated(JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<CSSStyleValue>&& value)
{
- if (value->isUnitValue())
+ switch (value->getType()) {
+ case CSSStyleValueType::CSSUnitValue:
return createWrapper<CSSUnitValue>(globalObject, WTFMove(value));
- if (value->isUnparsedValue())
+ case CSSStyleValueType::CSSUnparsedValue:
return createWrapper<CSSUnparsedValue>(globalObject, WTFMove(value));
- if (value->isImageValue())
+ case CSSStyleValueType::CSSStyleImageValue:
return createWrapper<CSSStyleImageValue>(globalObject, WTFMove(value));
+ default:
+ return createWrapper<CSSStyleValue>(globalObject, WTFMove(value));
+ }
- ASSERT_NOT_REACHED();
- return createWrapper<CSSStyleValue>(globalObject, WTFMove(value));
}
JSValue toJS(JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, CSSStyleValue& object)
Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (281785 => 281786)
--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2021-08-31 01:08:48 UTC (rev 281786)
@@ -85,6 +85,7 @@
macro(CSSTransition) \
macro(CSSUnitValue) \
macro(CSSUnparsedValue) \
+ macro(CSSVariableReferenceValue) \
macro(CustomElementRegistry) \
macro(Database) \
macro(DataTransferItem) \
Modified: trunk/Source/WebCore/css/typedom/CSSNumericValue.h (281785 => 281786)
--- trunk/Source/WebCore/css/typedom/CSSNumericValue.h 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/css/typedom/CSSNumericValue.h 2021-08-31 01:08:48 UTC (rev 281786)
@@ -33,6 +33,9 @@
class CSSNumericValue : public CSSStyleValue {
WTF_MAKE_ISO_ALLOCATED(CSSNumericValue);
+
+ CSSStyleValueType getType() const override { return CSSStyleValueType::CSSNumericValue; }
+
protected:
CSSNumericValue() = default;
};
Copied: trunk/Source/WebCore/css/typedom/CSSOMVariableReferenceValue.cpp (from rev 281785, trunk/Source/WebCore/css/typedom/CSSUnparsedValue.cpp) (0 => 281786)
--- trunk/Source/WebCore/css/typedom/CSSOMVariableReferenceValue.cpp (rev 0)
+++ trunk/Source/WebCore/css/typedom/CSSOMVariableReferenceValue.cpp 2021-08-31 01:08:48 UTC (rev 281786)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CSSOMVariableReferenceValue.h"
+
+#if ENABLE(CSS_TYPED_OM)
+
+#include "CSSUnparsedValue.h"
+#include <wtf/IsoMallocInlines.h>
+
+namespace WebCore {
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(CSSOMVariableReferenceValue);
+
+ExceptionOr<Ref<CSSOMVariableReferenceValue>> CSSOMVariableReferenceValue::create(String&& variable, RefPtr<CSSUnparsedValue>&& fallback)
+{
+ if (!variable.startsWith("--"))
+ return Exception { TypeError, "Custom Variable Reference needs to have \"--\" prefix."_s };
+
+ return adoptRef(*new CSSOMVariableReferenceValue(WTFMove(variable), WTFMove(fallback)));
+}
+
+ExceptionOr<void> CSSOMVariableReferenceValue::setVariable(String&& variable)
+{
+ if (!variable.startsWith("--"))
+ return Exception { TypeError, "Custom Variable Reference needs to have \"--\" prefix."_s };
+
+ m_variable = WTFMove(variable);
+ return { };
+}
+
+String CSSOMVariableReferenceValue::toString() const
+{
+ return makeString("var(", m_variable, (m_fallback ? ", "_s : ""_s), (m_fallback ? m_fallback->toString() : emptyString()), ")");
+}
+
+} // namespace WebCore
+
+#endif
Copied: trunk/Source/WebCore/css/typedom/CSSOMVariableReferenceValue.h (from rev 281785, trunk/Source/WebCore/css/typedom/CSSStyleImageValue.h) (0 => 281786)
--- trunk/Source/WebCore/css/typedom/CSSOMVariableReferenceValue.h (rev 0)
+++ trunk/Source/WebCore/css/typedom/CSSOMVariableReferenceValue.h 2021-08-31 01:08:48 UTC (rev 281786)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(CSS_TYPED_OM)
+
+#include "CSSStyleValue.h"
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+template<typename> class ExceptionOr;
+class CSSUnparsedValue;
+
+class CSSOMVariableReferenceValue : public RefCounted<CSSOMVariableReferenceValue> {
+ WTF_MAKE_ISO_ALLOCATED(CSSOMVariableReferenceValue);
+public:
+ static ExceptionOr<Ref<CSSOMVariableReferenceValue>> create(String&&, RefPtr<CSSUnparsedValue>&& fallback = { });
+
+ ExceptionOr<void> setVariable(String&&);
+ String toString() const;
+
+ const String& variable() const { return m_variable; }
+ CSSUnparsedValue* fallback() { return m_fallback.get(); }
+
+private:
+ CSSOMVariableReferenceValue(String&& variable, RefPtr<CSSUnparsedValue>&& fallback)
+ : m_variable(WTFMove(variable))
+ , m_fallback(WTFMove(fallback)) { }
+
+ String m_variable;
+ RefPtr<CSSUnparsedValue> m_fallback;
+};
+
+} // namespace WebCore
+
+#endif
Copied: trunk/Source/WebCore/css/typedom/CSSOMVariableReferenceValue.idl (from rev 281785, trunk/Source/WebCore/css/typedom/CSSUnparsedValue.idl) (0 => 281786)
--- trunk/Source/WebCore/css/typedom/CSSOMVariableReferenceValue.idl (rev 0)
+++ trunk/Source/WebCore/css/typedom/CSSOMVariableReferenceValue.idl 2021-08-31 01:08:48 UTC (rev 281786)
@@ -0,0 +1,36 @@
+/*
+* Copyright (C) 2021 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+[
+ InterfaceName=CSSVariableReferenceValue,
+ EnabledAtRuntime=CSSTypedOM,
+ Conditional=CSS_TYPED_OM,
+ ImplementationLacksVTable,
+ Exposed=(Window,Worker,PaintWorklet),
+] interface CSSOMVariableReferenceValue {
+ constructor(USVString variable, optional CSSUnparsedValue? fallback = null);
+ attribute USVString variable;
+ readonly attribute CSSUnparsedValue? fallback;
+};
Modified: trunk/Source/WebCore/css/typedom/CSSStyleImageValue.cpp (281785 => 281786)
--- trunk/Source/WebCore/css/typedom/CSSStyleImageValue.cpp 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/css/typedom/CSSStyleImageValue.cpp 2021-08-31 01:08:48 UTC (rev 281786)
@@ -40,8 +40,8 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(CSSStyleImageValue);
-CSSStyleImageValue::CSSStyleImageValue(CSSImageValue& cssValue, Document& document)
- : m_cssValue(makeRef(cssValue))
+CSSStyleImageValue::CSSStyleImageValue(Ref<CSSImageValue>&& cssValue, Document& document)
+ : m_cssValue(WTFMove(cssValue))
, m_document(makeWeakPtr(document))
{
}
Modified: trunk/Source/WebCore/css/typedom/CSSStyleImageValue.h (281785 => 281786)
--- trunk/Source/WebCore/css/typedom/CSSStyleImageValue.h 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/css/typedom/CSSStyleImageValue.h 2021-08-31 01:08:48 UTC (rev 281786)
@@ -41,21 +41,21 @@
class CSSStyleImageValue final : public CSSStyleValue {
WTF_MAKE_ISO_ALLOCATED(CSSStyleImageValue);
public:
- static Ref<CSSStyleImageValue> create(CSSImageValue& cssValue, Document& document)
+ static Ref<CSSStyleImageValue> create(Ref<CSSImageValue>&& cssValue, Document& document)
{
- return adoptRef(*new CSSStyleImageValue(cssValue, document));
+ return adoptRef(*new CSSStyleImageValue(WTFMove(cssValue), document));
}
- String toString() final { return m_cssValue->cssText(); }
+ String toString() const final { return m_cssValue->cssText(); }
CachedImage* image() { return m_cssValue->cachedImage(); }
Document* document() const;
-
+
+ CSSStyleValueType getType() const final { return CSSStyleValueType::CSSStyleImageValue; }
+
private:
- CSSStyleImageValue(CSSImageValue&, Document&);
+ CSSStyleImageValue(Ref<CSSImageValue>&&, Document&);
- bool isImageValue() final { return true; }
-
Ref<CSSImageValue> m_cssValue;
WeakPtr<Document> m_document;
};
@@ -62,4 +62,8 @@
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::CSSStyleImageValue)
+ static bool isType(const WebCore::CSSStyleValue& styleValue) { return styleValue.getType() == WebCore::CSSStyleValueType::CSSStyleImageValue; }
+SPECIALIZE_TYPE_TRAITS_END()
+
#endif
Modified: trunk/Source/WebCore/css/typedom/CSSStyleValue.cpp (281785 => 281786)
--- trunk/Source/WebCore/css/typedom/CSSStyleValue.cpp 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/css/typedom/CSSStyleValue.cpp 2021-08-31 01:08:48 UTC (rev 281786)
@@ -32,12 +32,120 @@
#if ENABLE(CSS_TYPED_OM)
+#include "CSSParser.h"
+#include "CSSPropertyParser.h"
+#include "CSSUnitValue.h"
+#include "CSSValueList.h"
#include <wtf/IsoMallocInlines.h>
+#include <wtf/text/StringView.h>
namespace WebCore {
WTF_MAKE_ISO_ALLOCATED_IMPL(CSSStyleValue);
+ExceptionOr<Vector<Ref<CSSStyleValue>>> CSSStyleValue::parseStyleValue(const String& cssProperty, const String& cssText, bool parseMultiple)
+{
+ // https://www.w3.org/TR/css-typed-om-1/#cssstylevalue
+
+ String property;
+ // 1. If property is not a custom property name string, set property to property ASCII lowercased.
+ if (!isCustomPropertyName(property))
+ property = cssProperty.convertToASCIILowercase();
+ else
+ property = cssProperty;
+
+
+ // CSSPropertyID
+ auto propertyID = cssPropertyID(property);
+
+ // 2. If property is not a valid CSS property, throw a TypeError.
+ if (propertyID == CSSPropertyInvalid)
+ return Exception { TypeError, "Property String is not a valid CSS property."_s };
+
+ auto styleDeclaration = MutableStyleProperties::create();
+
+ constexpr bool important = true;
+ auto parseResult = CSSParser::parseValue(styleDeclaration, propertyID, cssText, important, HTMLStandardMode);
+ if (parseResult == CSSParser::ParseResult::Error)
+ return Exception { SyntaxError, makeString(cssText, " cannot be parsed as a ", cssProperty)};
+
+ auto cssValue = styleDeclaration->getPropertyCSSValue(propertyID);
+ if (!cssValue)
+ return Exception { SyntaxError, makeString(cssText, " cannot be parsed as a ", cssProperty)};
+
+ Vector<Ref<CSSStyleValue>> results;
+
+ if (is<CSSValueList>(cssValue.get())) {
+ bool parsedFirst = false;
+ for (auto& currentValue : downcast<CSSValueList>(*cssValue.get())) {
+ if (!parseMultiple && parsedFirst)
+ break;
+ if (auto reifiedValue = CSSStyleValue::reifyValue(propertyID, currentValue.copyRef()))
+ results.append(reifiedValue.releaseNonNull());
+ parsedFirst = true;
+ }
+ } else {
+ auto reifiedValue = CSSStyleValue::reifyValue(propertyID, cssValue.copyRef());
+ if (reifiedValue)
+ results.append(reifiedValue.releaseNonNull());
+ }
+
+ return results;
+}
+
+ExceptionOr<Ref<CSSStyleValue>> CSSStyleValue::parse(const String& property, const String& cssText)
+{
+ constexpr bool parseMultiple = false;
+ auto parseResult = parseStyleValue(property, cssText, parseMultiple);
+ if (parseResult.hasException())
+ return parseResult.releaseException();
+
+ auto returnValue = parseResult.releaseReturnValue();
+
+ // Returned vector should not be empty. If parsing failed, an exception should be returned.
+ if (returnValue.isEmpty())
+ return Exception { SyntaxError, makeString(cssText, " cannot be parsed as a ", property) };
+
+ return WTFMove(returnValue.at(0));
+}
+
+ExceptionOr<Vector<Ref<CSSStyleValue>>> CSSStyleValue::parseAll(const String& property, const String& cssText)
+{
+ constexpr bool parseMultiple = true;
+ return parseStyleValue(property, cssText, parseMultiple);
+}
+
+Ref<CSSStyleValue> CSSStyleValue::create(RefPtr<CSSValue>&& cssValue, String&& property)
+{
+ return adoptRef(*new CSSStyleValue(WTFMove(cssValue), WTFMove(property)));
+}
+
+Ref<CSSStyleValue> CSSStyleValue::create()
+{
+ return adoptRef(*new CSSStyleValue());
+}
+
+CSSStyleValue::CSSStyleValue(RefPtr<CSSValue>&& cssValue, String&& property)
+ : m_customPropertyName(WTFMove(property))
+ , m_propertyValue(WTFMove(cssValue))
+{
+}
+
+// Invokes static constructor of subclasses to reifyValues
+RefPtr<CSSStyleValue> CSSStyleValue::reifyValue(CSSPropertyID, RefPtr<CSSValue>&&)
+{
+ // FIXME: Add Reification control flow. Returns nullptr if failed.
+ return nullptr;
+}
+
+String CSSStyleValue::toString() const
+{
+ if (!m_propertyValue)
+ return emptyString();
+
+ return m_propertyValue->cssText();
+}
+
} // namespace WebCore
#endif
Modified: trunk/Source/WebCore/css/typedom/CSSStyleValue.h (281785 => 281786)
--- trunk/Source/WebCore/css/typedom/CSSStyleValue.h 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/css/typedom/CSSStyleValue.h 2021-08-31 01:08:48 UTC (rev 281786)
@@ -27,6 +27,7 @@
#if ENABLE(CSS_TYPED_OM)
+#include "CSSPropertyNames.h"
#include "ScriptWrappable.h"
#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
@@ -33,18 +34,44 @@
namespace WebCore {
+class CSSValue;
+template<typename T> class ExceptionOr;
+
+enum class CSSStyleValueType : uint8_t {
+ CSSStyleValue,
+ CSSStyleImageValue,
+ CSSTransformValue,
+ CSSNumericValue,
+ CSSMathValue,
+ CSSUnitValue,
+ CSSUnparsedValue,
+ CSSKeywordValue
+};
+
class CSSStyleValue : public RefCounted<CSSStyleValue>, public ScriptWrappable {
WTF_MAKE_ISO_ALLOCATED(CSSStyleValue);
public:
+
+ virtual String toString() const;
virtual ~CSSStyleValue() = default;
- virtual String toString() = 0;
+
+ virtual CSSStyleValueType getType() const { return CSSStyleValueType::CSSStyleValue; }
+
+ static ExceptionOr<Vector<Ref<CSSStyleValue>>> parseStyleValue(const String&, const String&, bool);
+ static ExceptionOr<Ref<CSSStyleValue>> parse(const String&, const String&);
+ static ExceptionOr<Vector<Ref<CSSStyleValue>>> parseAll(const String&, const String&);
+
+ static RefPtr<CSSStyleValue> reifyValue(CSSPropertyID, RefPtr<CSSValue>&&);
+
+ static Ref<CSSStyleValue> create(RefPtr<CSSValue>&&, String&& = String());
+ static Ref<CSSStyleValue> create();
- virtual bool isUnitValue() { return false; }
- virtual bool isUnparsedValue() { return false; }
- virtual bool isImageValue() { return false; }
-
protected:
+ CSSStyleValue(RefPtr<CSSValue>&&, String&& = String());
CSSStyleValue() = default;
+
+ String m_customPropertyName;
+ RefPtr<CSSValue> m_propertyValue;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/css/typedom/CSSStyleValue.idl (281785 => 281786)
--- trunk/Source/WebCore/css/typedom/CSSStyleValue.idl 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/css/typedom/CSSStyleValue.idl 2021-08-31 01:08:48 UTC (rev 281786)
@@ -29,7 +29,9 @@
EnabledAtRuntime=CSSTypedOM,
Conditional=CSS_TYPED_OM,
Exposed=(Window,Worker,PaintWorklet),
- SkipVTableValidation,
+ SkipVTableValidation
] interface CSSStyleValue {
stringifier;
+ [Exposed=Window] static CSSStyleValue parse(USVString property, USVString cssText);
+ [Exposed=Window] static sequence<CSSStyleValue> parseAll(USVString property, USVString cssText);
};
Modified: trunk/Source/WebCore/css/typedom/CSSUnitValue.h (281785 => 281786)
--- trunk/Source/WebCore/css/typedom/CSSUnitValue.h 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/css/typedom/CSSUnitValue.h 2021-08-31 01:08:48 UTC (rev 281786)
@@ -43,7 +43,7 @@
}
// FIXME: not correct.
- String toString() final { return makeString((int) m_value, m_unit); }
+ String toString() const final { return makeString((int) m_value, m_unit); }
double value() const { return m_value; }
void setValue(double value) { m_value = value; }
@@ -57,7 +57,7 @@
{
}
- bool isUnitValue() final { return true; }
+ CSSStyleValueType getType() const final { return CSSStyleValueType::CSSUnitValue; }
double m_value;
String m_unit;
Modified: trunk/Source/WebCore/css/typedom/CSSUnparsedValue.cpp (281785 => 281786)
--- trunk/Source/WebCore/css/typedom/CSSUnparsedValue.cpp 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/css/typedom/CSSUnparsedValue.cpp 2021-08-31 01:08:48 UTC (rev 281786)
@@ -32,12 +32,61 @@
#if ENABLE(CSS_TYPED_OM)
+#include "CSSOMVariableReferenceValue.h"
+#include "ExceptionOr.h"
#include <wtf/IsoMallocInlines.h>
+#include <wtf/Variant.h>
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/WTFString.h>
namespace WebCore {
WTF_MAKE_ISO_ALLOCATED_IMPL(CSSUnparsedValue);
+Ref<CSSUnparsedValue> CSSUnparsedValue::create(Vector<CSSUnparsedSegment>&& segments)
+{
+ return adoptRef(*new CSSUnparsedValue(WTFMove(segments)));
+}
+
+CSSUnparsedValue::CSSUnparsedValue(Vector<CSSUnparsedSegment>&& segments)
+ : m_segments(WTFMove(segments))
+{
+}
+
+String CSSUnparsedValue::toString() const
+{
+ StringBuilder builder;
+ serialize(builder);
+
+ return builder.toString();
+}
+
+void CSSUnparsedValue::serialize(StringBuilder& builder) const
+{
+ for (auto& segment : m_segments) {
+ WTF::visit(WTF::makeVisitor([&] (const String& value) {
+ builder.append(value);
+ }, [&] (const RefPtr<CSSOMVariableReferenceValue>& value) {
+ builder.append(value->toString());
+ }), segment);
+ }
+}
+
+ExceptionOr<CSSUnparsedSegment> CSSUnparsedValue::item(size_t index)
+{
+ if (index >= m_segments.size())
+ return Exception { RangeError, makeString("Index ", index, " exceeds index range for unparsed segments.") };
+ return CSSUnparsedSegment { m_segments[index] };
+}
+
+ExceptionOr<CSSUnparsedSegment> CSSUnparsedValue::setItem(size_t index, CSSUnparsedSegment&& val)
+{
+ if (index >= m_segments.size())
+ return Exception { RangeError, makeString("Index ", index, " exceeds index range for unparsed segments.") };
+ m_segments[index] = WTFMove(val);
+ return CSSUnparsedSegment { m_segments[index] };
+}
+
} // namespace WebCore
#endif
Modified: trunk/Source/WebCore/css/typedom/CSSUnparsedValue.h (281785 => 281786)
--- trunk/Source/WebCore/css/typedom/CSSUnparsedValue.h 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/css/typedom/CSSUnparsedValue.h 2021-08-31 01:08:48 UTC (rev 281786)
@@ -33,27 +33,33 @@
namespace WebCore {
+template<typename> class ExceptionOr;
+class CSSOMVariableReferenceValue;
+using CSSUnparsedSegment = Variant<String, RefPtr<CSSOMVariableReferenceValue>>;
+
class CSSUnparsedValue final : public CSSStyleValue {
WTF_MAKE_ISO_ALLOCATED(CSSUnparsedValue);
public:
- static Ref<CSSUnparsedValue> create(const String& serializedValue)
- {
- return adoptRef(*new CSSUnparsedValue(serializedValue));
- }
+ static Ref<CSSUnparsedValue> create(Vector<CSSUnparsedSegment>&&);
+
+ size_t length() const { return m_segments.size(); }
+ ExceptionOr<CSSUnparsedSegment> item(size_t);
+ ExceptionOr<CSSUnparsedSegment> setItem(size_t, CSSUnparsedSegment&&);
- String toString() final { return m_serializedValue; }
+ CSSStyleValueType getType() const final { return CSSStyleValueType::CSSUnparsedValue; }
+ String toString() const;
private:
- explicit CSSUnparsedValue(const String& serializedValue)
- : m_serializedValue(serializedValue)
- {
- }
-
- bool isUnparsedValue() final { return true; }
-
- String m_serializedValue;
+ explicit CSSUnparsedValue(Vector<CSSUnparsedSegment>&& segments);
+ void serialize(StringBuilder&) const;
+
+ Vector<CSSUnparsedSegment> m_segments;
};
} // namespace WebCore
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::CSSUnparsedValue)
+ static bool isType(const WebCore::CSSStyleValue& styleValue) { return styleValue.getType() == WebCore::CSSStyleValueType::CSSUnparsedValue; }
+SPECIALIZE_TYPE_TRAITS_END()
+
#endif
Modified: trunk/Source/WebCore/css/typedom/CSSUnparsedValue.idl (281785 => 281786)
--- trunk/Source/WebCore/css/typedom/CSSUnparsedValue.idl 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/css/typedom/CSSUnparsedValue.idl 2021-08-31 01:08:48 UTC (rev 281786)
@@ -23,12 +23,19 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// FIXME: wrong constructor.
+typedef (USVString or CSSOMVariableReferenceValue) CSSUnparsedSegment;
+
[
InterfaceName=CSSUnparsedValue,
EnabledAtRuntime=CSSTypedOM,
Conditional=CSS_TYPED_OM,
Exposed=(Window,Worker,PaintWorklet),
+ JSGenerateToNativeObject
] interface CSSUnparsedValue : CSSStyleValue {
- constructor(USVString serializedValue);
+ constructor(sequence<CSSUnparsedSegment> members);
+
+ iterable<CSSUnparsedSegment>;
+ readonly attribute unsigned long length;
+ getter CSSUnparsedSegment (unsigned long index);
+ setter CSSUnparsedSegment (unsigned long index, CSSUnparsedSegment val);
};
Modified: trunk/Source/WebCore/css/typedom/StylePropertyMapReadOnly.cpp (281785 => 281786)
--- trunk/Source/WebCore/css/typedom/StylePropertyMapReadOnly.cpp 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/css/typedom/StylePropertyMapReadOnly.cpp 2021-08-31 01:08:48 UTC (rev 281786)
@@ -55,8 +55,7 @@
if (is<CSSImageValue>(*value))
return CSSStyleImageValue::create(downcast<CSSImageValue>(*value), document);
- // FIXME: should use raw CSSStyleValue
- return CSSUnparsedValue::create(value->cssText());
+ return CSSStyleValue::create(makeRefPtr(value));
}
RefPtr<CSSStyleValue> StylePropertyMapReadOnly::customPropertyValueOrDefault(const String& name, Document& document, CSSValue* inputValue, Element* element)
@@ -69,7 +68,7 @@
return StylePropertyMapReadOnly::reifyValue(value.get(), document, element);
}
- return CSSUnparsedValue::create(emptyString());
+ return CSSStyleValue::create();
}
return StylePropertyMapReadOnly::reifyValue(inputValue, document, element);
Modified: trunk/Source/WebCore/css/typedom/StylePropertyMapReadOnly.h (281785 => 281786)
--- trunk/Source/WebCore/css/typedom/StylePropertyMapReadOnly.h 2021-08-30 23:36:42 UTC (rev 281785)
+++ trunk/Source/WebCore/css/typedom/StylePropertyMapReadOnly.h 2021-08-31 01:08:48 UTC (rev 281786)
@@ -27,12 +27,12 @@
#if ENABLE(CSS_TYPED_OM)
+#include "CSSValue.h"
#include <wtf/RefCounted.h>
#include <wtf/UniqueRef.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
-class CSSValue;
class Document;
class Element;
class StyledElement;