Title: [275351] trunk
Revision
275351
Author
[email protected]
Date
2021-04-01 03:26:37 -0700 (Thu, 01 Apr 2021)

Log Message

Use Element for checking Settings in CSSComputedStyleDeclaration
https://bugs.webkit.org/show_bug.cgi?id=223598

Patch by Rob Buis <[email protected]> on 2021-04-01
Reviewed by Darin Adler.

Source/WebCore:

Use Element for checking Settings in CSSComputedStyleDeclaration.
Right now renderer is used but this will not work for non-rendered elements.

Tests: fast/css/rotate-invalidate-if-disabled.html
       fast/css/scale-invalidate-if-disabled.html
       fast/css/translate-invalidate-if-disabled.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):

LayoutTests:

Adapt tests to verify that non-rendered elements do not expose
contain/aspect-ratio when these features are disabled.
Add tests for rotate, scale and translate as well.

* fast/css/aspect-ratio-invalidate-if-disabled-expected.txt:
* fast/css/aspect-ratio-invalidate-if-disabled.html:
* fast/css/contain-invalidate-if-disabled-expected.txt:
* fast/css/contain-invalidate-if-disabled.html:
* fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt:
* fast/css/overscroll-behavior-invalidate-if-disabled.html:
* fast/css/rotate-invalidate-if-disabled-expected.txt: Added.
* fast/css/rotate-invalidate-if-disabled.html: Added.
* fast/css/scale-invalidate-if-disabled-expected.txt: Added.
* fast/css/scale-invalidate-if-disabled.html: Added.
* fast/css/translate-invalidate-if-disabled-expected.txt: Added.
* fast/css/translate-invalidate-if-disabled.html: Added.
* platform/win/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (275350 => 275351)


--- trunk/LayoutTests/ChangeLog	2021-04-01 10:07:20 UTC (rev 275350)
+++ trunk/LayoutTests/ChangeLog	2021-04-01 10:26:37 UTC (rev 275351)
@@ -1,3 +1,28 @@
+2021-04-01  Rob Buis  <[email protected]>
+
+        Use Element for checking Settings in CSSComputedStyleDeclaration
+        https://bugs.webkit.org/show_bug.cgi?id=223598
+
+        Reviewed by Darin Adler.
+
+        Adapt tests to verify that non-rendered elements do not expose
+        contain/aspect-ratio when these features are disabled.
+        Add tests for rotate, scale and translate as well.
+
+        * fast/css/aspect-ratio-invalidate-if-disabled-expected.txt:
+        * fast/css/aspect-ratio-invalidate-if-disabled.html:
+        * fast/css/contain-invalidate-if-disabled-expected.txt:
+        * fast/css/contain-invalidate-if-disabled.html:
+        * fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt:
+        * fast/css/overscroll-behavior-invalidate-if-disabled.html:
+        * fast/css/rotate-invalidate-if-disabled-expected.txt: Added.
+        * fast/css/rotate-invalidate-if-disabled.html: Added.
+        * fast/css/scale-invalidate-if-disabled-expected.txt: Added.
+        * fast/css/scale-invalidate-if-disabled.html: Added.
+        * fast/css/translate-invalidate-if-disabled-expected.txt: Added.
+        * fast/css/translate-invalidate-if-disabled.html: Added.
+        * platform/win/TestExpectations:
+
 2021-03-31  Robert Jenner  <[email protected]>
 
         [ Debug wk2 ] ASSERTION FAILED: willBeComposited == needsToBeComposited(layer, queryData)

Modified: trunk/LayoutTests/fast/css/aspect-ratio-invalidate-if-disabled-expected.txt (275350 => 275351)


--- trunk/LayoutTests/fast/css/aspect-ratio-invalidate-if-disabled-expected.txt	2021-04-01 10:07:20 UTC (rev 275350)
+++ trunk/LayoutTests/fast/css/aspect-ratio-invalidate-if-disabled-expected.txt	2021-04-01 10:26:37 UTC (rev 275351)
@@ -5,6 +5,7 @@
 
 PASS 'aspectRatio' in document.documentElement.style is false
 PASS 'aspect-ratio' in getComputedStyle(document.documentElement) is false
