Title: [294002] trunk
Revision
294002
Author
obru...@igalia.com
Date
2022-05-09 23:52:20 -0700 (Mon, 09 May 2022)

Log Message

[cssom] Don't index perspective/transform-origin-* in computed styles
https://bugs.webkit.org/show_bug.cgi?id=239670

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Update some test expectations.

Add serialize-all-longhands.html, it still fails due to
https://webkit.org/b/239965 and https://webkit.org/b/239989.

* web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt:
* web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
* web-platform-tests/css/cssom/serialize-all-longhands-expected.txt: Added.
* web-platform-tests/css/cssom/serialize-all-longhands.html: Added.

Source/WebCore:

'perspective-origin' and 'transform-origin' are shorthands in WebKit.
The longhands are 'perspective-origin-x/y' and 'transform-origin-x/y/z'.
But these aren't standard properties, so they serialize to empty string
in computed styles. However, they were still indexed.

This patch stops indexing these longhands, so they won't appear when
iterating a computed style. Also, the shorthands will now be indexed.

Test: fast/css/getComputedStyle/computed-style.html
      fast/css/getComputedStyle/computed-style-without-renderer.html
      imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml.html
      imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer.html
      imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree.html
      imported/w3c/web-platform-tests/css/cssom/serialize-all-longhands.html
      svg/css/getComputedStyle-basic.xhtml

* css/CSSProperties.json:
Add "computable" flag.

* css/makeprop.pl:
(skippedFromComputedStyle):
(addProperty):
Let "computable" flag override default logic for indexing or not in
computed styles.

Tools:

Add checker for new "computable" flag.

* Scripts/webkitpy/style/checkers/jsonchecker.py:
(JSONCSSPropertiesChecker.check_codegen_properties):

LayoutTests:

Update test expectations.

* fast/css/getComputedStyle/computed-style-expected.txt:
* fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* platform/gtk/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
* platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
* platform/mac-wk1/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt:
* platform/wpe/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* platform/wpe/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
* svg/css/getComputedStyle-basic-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (294001 => 294002)


--- trunk/LayoutTests/ChangeLog	2022-05-10 06:48:49 UTC (rev 294001)
+++ trunk/LayoutTests/ChangeLog	2022-05-10 06:52:20 UTC (rev 294002)
@@ -1,3 +1,22 @@
+2022-05-09  Oriol Brufau  <obru...@igalia.com>
+
+        [cssom] Don't index perspective/transform-origin-* in computed styles
+        https://bugs.webkit.org/show_bug.cgi?id=239670
+
+        Reviewed by Darin Adler.
+
+        Update test expectations.
+
+        * fast/css/getComputedStyle/computed-style-expected.txt:
+        * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+        * platform/gtk/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
+        * platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
+        * platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
+        * platform/mac-wk1/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt:
+        * platform/wpe/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
+        * platform/wpe/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
+        * svg/css/getComputedStyle-basic-expected.txt:
+
 2022-05-09  Nikolaos Mouchtaris  <nmouchta...@apple.com>
 
         Support ray() shape in offset-path

Modified: trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt (294001 => 294002)


--- trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt	2022-05-10 06:48:49 UTC (rev 294001)
+++ trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt	2022-05-10 06:52:20 UTC (rev 294002)
@@ -149,6 +149,7 @@
 page-break-inside: auto;
 paint-order: normal;
 perspective: none;
+perspective-origin: 392px 288px;
 pointer-events: auto;
 position: static;
 print-color-adjust: economy;
@@ -187,6 +188,7 @@
 text-transform: none;
 top: auto;
 transform: none;
+transform-origin: 392px 288px;
 transform-style: flat;
 transition-delay: 0s;
 transition-duration: 0s;

Modified: trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt (294001 => 294002)


--- trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt	2022-05-10 06:48:49 UTC (rev 294001)
+++ trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt	2022-05-10 06:52:20 UTC (rev 294002)
@@ -148,6 +148,7 @@
 page-break-inside: auto
 paint-order: normal
 perspective: none
+perspective-origin: 50% 50%
 pointer-events: auto
 position: static
 print-color-adjust: economy
