Title: [273530] branches/safari-611-branch
Revision
273530
Author
[email protected]
Date
2021-02-25 18:51:40 -0800 (Thu, 25 Feb 2021)

Log Message

Cherry-pick r273385. rdar://problem/74753323

    Runtime-disabled CSS features still appear enabled via CSS.supports()
    https://bugs.webkit.org/show_bug.cgi?id=222280
    rdar://74595641

    Reviewed by Sam Weinig.

    Source/WebCore:

    When parsing CSS.supports() for a runtime-disabled property, we'd successfully
    parse a CSS-wide keyword like "inherit" and report that the property is supported.

    We need to explicitly check for runtime-disabled properties.

    Tests: css3/color-filters/color-filter-exposed-if-disabled.html
           fast/css/scroll-behavior-exposed-if-disabled.html

    * css/parser/CSSParserImpl.cpp:
    (WebCore::CSSParserImpl::isPropertyRuntimeDisabled const):
    (WebCore::CSSParserImpl::consumeDeclaration):
    * css/parser/CSSParserImpl.h:

    LayoutTests:

    * css3/color-filters/color-filter-exposed-if-disabled-expected.txt: Added. Fails tracked in webkit.org/b/217626
    * css3/color-filters/color-filter-exposed-if-disabled.html: Added.
    * fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt:
    * fast/css/overscroll-behavior-invalidate-if-disabled.html:
    * fast/css/scroll-behavior-exposed-if-disabled-expected.txt: Added.
    * fast/css/scroll-behavior-exposed-if-disabled.html: Added.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273385 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-611-branch/LayoutTests/ChangeLog (273529 => 273530)


--- branches/safari-611-branch/LayoutTests/ChangeLog	2021-02-26 02:51:35 UTC (rev 273529)
+++ branches/safari-611-branch/LayoutTests/ChangeLog	2021-02-26 02:51:40 UTC (rev 273530)
@@ -1,5 +1,57 @@
 2021-02-25  Russell Epstein  <[email protected]>
 
+        Cherry-pick r273385. rdar://problem/74753323
+
+    Runtime-disabled CSS features still appear enabled via CSS.supports()
+    https://bugs.webkit.org/show_bug.cgi?id=222280
+    rdar://74595641
+    
+    Reviewed by Sam Weinig.
+    
+    Source/WebCore:
+    
+    When parsing CSS.supports() for a runtime-disabled property, we'd successfully
+    parse a CSS-wide keyword like "inherit" and report that the property is supported.
+    
+    We need to explicitly check for runtime-disabled properties.
+    
+    Tests: css3/color-filters/color-filter-exposed-if-disabled.html
+           fast/css/scroll-behavior-exposed-if-disabled.html
+    
+    * css/parser/CSSParserImpl.cpp:
+    (WebCore::CSSParserImpl::isPropertyRuntimeDisabled const):
+    (WebCore::CSSParserImpl::consumeDeclaration):
+    * css/parser/CSSParserImpl.h:
+    
+    LayoutTests:
+    
+    * css3/color-filters/color-filter-exposed-if-disabled-expected.txt: Added. Fails tracked in webkit.org/b/217626
+    * css3/color-filters/color-filter-exposed-if-disabled.html: Added.
+    * fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt:
+    * fast/css/overscroll-behavior-invalidate-if-disabled.html:
+    * fast/css/scroll-behavior-exposed-if-disabled-expected.txt: Added.
+    * fast/css/scroll-behavior-exposed-if-disabled.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273385 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-02-24  Simon Fraser  <[email protected]>
+
+            Runtime-disabled CSS features still appear enabled via CSS.supports()
+            https://bugs.webkit.org/show_bug.cgi?id=222280
+            rdar://74595641
+
+            Reviewed by Sam Weinig.
+
+            * css3/color-filters/color-filter-exposed-if-disabled-expected.txt: Added. Fails tracked in webkit.org/b/217626
+            * css3/color-filters/color-filter-exposed-if-disabled.html: Added.
+            * fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt:
+            * fast/css/overscroll-behavior-invalidate-if-disabled.html:
+            * fast/css/scroll-behavior-exposed-if-disabled-expected.txt: Added.
+            * fast/css/scroll-behavior-exposed-if-disabled.html: Added.
+
+2021-02-25  Russell Epstein  <[email protected]>
+
         Cherry-pick r273314. rdar://problem/74753323
 
     aspect-ratio shows in computed style when disabled