+PASS getComputedStyle(document.getElementById('target')).getPropertyValue('aspect-ratio') == '' is true
 PASS CSS.supports('aspect-ratio: 1 / 1') is false
 PASS CSS.supports('aspect-ratio: inherit') is false
 PASS successfullyParsed is true

Modified: trunk/LayoutTests/fast/css/aspect-ratio-invalidate-if-disabled.html (275350 => 275351)


--- trunk/LayoutTests/fast/css/aspect-ratio-invalidate-if-disabled.html	2021-04-01 10:07:20 UTC (rev 275350)
+++ trunk/LayoutTests/fast/css/aspect-ratio-invalidate-if-disabled.html	2021-04-01 10:26:37 UTC (rev 275351)
@@ -5,11 +5,13 @@
 <script src=""
 </head>
 <body>
+<div id="target" style="display: none"></div>
 <script>
 description("Tests that aspect-ratio is not exposed when the feature is disabled");
 
 shouldBeFalse("'aspectRatio' in document.documentElement.style");
 shouldBeFalse("'aspect-ratio' in getComputedStyle(document.documentElement)");
+shouldBeTrue("getComputedStyle(document.getElementById('target')).getPropertyValue('aspect-ratio') == ''");
 shouldBeFalse("CSS.supports('aspect-ratio: 1 / 1')");
 shouldBeFalse("CSS.supports('aspect-ratio: inherit')");
 

Modified: trunk/LayoutTests/fast/css/contain-invalidate-if-disabled-expected.txt (275350 => 275351)


--- trunk/LayoutTests/fast/css/contain-invalidate-if-disabled-expected.txt	2021-04-01 10:07:20 UTC (rev 275350)
+++ trunk/LayoutTests/fast/css/contain-invalidate-if-disabled-expected.txt	2021-04-01 10:26:37 UTC (rev 275351)
@@ -5,6 +5,7 @@
 
 PASS 'contain' in document.documentElement.style is false
 PASS 'contain' in getComputedStyle(document.documentElement) is false
+PASS getComputedStyle(document.getElementById('target')).getPropertyValue('contain') == '' is true
 PASS CSS.supports('contain: paint') is false
 PASS CSS.supports('contain: inherit') is false
 PASS successfullyParsed is true

Modified: trunk/LayoutTests/fast/css/contain-invalidate-if-disabled.html (275350 => 275351)


--- trunk/LayoutTests/fast/css/contain-invalidate-if-disabled.html	2021-04-01 10:07:20 UTC (rev 275350)
+++ trunk/LayoutTests/fast/css/contain-invalidate-if-disabled.html	2021-04-01 10:26:37 UTC (rev 275351)
@@ -5,11 +5,13 @@
 <script src=""
 </head>
 <body>
+<div id="target" style="display: none"></div>
 <script>
 description("Tests that contain is not exposed when the feature is disabled");
 
 shouldBeFalse("'contain' in document.documentElement.style");
 shouldBeFalse("'contain' in getComputedStyle(document.documentElement)");
+shouldBeTrue("getComputedStyle(document.getElementById('target')).getPropertyValue('contain') == ''");
 shouldBeFalse("CSS.supports('contain: paint')");
 shouldBeFalse("CSS.supports('contain: inherit')");
 

Modified: trunk/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt (275350 => 275351)


--- trunk/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt	2021-04-01 10:07:20 UTC (rev 275350)
+++ trunk/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt	2021-04-01 10:26:37 UTC (rev 275351)
@@ -5,6 +5,7 @@
 
 PASS 'overscrollBehavior' in document.documentElement.style is false
 PASS 'overscroll-behavior' in getComputedStyle(document.documentElement) is false