@@ -186,6 +187,7 @@
 text-transform: none
 top: auto
 transform: none
+transform-origin: 50% 50%
 transform-style: flat
 transition-delay: 0s
 transition-duration: 0s

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (294001 => 294002)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-05-10 06:48:49 UTC (rev 294001)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-05-10 06:52:20 UTC (rev 294002)
@@ -1,3 +1,21 @@
+2022-05-09  Oriol Brufau  <obru...@igalia.com>
+
+        [cssom] Don't index perspective/transform-origin-* in computed styles
+        https://bugs.webkit.org/show_bug.cgi?id=239670
+
+        Reviewed by Darin Adler.
+
+        Update some test expectations.
+
+        Add serialize-all-longhands.html, it still fails due to
+        https://webkit.org/b/239965 and https://webkit.org/b/239989.
+
+        * web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
+        * web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt:
+        * web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
+        * web-platform-tests/css/cssom/serialize-all-longhands-expected.txt: Added.
+        * web-platform-tests/css/cssom/serialize-all-longhands.html: Added.
+
 2022-05-09  Tim Nguyen  <n...@apple.com>
 
         Implement CSS :modal pseudo class

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt (294001 => 294002)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2022-05-10 06:48:49 UTC (rev 294001)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2022-05-10 06:52:20 UTC (rev 294002)
@@ -239,8 +239,7 @@
 PASS page-break-inside
 PASS paint-order
 PASS perspective
-PASS perspective-origin-x
-PASS perspective-origin-y
+PASS perspective-origin
 PASS pointer-events
 PASS position
 PASS print-color-adjust
@@ -317,9 +316,7 @@
 PASS touch-action
 PASS transform
 PASS transform-box
-PASS transform-origin-x
-PASS transform-origin-y
-PASS transform-origin-z
+PASS transform-origin
 PASS transform-style
 PASS transition-delay
 PASS transition-duration

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt (294001 => 294002)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt	2022-05-10 06:48:49 UTC (rev 294001)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt	2022-05-10 06:52:20 UTC (rev 294002)
@@ -236,8 +236,7 @@
 PASS page-break-inside
 PASS paint-order
 PASS perspective
-FAIL perspective-origin-x assert_not_equals: Should have the initial value. got disallowed value ""
-FAIL perspective-origin-y assert_not_equals: Should have the initial value. got disallowed value ""
+PASS perspective-origin
 PASS pointer-events
 PASS position
 PASS print-color-adjust
@@ -313,9 +312,7 @@
 PASS touch-action
 PASS transform
 PASS transform-box
-FAIL transform-origin-x assert_not_equals: Should have the initial value. got disallowed value ""
-FAIL transform-origin-y assert_not_equals: Should have the initial value. got disallowed value ""
-FAIL transform-origin-z assert_not_equals: Should have the initial value. got disallowed value ""
+PASS transform-origin
 PASS transform-style
 PASS transition-delay
 PASS transition-duration

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt (294001 => 294002)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-05-10 06:48:49 UTC (rev 294001)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-05-10 06:52:20 UTC (rev 294002)
@@ -1,8 +1,8 @@
 
 PASS getComputedStyle returns no style for detached element
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 403
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 403
-FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 403
-FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 403
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 400
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 400
+FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 400
+FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 400
 PASS getComputedStyle returns no style for shadow tree outside of flattened tree
 

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-all-longhands-expected.txt (0 => 294002)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-all-longhands-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-all-longhands-expected.txt	2022-05-10 06:52:20 UTC (rev 294002)
@@ -0,0 +1,4 @@
+
+PASS Specified style
+FAIL Computed style assert_array_equals: lengths differ, expected array [] length 0, got ["size", "-webkit-text-combine"] length 2
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-all-longhands.html (0 => 294002)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-all-longhands.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-all-longhands.html	2022-05-10 06:52:20 UTC (rev 294002)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Serialize all longhands</title>
+<link rel="author" title="Oriol Brufau" href="" />
+<link rel="help" href=""
+<meta name="assert" content="Checks that all longhands indexed in a CSSStyleDeclaration can be serialized to a non-empty string when set to their initial value.">
+
+<div id="target"></div>
+
+<script src=""
+<script src=""
+<script>
+function nonSerializableProperties(style) {
+  const result = [];
+  assert_greater_than(style.length, 0, "Should have longhands");
+  for (let property of style) {
+    if (!style.getPropertyValue(property)) {
+      result.push(property);
+    }
+  }
+  return result;
+}
+
+const target = document.getElementById("target");
+target.style.cssText = "all: initial; direction: initial; unicode-bidi: initial;";
+
+test(function() {
+  const props = nonSerializableProperties(target.style);
+  assert_array_equals(props, []);
+}, "Specified style");
+
+test(function() {
+  const props = nonSerializableProperties(getComputedStyle(target));
+  assert_array_equals(props, []);
+}, "Computed style");
+</script>