Added: branches/safari-611-branch/LayoutTests/css3/color-filters/color-filter-exposed-if-disabled-expected.txt (0 => 273530)


--- branches/safari-611-branch/LayoutTests/css3/color-filters/color-filter-exposed-if-disabled-expected.txt	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/css3/color-filters/color-filter-exposed-if-disabled-expected.txt	2021-02-26 02:51:40 UTC (rev 273530)
@@ -0,0 +1,14 @@
+Tests that -apple-color-filter is not exposed when the feature is disabled
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+FAIL '-apple-color-filter' in document.documentElement.style should be false. Was true.
+FAIL '-apple-color-filter' in getComputedStyle(document.documentElement) should be false. Was true.
+PASS CSS.supports('-apple-color-filter: contrast(1)') is false
+PASS CSS.supports('-apple-color-filter: inherit') is false
+PASS successfullyParsed is true
+Some tests failed.
+
+TEST COMPLETE
+

Added: branches/safari-611-branch/LayoutTests/css3/color-filters/color-filter-exposed-if-disabled.html (0 => 273530)


--- branches/safari-611-branch/LayoutTests/css3/color-filters/color-filter-exposed-if-disabled.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/css3/color-filters/color-filter-exposed-if-disabled.html	2021-02-26 02:51:40 UTC (rev 273530)
@@ -0,0 +1,18 @@
+<!DOCTYPE html><!-- webkit-test-runner [ ColorFilterEnabled=false ] -->
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+</head>
+<body>
+<script>
+description("Tests that -apple-color-filter is not exposed when the feature is disabled");
+
+shouldBeFalse("'-apple-color-filter' in document.documentElement.style");
+shouldBeFalse("'-apple-color-filter' in getComputedStyle(document.documentElement)");
+shouldBeFalse("CSS.supports('-apple-color-filter: contrast(1)')");
+shouldBeFalse("CSS.supports('-apple-color-filter: inherit')");
+
+</script>
+</body>
+</html>

Modified: branches/safari-611-branch/LayoutTests/fast/css/aspect-ratio-invalidate-if-disabled-expected.txt (273529 => 273530)


--- branches/safari-611-branch/LayoutTests/fast/css/aspect-ratio-invalidate-if-disabled-expected.txt	2021-02-26 02:51:35 UTC (rev 273529)
+++ branches/safari-611-branch/LayoutTests/fast/css/aspect-ratio-invalidate-if-disabled-expected.txt	2021-02-26 02:51:40 UTC (rev 273530)
@@ -6,9 +6,8 @@
 PASS 'aspectRatio' in document.documentElement.style is false
 PASS 'aspect-ratio' in getComputedStyle(document.documentElement) is false
 PASS CSS.supports('aspect-ratio: 1 / 1') is false
-FAIL CSS.supports('aspect-ratio: inherit') should be false. Was true.
+PASS CSS.supports('aspect-ratio: inherit') is false
 PASS successfullyParsed is true
-Some tests failed.
 
 TEST COMPLETE
 

Modified: branches/safari-611-branch/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt (273529 => 273530)


--- branches/safari-611-branch/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt	2021-02-26 02:51:35 UTC (rev 273529)
+++ branches/safari-611-branch/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt	2021-02-26 02:51:40 UTC (rev 273530)
@@ -1,4 +1,4 @@
-Test overscrollBehavior should be invalidated if overscrollBehaviorEnabled is disabled
+Tests that overscroll-behavior is not exposed when the feature is disabled
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
@@ -5,6 +5,10 @@
 
 PASS 'overscrollBehavior' in document.documentElement.style is false
 PASS 'overscroll-behavior' in getComputedStyle(document.documentElement) is false
+PASS CSS.supports('overscroll-behavior: contain') is false
+PASS CSS.supports('overscroll-behavior: inherit') is false
+PASS CSS.supports('overscroll-behavior-x: inherit') is false
+PASS CSS.supports('overscroll-behavior-y: inherit') is false
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: branches/safari-611-branch/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled.html (273529 => 273530)


--- branches/safari-611-branch/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled.html	2021-02-26 02:51:35 UTC (rev 273529)
+++ branches/safari-611-branch/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled.html	2021-02-26 02:51:40 UTC (rev 273530)
@@ -6,10 +6,14 @@
 </head>
 <body>
 <script>