+PASS getComputedStyle(document.getElementById('target')).getPropertyValue('overscroll-behavior') == '' is true
 PASS CSS.supports('overscroll-behavior: contain') is false
 PASS CSS.supports('overscroll-behavior: inherit') is false
 PASS CSS.supports('overscroll-behavior', 'inherit') is false

Modified: trunk/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled.html (275350 => 275351)


--- trunk/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled.html	2021-04-01 10:07:20 UTC (rev 275350)
+++ trunk/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled.html	2021-04-01 10:26:37 UTC (rev 275351)
@@ -5,11 +5,13 @@
 <script src=""
 </head>
 <body>
+<div id="target" style="display: none"></div>
 <script>
 description("Tests that overscroll-behavior is not exposed when the feature is disabled");
 
 shouldBeFalse("'overscrollBehavior' in document.documentElement.style");
 shouldBeFalse("'overscroll-behavior' in getComputedStyle(document.documentElement)");
+shouldBeTrue("getComputedStyle(document.getElementById('target')).getPropertyValue('overscroll-behavior') == ''");
 shouldBeFalse("CSS.supports('overscroll-behavior: contain')");
 shouldBeFalse("CSS.supports('overscroll-behavior: inherit')");
 shouldBeFalse("CSS.supports('overscroll-behavior', 'inherit')");

Added: trunk/LayoutTests/fast/css/rotate-invalidate-if-disabled-expected.txt (0 => 275351)


--- trunk/LayoutTests/fast/css/rotate-invalidate-if-disabled-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/rotate-invalidate-if-disabled-expected.txt	2021-04-01 10:26:37 UTC (rev 275351)
@@ -0,0 +1,15 @@
+Tests that rotate is not exposed when the feature is disabled
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS 'rotate' in document.documentElement.style is false
+PASS 'rotate' in getComputedStyle(document.documentElement) is false
+PASS getComputedStyle(document.getElementById('target')).getPropertyValue('rotate') == '' is true
+PASS CSS.supports('rotate: contain') is false
+PASS CSS.supports('rotate: inherit') is false
+PASS CSS.supports('rotate', 'inherit') is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/css/rotate-invalidate-if-disabled.html (0 => 275351)


--- trunk/LayoutTests/fast/css/rotate-invalidate-if-disabled.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/rotate-invalidate-if-disabled.html	2021-04-01 10:26:37 UTC (rev 275351)
@@ -0,0 +1,21 @@
+<!DOCTYPE html><!-- webkit-test-runner [ CSSIndividualTransformPropertiesEnabled=false ] -->
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+</head>
+<body>
+<div id="target" style="display: none"></div>
+<script>
+description("Tests that rotate is not exposed when the feature is disabled");
+
+shouldBeFalse("'rotate' in document.documentElement.style");
+shouldBeFalse("'rotate' in getComputedStyle(document.documentElement)");
+shouldBeTrue("getComputedStyle(document.getElementById('target')).getPropertyValue('rotate') == ''");
+shouldBeFalse("CSS.supports('rotate: contain')");
+shouldBeFalse("CSS.supports('rotate: inherit')");
+shouldBeFalse("CSS.supports('rotate', 'inherit')");
+
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/scale-invalidate-if-disabled-expected.txt (0 => 275351)


--- trunk/LayoutTests/fast/css/scale-invalidate-if-disabled-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/scale-invalidate-if-disabled-expected.txt	2021-04-01 10:26:37 UTC (rev 275351)
@@ -0,0 +1,15 @@
+Tests that scale is not exposed when the feature is disabled
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS 'scale' in document.documentElement.style is false
+PASS 'scale' in getComputedStyle(document.documentElement) is false
+PASS getComputedStyle(document.getElementById('target')).getPropertyValue('scale') == '' is true
+PASS CSS.supports('scale: contain') is false
+PASS CSS.supports('scale: inherit') is false
+PASS CSS.supports('scale', 'inherit') is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/css/scale-invalidate-if-disabled.html (0 => 275351)