Modified: trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt (294001 => 294002)


--- trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2022-05-10 06:48:49 UTC (rev 294001)
+++ trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2022-05-10 06:52:20 UTC (rev 294002)
@@ -239,8 +239,7 @@
 PASS page-break-inside
 PASS paint-order
 PASS perspective
-PASS perspective-origin-x
-PASS perspective-origin-y
+PASS perspective-origin
 PASS pointer-events
 PASS position
 PASS print-color-adjust
@@ -317,9 +316,7 @@
 PASS touch-action
 PASS transform
 PASS transform-box
-PASS transform-origin-x
-PASS transform-origin-y
-PASS transform-origin-z
+PASS transform-origin
 PASS transform-style
 PASS transition-delay
 PASS transition-duration

Modified: trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt (294001 => 294002)


--- trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-05-10 06:48:49 UTC (rev 294001)
+++ trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-05-10 06:52:20 UTC (rev 294002)
@@ -1,8 +1,8 @@
 
 PASS getComputedStyle returns no style for detached element
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 401
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 401
-FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 401
-FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 401
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 398
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 398
+FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 398
+FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 398
 PASS getComputedStyle returns no style for shadow tree outside of flattened tree
 

Modified: trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt (294001 => 294002)


--- trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-05-10 06:48:49 UTC (rev 294001)
+++ trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-05-10 06:52:20 UTC (rev 294002)
@@ -1,8 +1,8 @@
 
 PASS getComputedStyle returns no style for detached element
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 405
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 405
-FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 405
-FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 405
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 402
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 402
+FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 402
+FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 402
 PASS getComputedStyle returns no style for shadow tree outside of flattened tree
 

Modified: trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt (294001 => 294002)


--- trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt	2022-05-10 06:48:49 UTC (rev 294001)
+++ trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer-expected.txt	2022-05-10 06:52:20 UTC (rev 294002)
@@ -236,8 +236,7 @@
 PASS page-break-inside
 PASS paint-order
 PASS perspective
-FAIL perspective-origin-x assert_not_equals: Should have the initial value. got disallowed value ""
-FAIL perspective-origin-y assert_not_equals: Should have the initial value. got disallowed value ""
+PASS perspective-origin
 PASS pointer-events
 PASS position
 PASS print-color-adjust
@@ -312,9 +311,7 @@
 PASS touch-action
 PASS transform
 PASS transform-box
-FAIL transform-origin-x assert_not_equals: Should have the initial value. got disallowed value ""
-FAIL transform-origin-y assert_not_equals: Should have the initial value. got disallowed value ""
-FAIL transform-origin-z assert_not_equals: Should have the initial value. got disallowed value ""
+PASS transform-origin
 PASS transform-style
 PASS transition-delay
 PASS transition-duration

Modified: trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt (294001 => 294002)


--- trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2022-05-10 06:48:49 UTC (rev 294001)
+++ trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2022-05-10 06:52:20 UTC (rev 294002)
@@ -239,8 +239,7 @@
 PASS page-break-inside
 PASS paint-order
 PASS perspective
-PASS perspective-origin-x
-PASS perspective-origin-y
+PASS perspective-origin
 PASS pointer-events
 PASS position
 PASS print-color-adjust
@@ -317,9 +316,7 @@
 PASS touch-action
 PASS transform
 PASS transform-box