-description("Test overscrollBehavior should be invalidated if overscrollBehaviorEnabled is disabled");
+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)");
+shouldBeFalse("CSS.supports('overscroll-behavior: contain')");
+shouldBeFalse("CSS.supports('overscroll-behavior: inherit')");
+shouldBeFalse("CSS.supports('overscroll-behavior-x: inherit')");
+shouldBeFalse("CSS.supports('overscroll-behavior-y: inherit')");
 
 </script>
 </body>

Added: branches/safari-611-branch/LayoutTests/fast/css/scroll-behavior-exposed-if-disabled-expected.txt (0 => 273530)


--- branches/safari-611-branch/LayoutTests/fast/css/scroll-behavior-exposed-if-disabled-expected.txt	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/css/scroll-behavior-exposed-if-disabled-expected.txt	2021-02-26 02:51:40 UTC (rev 273530)
@@ -0,0 +1,15 @@
+Tests that scroll-behavior is not exposed when the feature is disabled
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS 'scrollBehavior' in document.documentElement.style is false
+PASS 'scroll-behavior' in getComputedStyle(document.documentElement) is false
+PASS CSS.supports('scroll-behavior: smooth') is false
+PASS CSS.supports('scroll-behavior: inherit') is false
+PASS CSS.supports('scroll-behavior-x: inherit') is false
+PASS CSS.supports('scroll-behavior-y: inherit') is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-611-branch/LayoutTests/fast/css/scroll-behavior-exposed-if-disabled.html (0 => 273530)


--- branches/safari-611-branch/LayoutTests/fast/css/scroll-behavior-exposed-if-disabled.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/css/scroll-behavior-exposed-if-disabled.html	2021-02-26 02:51:40 UTC (rev 273530)
@@ -0,0 +1,20 @@
+<!DOCTYPE html><!-- webkit-test-runner [ CSSOMViewSmoothScrollingEnabled=false ] -->
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+</head>
+<body>
+<script>
+description("Tests that scroll-behavior is not exposed when the feature is disabled");
+
+shouldBeFalse("'scrollBehavior' in document.documentElement.style");
+shouldBeFalse("'scroll-behavior' in getComputedStyle(document.documentElement)");
+shouldBeFalse("CSS.supports('scroll-behavior: smooth')");
+shouldBeFalse("CSS.supports('scroll-behavior: inherit')");
+shouldBeFalse("CSS.supports('scroll-behavior-x: inherit')");
+shouldBeFalse("CSS.supports('scroll-behavior-y: inherit')");
+
+</script>
+</body>
+</html>

Modified: branches/safari-611-branch/Source/WebCore/ChangeLog (273529 => 273530)


--- branches/safari-611-branch/Source/WebCore/ChangeLog	2021-02-26 02:51:35 UTC (rev 273529)
+++ branches/safari-611-branch/Source/WebCore/ChangeLog	2021-02-26 02:51:40 UTC (rev 273530)
@@ -1,5 +1,63 @@
 2021-02-25  Russell Epstein  <[email protected]>
 
+        Cherry-pick r273385. rdar://problem/74753323
+
+    Runtime-disabled CSS features still appear enabled via CSS.supports()
+    https://bugs.webkit.org/show_bug.cgi?id=222280
+    rdar://74595641
+    
+    Reviewed by Sam Weinig.
+    
+    Source/WebCore:
+    
+    When parsing CSS.supports() for a runtime-disabled property, we'd successfully
+    parse a CSS-wide keyword like "inherit" and report that the property is supported.
+    
+    We need to explicitly check for runtime-disabled properties.
+    
+    Tests: css3/color-filters/color-filter-exposed-if-disabled.html
+           fast/css/scroll-behavior-exposed-if-disabled.html
+    
+    * css/parser/CSSParserImpl.cpp:
+    (WebCore::CSSParserImpl::isPropertyRuntimeDisabled const):
+    (WebCore::CSSParserImpl::consumeDeclaration):
+    * css/parser/CSSParserImpl.h:
+    
+    LayoutTests:
+    
+    * css3/color-filters/color-filter-exposed-if-disabled-expected.txt: Added. Fails tracked in webkit.org/b/217626
+    * css3/color-filters/color-filter-exposed-if-disabled.html: Added.
+    * fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt:
+    * fast/css/overscroll-behavior-invalidate-if-disabled.html:
+    * fast/css/scroll-behavior-exposed-if-disabled-expected.txt: Added.
+    * fast/css/scroll-behavior-exposed-if-disabled.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273385 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-02-24  Simon Fraser  <[email protected]>
+
+            Runtime-disabled CSS features still appear enabled via CSS.supports()
+            https://bugs.webkit.org/show_bug.cgi?id=222280
+            rdar://74595641
+
+            Reviewed by Sam Weinig.
+
+            When parsing CSS.supports() for a runtime-disabled property, we'd successfully
+            parse a CSS-wide keyword like "inherit" and report that the property is supported.
+
+            We need to explicitly check for runtime-disabled properties.
+
+            Tests: css3/color-filters/color-filter-exposed-if-disabled.html
+                   fast/css/scroll-behavior-exposed-if-disabled.html
+
+            * css/parser/CSSParserImpl.cpp:
+            (WebCore::CSSParserImpl::isPropertyRuntimeDisabled const):
+            (WebCore::CSSParserImpl::consumeDeclaration):
+            * css/parser/CSSParserImpl.h:
+
+2021-02-25  Russell Epstein  <[email protected]>
+
         Cherry-pick r273314. rdar://problem/74753323
 
     aspect-ratio shows in computed style when disabled