--- trunk/LayoutTests/fast/css/scale-invalidate-if-disabled.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/scale-invalidate-if-disabled.html	2021-04-01 10:26:37 UTC (rev 275351)
@@ -0,0 +1,21 @@
+<!DOCTYPE html><!-- webkit-test-runner [ CSSIndividualTransformPropertiesEnabled=false ] -->
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+</head>
+<body>
+<div id="target" style="display: none"></div>
+<script>
+description("Tests that scale is not exposed when the feature is disabled");
+
+shouldBeFalse("'scale' in document.documentElement.style");
+shouldBeFalse("'scale' in getComputedStyle(document.documentElement)");
+shouldBeTrue("getComputedStyle(document.getElementById('target')).getPropertyValue('scale') == ''");
+shouldBeFalse("CSS.supports('scale: contain')");
+shouldBeFalse("CSS.supports('scale: inherit')");
+shouldBeFalse("CSS.supports('scale', 'inherit')");
+
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/css/translate-invalidate-if-disabled-expected.txt (0 => 275351)


--- trunk/LayoutTests/fast/css/translate-invalidate-if-disabled-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/translate-invalidate-if-disabled-expected.txt	2021-04-01 10:26:37 UTC (rev 275351)
@@ -0,0 +1,15 @@
+Tests that translate is not exposed when the feature is disabled
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS 'translate' in document.documentElement.style is false
+PASS 'translate' in getComputedStyle(document.documentElement) is false
+PASS getComputedStyle(document.getElementById('target')).getPropertyValue('translate') == '' is true
+PASS CSS.supports('translate: contain') is false
+PASS CSS.supports('translate: inherit') is false
+PASS CSS.supports('translate', 'inherit') is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/css/translate-invalidate-if-disabled.html (0 => 275351)


--- trunk/LayoutTests/fast/css/translate-invalidate-if-disabled.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/translate-invalidate-if-disabled.html	2021-04-01 10:26:37 UTC (rev 275351)
@@ -0,0 +1,21 @@
+<!DOCTYPE html><!-- webkit-test-runner [ CSSIndividualTransformPropertiesEnabled=false ] -->
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+</head>
+<body>
+<div id="target" style="display: none"></div>
+<script>
+description("Tests that translate is not exposed when the feature is disabled");
+
+shouldBeFalse("'translate' in document.documentElement.style");
+shouldBeFalse("'translate' in getComputedStyle(document.documentElement)");
+shouldBeTrue("getComputedStyle(document.getElementById('target')).getPropertyValue('translate') == ''");
+shouldBeFalse("CSS.supports('translate: contain')");
+shouldBeFalse("CSS.supports('translate: inherit')");
+shouldBeFalse("CSS.supports('translate', 'inherit')");
+
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/win/TestExpectations (275350 => 275351)


--- trunk/LayoutTests/platform/win/TestExpectations	2021-04-01 10:07:20 UTC (rev 275350)
+++ trunk/LayoutTests/platform/win/TestExpectations	2021-04-01 10:26:37 UTC (rev 275351)
@@ -4594,6 +4594,9 @@
 http/tests/xmlhttprequest/cross-origin-no-authorization.html [ Timeout Pass ]
 
 fast/css/aspect-ratio-invalidate-if-disabled.html [ Failure ]
+fast/css/rotate-invalidate-if-disabled.html [ Failure ]
+fast/css/scale-invalidate-if-disabled.html [ Failure ]
+fast/css/translate-invalidate-if-disabled.html [ Failure ]
 fast/css/parsing-color-contrast.html [ Failure ]
 fast/images/missing-content-image-crash.html [ Failure ]
 fast/mediasession/metadata/artworkdownload.html [ Failure ]

Modified: trunk/Source/WebCore/ChangeLog (275350 => 275351)