-PASS transform-origin-x
-PASS transform-origin-y
-PASS transform-origin-z
+PASS transform-origin
 PASS transform-style
 PASS transition-delay
 PASS transition-duration

Modified: trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt (294001 => 294002)


--- trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-05-10 06:48:49 UTC (rev 294001)
+++ trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt	2022-05-10 06:52:20 UTC (rev 294002)
@@ -1,8 +1,8 @@
 
 PASS getComputedStyle returns no style for detached element
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 400
-FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 400
-FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 400
-FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 400
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) assert_equals: expected 0 but got 397
+FAIL getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window assert_equals: expected 0 but got 397
+FAIL getComputedStyle returns no style for element outside the flat tree assert_equals: expected 0 but got 397
+FAIL getComputedStyle returns no style for descendant outside the flat tree assert_equals: expected 0 but got 397
 PASS getComputedStyle returns no style for shadow tree outside of flattened tree
 

Modified: trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt (294001 => 294002)


--- trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt	2022-05-10 06:48:49 UTC (rev 294001)
+++ trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt	2022-05-10 06:52:20 UTC (rev 294002)
@@ -296,6 +296,8 @@
 rect: style.getPropertyCSSValue(paint-order) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(perspective) : none
 rect: style.getPropertyCSSValue(perspective) : [object CSSPrimitiveValue]
+rect: style.getPropertyValue(perspective-origin) : 150px 75px
+rect: style.getPropertyCSSValue(perspective-origin) : [object CSSValueList]
 rect: style.getPropertyValue(pointer-events) : auto
 rect: style.getPropertyCSSValue(pointer-events) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(position) : static
@@ -372,6 +374,8 @@
 rect: style.getPropertyCSSValue(top) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(transform) : none
 rect: style.getPropertyCSSValue(transform) : [object CSSPrimitiveValue]
+rect: style.getPropertyValue(transform-origin) : 0px 0px
+rect: style.getPropertyCSSValue(transform-origin) : [object CSSValueList]
 rect: style.getPropertyValue(transform-style) : flat
 rect: style.getPropertyCSSValue(transform-style) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(transition-delay) : 0s
@@ -806,6 +810,8 @@
 g: style.getPropertyCSSValue(paint-order) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(perspective) : none
 g: style.getPropertyCSSValue(perspective) : [object CSSPrimitiveValue]
+g: style.getPropertyValue(perspective-origin) : 150px 75px
+g: style.getPropertyCSSValue(perspective-origin) : [object CSSValueList]
 g: style.getPropertyValue(pointer-events) : auto
 g: style.getPropertyCSSValue(pointer-events) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(position) : static
@@ -882,6 +888,8 @@
 g: style.getPropertyCSSValue(top) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(transform) : none
 g: style.getPropertyCSSValue(transform) : [object CSSPrimitiveValue]
+g: style.getPropertyValue(transform-origin) : 0px 0px
+g: style.getPropertyCSSValue(transform-origin) : [object CSSValueList]
 g: style.getPropertyValue(transform-style) : flat
 g: style.getPropertyCSSValue(transform-style) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(transition-delay) : 0s

Modified: trunk/Source/WebCore/ChangeLog (294001 => 294002)


--- trunk/Source/WebCore/ChangeLog	2022-05-10 06:48:49 UTC (rev 294001)
+++ trunk/Source/WebCore/ChangeLog	2022-05-10 06:52:20 UTC (rev 294002)
@@ -1,3 +1,35 @@
+2022-05-09  Oriol Brufau  <obru...@igalia.com>
+
+        [cssom] Don't index perspective/transform-origin-* in computed styles
+        https://bugs.webkit.org/show_bug.cgi?id=239670
+
+        Reviewed by Darin Adler.
+
+        'perspective-origin' and 'transform-origin' are shorthands in WebKit.
+        The longhands are 'perspective-origin-x/y' and 'transform-origin-x/y/z'.
+        But these aren't standard properties, so they serialize to empty string
+        in computed styles. However, they were still indexed.
+
+        This patch stops indexing these longhands, so they won't appear when
+        iterating a computed style. Also, the shorthands will now be indexed.
+
+        Test: fast/css/getComputedStyle/computed-style.html
+              fast/css/getComputedStyle/computed-style-without-renderer.html
+              imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml.html
+              imported/w3c/web-platform-tests/css/css-cascade/all-prop-revert-layer.html
+              imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree.html
+              imported/w3c/web-platform-tests/css/cssom/serialize-all-longhands.html
+              svg/css/getComputedStyle-basic.xhtml
+
+        * css/CSSProperties.json:
+        Add "computable" flag.
+
+        * css/makeprop.pl:
+        (skippedFromComputedStyle):
+        (addProperty):
+        Let "computable" flag override default logic for indexing or not in
+        computed styles.
+
 2022-05-09  Nikolaos Mouchtaris  <nmouchta...@apple.com>
 
         Support ray() shape in offset-path