Modified: branches/safari-611-branch/Source/WebCore/css/parser/CSSParserImpl.cpp (273529 => 273530)


--- branches/safari-611-branch/Source/WebCore/css/parser/CSSParserImpl.cpp	2021-02-26 02:51:35 UTC (rev 273529)
+++ branches/safari-611-branch/Source/WebCore/css/parser/CSSParserImpl.cpp	2021-02-26 02:51:40 UTC (rev 273530)
@@ -773,6 +773,40 @@
     }
 }
 
+bool CSSParserImpl::isPropertyRuntimeDisabled(CSSPropertyID property) const
+{
+    switch (property) {
+    case CSSPropertyAspectRatio:
+        return !m_context.aspectRatioEnabled;
+    case CSSPropertyAppleColorFilter:
+        return !m_context.colorFilterEnabled;
+    case CSSPropertyTranslate:
+    case CSSPropertyRotate:
+    case CSSPropertyScale:
+        return !m_context.individualTransformPropertiesEnabled;
+    case CSSPropertyOverscrollBehavior:
+    case CSSPropertyOverscrollBehaviorX:
+    case CSSPropertyOverscrollBehaviorY:
+        return !m_context.overscrollBehaviorEnabled;
+    case CSSPropertyScrollBehavior:
+        return !m_context.scrollBehaviorEnabled;
+#if ENABLE(TEXT_AUTOSIZING)
+    case CSSPropertyWebkitTextSizeAdjust:
+#if !PLATFORM(IOS_FAMILY)
+        return !m_context.textAutosizingEnabled;
+#endif
+        return false;
+#endif // ENABLE(TEXT_AUTOSIZING)
+#if ENABLE(OVERFLOW_SCROLLING_TOUCH)
+    case CSSPropertyWebkitOverflowScrolling:
+        return !m_context.legacyOverflowScrollingTouchEnabled;
+#endif
+    default:
+        return false;
+    }
+    return false;
+}
+
 void CSSParserImpl::consumeDeclaration(CSSParserTokenRange range, StyleRuleType ruleType)
 {
     CSSParserTokenRange rangeCopy = range; // For inspector callbacks
@@ -783,6 +817,9 @@
     if (range.consume().type() != ColonToken)
         return; // Parse error
 
+    if (isPropertyRuntimeDisabled(propertyID))
+        propertyID = CSSPropertyInvalid;
+
     bool important = false;
     const CSSParserToken* declarationValueEnd = range.end();
     const CSSParserToken* last = range.end() - 1;

Modified: branches/safari-611-branch/Source/WebCore/css/parser/CSSParserImpl.h (273529 => 273530)


--- branches/safari-611-branch/Source/WebCore/css/parser/CSSParserImpl.h	2021-02-26 02:51:35 UTC (rev 273529)
+++ branches/safari-611-branch/Source/WebCore/css/parser/CSSParserImpl.h	2021-02-26 02:51:40 UTC (rev 273530)
@@ -143,6 +143,8 @@
     void consumeDeclaration(CSSParserTokenRange, StyleRuleType);
     void consumeDeclarationValue(CSSParserTokenRange, CSSPropertyID, bool important, StyleRuleType);
     void consumeCustomPropertyValue(CSSParserTokenRange, const AtomString& propertyName, bool important);
+    
+    bool isPropertyRuntimeDisabled(CSSPropertyID) const;
 
     static Vector<double> consumeKeyframeKeyList(CSSParserTokenRange);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to