--- trunk/Source/WebCore/ChangeLog	2021-04-01 10:07:20 UTC (rev 275350)
+++ trunk/Source/WebCore/ChangeLog	2021-04-01 10:26:37 UTC (rev 275351)
@@ -1,3 +1,20 @@
+2021-04-01  Rob Buis  <[email protected]>
+
+        Use Element for checking Settings in CSSComputedStyleDeclaration
+        https://bugs.webkit.org/show_bug.cgi?id=223598
+
+        Reviewed by Darin Adler.
+
+        Use Element for checking Settings in CSSComputedStyleDeclaration.
+        Right now renderer is used but this will not work for non-rendered elements.
+
+        Tests: fast/css/rotate-invalidate-if-disabled.html
+               fast/css/scale-invalidate-if-disabled.html
+               fast/css/translate-invalidate-if-disabled.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
+
 2021-04-01  Youenn Fablet  <[email protected]>
 
         Add some logging to RTCRtpSender and RTCRtpReceiver

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (275350 => 275351)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2021-04-01 10:07:20 UTC (rev 275350)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2021-04-01 10:26:37 UTC (rev 275351)
@@ -3136,15 +3136,15 @@
         case CSSPropertyOverflowY:
             return cssValuePool.createValue(style.overflowY());
         case CSSPropertyOverscrollBehavior:
-            if (renderer && !renderer->settings().overscrollBehaviorEnabled())
+            if (!m_element->document().settings().overscrollBehaviorEnabled())
                 return nullptr;
             return cssValuePool.createValue(std::max(style.overscrollBehaviorX(), style.overscrollBehaviorY()));
         case CSSPropertyOverscrollBehaviorX:
-            if (renderer && !renderer->settings().overscrollBehaviorEnabled())
+            if (!m_element->document().settings().overscrollBehaviorEnabled())
                 return nullptr;
             return cssValuePool.createValue(style.overscrollBehaviorX());
         case CSSPropertyOverscrollBehaviorY:
-            if (renderer && !renderer->settings().overscrollBehaviorEnabled())
+            if (!m_element->document().settings().overscrollBehaviorEnabled())
                 return nullptr;
             return cssValuePool.createValue(style.overscrollBehaviorY());
         case CSSPropertyPaddingTop:
@@ -3455,7 +3455,7 @@
         case CSSPropertyWebkitAppearance:
             return cssValuePool.createValue(style.appearance());
         case CSSPropertyAspectRatio:
-            if (renderer && !renderer->settings().aspectRatioEnabled())
+            if (!m_element->document().settings().aspectRatioEnabled())
                 return nullptr;
             switch (style.aspectRatioType()) {
             case AspectRatioType::Auto:
@@ -3477,7 +3477,7 @@
             ASSERT_NOT_REACHED();
             return nullptr;
         case CSSPropertyContain: {
-            if (renderer && !renderer->settings().cssContainmentEnabled())
+            if (!m_element->document().settings().cssContainmentEnabled())
                 return nullptr;
             auto containment = style.contain();
             if (!containment)
@@ -3642,15 +3642,15 @@
             ASSERT_NOT_REACHED();
             return nullptr;
         case CSSPropertyTranslate:
-            if (renderer && !renderer->settings().cssIndividualTransformPropertiesEnabled())
+            if (!m_element->document().settings().cssIndividualTransformPropertiesEnabled())
                 return nullptr;
             return computedTranslate(renderer, style);
         case CSSPropertyScale:
-            if (renderer && !renderer->settings().cssIndividualTransformPropertiesEnabled())
+            if (!m_element->document().settings().cssIndividualTransformPropertiesEnabled())
                 return nullptr;
             return computedScale(renderer, style);
         case CSSPropertyRotate:
-            if (renderer && !renderer->settings().cssIndividualTransformPropertiesEnabled())
+            if (!m_element->document().settings().cssIndividualTransformPropertiesEnabled())
                 return nullptr;
             return computedRotate(renderer, style);
         case CSSPropertyTransitionDelay:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to