Modified: trunk/Source/WebCore/css/CSSProperties.json (294001 => 294002)


--- trunk/Source/WebCore/css/CSSProperties.json	2022-05-10 06:48:49 UTC (rev 294001)
+++ trunk/Source/WebCore/css/CSSProperties.json	2022-05-10 06:52:20 UTC (rev 294002)
@@ -176,6 +176,14 @@
         "The name of the flag on Settings (e.g. \"CSSOMViewSmoothScrolling\")",
         "that conditionally enables the property.",
         "",
+        "* computable:",
+        "Whether the property should be indexed on computed styles.",
+        "If omitted, the property will be computable by default,",
+        "except if it has \"skip-builder\" and is not logical,",
+        "or if it's a shorthand with multiple indexed longhands.",
+        "Internal properties (\"internal-only\") are never computable,",
+        "and setting this flag to true is an error.",
+        "",
         "2. Lesser known capabilities of this file format",
         "",
         "Conditional CSS keyword value:",
@@ -886,6 +894,7 @@
         },
         "all": {
             "codegen-properties": {
+                "computable": false,
                 "longhands": [
                     "all"
                 ]
@@ -6720,6 +6729,7 @@
                 "aliases": [
                     "-webkit-perspective-origin-x"
                 ],
+                "computable": false,
                 "converter": "PositionComponentX"
             },
             "specification": {
@@ -6732,6 +6742,7 @@
                 "aliases": [
                     "-webkit-perspective-origin-y"
                 ],
+                "computable": false,
                 "converter": "PositionComponentY"
             },
             "specification": {
@@ -7192,6 +7203,7 @@
                 "aliases": [
                     "-webkit-transform-origin-x"
                 ],
+                "computable": false,
                 "converter": "PositionComponentX"
             },
             "specification": {
@@ -7204,6 +7216,7 @@
                 "aliases": [
                     "-webkit-transform-origin-y"
                 ],
+                "computable": false,
                 "converter": "PositionComponentY"
             },
             "specification": {
@@ -7216,6 +7229,7 @@
                 "aliases": [
                     "-webkit-transform-origin-z"
                 ],
+                "computable": false,
                 "converter": "ComputedLength<float>"
             },
             "specification": {

Modified: trunk/Source/WebCore/css/makeprop.pl (294001 => 294002)


--- trunk/Source/WebCore/css/makeprop.pl	2022-05-10 06:48:49 UTC (rev 294001)
+++ trunk/Source/WebCore/css/makeprop.pl	2022-05-10 06:52:20 UTC (rev 294002)
@@ -61,7 +61,7 @@
 my %defines = map { $_ => 1 } split(/ /, $defines);
 
 my @names;
-my @internalProprerties;
+my @internalProperties;
 my %runtimeFlags;
 my %settingsFlags;
 my $numPredefinedProperties = 2;
@@ -94,6 +94,7 @@
 my %styleBuilderOptions = (
     "animatable" => 1, # Defined in Source/WebCore/style/StyleBuilderConverter.h
     "auto-functions" => 1,
+    "computable" => 1,
     "conditional-converter" => 1,
     "converter" => 1,
     "custom" => 1,
@@ -198,28 +199,23 @@
 sub skippedFromComputedStyle
 {
   my $name = shift;
+  my $options = $propertiesWithStyleBuilderOptions{$name};
 
-  if (exists($propertiesWithStyleBuilderOptions{$name}{"skip-builder"}) and not isLogical($name)) {
+  if (grep { $_ eq $name } @internalProperties) {
+    die "$name can't be computable since it's internal" if $options->{"computable"};
     return 1;
   }
 
-  if (grep { $_ eq $name } @internalProprerties) {
-    return 1;
-  }
+  return !$options->{"computable"} if exists($options->{"computable"});
 
-  # For convenience, "all" is not defined with the full list of longhands.
-  # Its only listed longhand is itself, so it wouldn't match the condition below.
-  # Then we have to handle it especially.
-  return 1 if $name eq "all";
+  return 1 if exists($options->{"skip-builder"}) and not isLogical($name);
 
-  if (exists($propertiesWithStyleBuilderOptions{$name}{"longhands"})) {
-    my @longhands = @{$propertiesWithStyleBuilderOptions{$name}{"longhands"}};
+  if (exists($options->{"longhands"})) {
+    my @longhands = @{$options->{"longhands"}};
     if (scalar @longhands != 1) {
       # Skip properties if they have a non-internal longhand property.
       foreach my $longhand (@longhands) {
-        if (!skippedFromComputedStyle($longhand)) {
-          return 1;
-        }
+        return 1 if !skippedFromComputedStyle($longhand);
       }
     }
   }
@@ -312,7 +308,7 @@
                     $propertiesWithStyleBuilderOptions{$name}{$codegenOptionName} = $codegenProperties->{$codegenOptionName};
                 } elsif ($codegenOptionName eq "internal-only") {
                     # internal-only properties exist to make it easier to parse compound properties (e.g. background-repeat) as if they were shorthands.
-                    push @internalProprerties, $name
+                    push @internalProperties, $name
                 } elsif ($codegenOptionName eq "runtime-flag") {
                     $runtimeFlags{$name} = $codegenProperties->{"runtime-flag"};
                 } elsif ($codegenOptionName eq "settings-flag") {
@@ -484,7 +480,7 @@
     switch (id) {
 EOF
 
-foreach my $name (sort @internalProprerties) {
+foreach my $name (sort @internalProperties) {
   print GPERF "    case CSSPropertyID::CSSProperty" . $nameToId{$name} . ":\n";
 }
 
@@ -1732,7 +1728,7 @@
 
 my %namesAndAliasesToName;
 foreach my $name (@names) {
-    if (grep { $_ eq $name } @internalProprerties) {
+    if (grep { $_ eq $name } @internalProperties) {
         next;
     }
     $namesAndAliasesToName{$name} = $name;

Modified: trunk/Tools/ChangeLog (294001 => 294002)


--- trunk/Tools/ChangeLog	2022-05-10 06:48:49 UTC (rev 294001)
+++ trunk/Tools/ChangeLog	2022-05-10 06:52:20 UTC (rev 294002)
@@ -1,3 +1,15 @@
+2022-05-09  Oriol Brufau  <obru...@igalia.com>
+
+        [cssom] Don't index perspective/transform-origin-* in computed styles
+        https://bugs.webkit.org/show_bug.cgi?id=239670
+
+        Reviewed by Darin Adler.
+
+        Add checker for new "computable" flag.
+
+        * Scripts/webkitpy/style/checkers/jsonchecker.py:
+        (JSONCSSPropertiesChecker.check_codegen_properties):
+
 2022-05-09  Jonathan Bedard  <jbed...@apple.com>
 
         [git-webkit] Verify forks after creation

Modified: trunk/Tools/Scripts/webkitpy/style/checkers/jsonchecker.py (294001 => 294002)


--- trunk/Tools/Scripts/webkitpy/style/checkers/jsonchecker.py	2022-05-10 06:48:49 UTC (rev 294001)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/jsonchecker.py	2022-05-10 06:52:20 UTC (rev 294002)
@@ -285,6 +285,7 @@
             'auto-functions': self.validate_boolean,
             'color-property': self.validate_boolean,
             'comment': self.validate_string,
+            'computable': self.validate_boolean,
             'conditional-converter': self.validate_string,
             'converter': self.validate_string,
             'custom': self.validate_string,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to