Changeset 273385 in webkit


Ignore:
Timestamp:
Feb 24, 2021 8:45:08 AM (17 months ago)
Author:
Simon Fraser
Message:

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.
Location:
trunk
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r273381 r273385  
     12021-02-24  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Runtime-disabled CSS features still appear enabled via CSS.supports()
     4        https://bugs.webkit.org/show_bug.cgi?id=222280
     5        rdar://74595641
     6
     7        Reviewed by Sam Weinig.
     8
     9        * css3/color-filters/color-filter-exposed-if-disabled-expected.txt: Added. Fails tracked in webkit.org/b/217626
     10        * css3/color-filters/color-filter-exposed-if-disabled.html: Added.
     11        * fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt:
     12        * fast/css/overscroll-behavior-invalidate-if-disabled.html:
     13        * fast/css/scroll-behavior-exposed-if-disabled-expected.txt: Added.
     14        * fast/css/scroll-behavior-exposed-if-disabled.html: Added.
     15
    1162021-02-24  Imanol Fernandez  <ifernandez@igalia.com>
    217
  • trunk/LayoutTests/fast/css/aspect-ratio-invalidate-if-disabled-expected.txt

    r273314 r273385  
    77PASS 'aspect-ratio' in getComputedStyle(document.documentElement) is false
    88PASS CSS.supports('aspect-ratio: 1 / 1') is false
    9 FAIL CSS.supports('aspect-ratio: inherit') should be false. Was true.
     9PASS CSS.supports('aspect-ratio: inherit') is false
    1010PASS successfullyParsed is true
    11 Some tests failed.
    1211
    1312TEST COMPLETE
  • trunk/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt

    r270613 r273385  
    1 Test overscrollBehavior should be invalidated if overscrollBehaviorEnabled is disabled
     1Tests that overscroll-behavior is not exposed when the feature is disabled
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
     
    66PASS 'overscrollBehavior' in document.documentElement.style is false
    77PASS 'overscroll-behavior' in getComputedStyle(document.documentElement) is false
     8PASS CSS.supports('overscroll-behavior: contain') is false
     9PASS CSS.supports('overscroll-behavior: inherit') is false
     10PASS CSS.supports('overscroll-behavior-x: inherit') is false
     11PASS CSS.supports('overscroll-behavior-y: inherit') is false
    812PASS successfullyParsed is true
    913
  • trunk/LayoutTests/fast/css/overscroll-behavior-invalidate-if-disabled.html

    r270613 r273385  
    77<body>
    88<script>
    9 description("Test overscrollBehavior should be invalidated if overscrollBehaviorEnabled is disabled");
     9description("Tests that overscroll-behavior is not exposed when the feature is disabled");
    1010
    1111shouldBeFalse("'overscrollBehavior' in document.documentElement.style");
    1212shouldBeFalse("'overscroll-behavior' in getComputedStyle(document.documentElement)");
     13shouldBeFalse("CSS.supports('overscroll-behavior: contain')");
     14shouldBeFalse("CSS.supports('overscroll-behavior: inherit')");
     15shouldBeFalse("CSS.supports('overscroll-behavior-x: inherit')");
     16shouldBeFalse("CSS.supports('overscroll-behavior-y: inherit')");
    1317
    1418</script>
  • trunk/Source/WebCore/ChangeLog

    r273382 r273385  
     12021-02-24  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Runtime-disabled CSS features still appear enabled via CSS.supports()
     4        https://bugs.webkit.org/show_bug.cgi?id=222280
     5        rdar://74595641
     6
     7        Reviewed by Sam Weinig.
     8
     9        When parsing CSS.supports() for a runtime-disabled property, we'd successfully
     10        parse a CSS-wide keyword like "inherit" and report that the property is supported.
     11
     12        We need to explicitly check for runtime-disabled properties.
     13
     14        Tests: css3/color-filters/color-filter-exposed-if-disabled.html
     15               fast/css/scroll-behavior-exposed-if-disabled.html
     16
     17        * css/parser/CSSParserImpl.cpp:
     18        (WebCore::CSSParserImpl::isPropertyRuntimeDisabled const):
     19        (WebCore::CSSParserImpl::consumeDeclaration):
     20        * css/parser/CSSParserImpl.h:
     21
    1222021-02-24  Imanol Fernandez  <ifernandez@igalia.com>
    223
  • trunk/Source/WebCore/css/parser/CSSParserImpl.cpp

    r268741 r273385  
    774774}
    775775
     776bool CSSParserImpl::isPropertyRuntimeDisabled(CSSPropertyID property) const
     777{
     778    switch (property) {
     779    case CSSPropertyAspectRatio:
     780        return !m_context.aspectRatioEnabled;
     781    case CSSPropertyAppleColorFilter:
     782        return !m_context.colorFilterEnabled;
     783    case CSSPropertyTranslate:
     784    case CSSPropertyRotate:
     785    case CSSPropertyScale:
     786        return !m_context.individualTransformPropertiesEnabled;
     787    case CSSPropertyOverscrollBehavior:
     788    case CSSPropertyOverscrollBehaviorX:
     789    case CSSPropertyOverscrollBehaviorY:
     790        return !m_context.overscrollBehaviorEnabled;
     791    case CSSPropertyScrollBehavior:
     792        return !m_context.scrollBehaviorEnabled;
     793#if ENABLE(TEXT_AUTOSIZING)
     794    case CSSPropertyWebkitTextSizeAdjust:
     795#if !PLATFORM(IOS_FAMILY)
     796        return !m_context.textAutosizingEnabled;
     797#endif
     798        return false;
     799#endif // ENABLE(TEXT_AUTOSIZING)
     800#if ENABLE(OVERFLOW_SCROLLING_TOUCH)
     801    case CSSPropertyWebkitOverflowScrolling:
     802        return !m_context.legacyOverflowScrollingTouchEnabled;
     803#endif
     804    default:
     805        return false;
     806    }
     807    return false;
     808}
     809
    776810void CSSParserImpl::consumeDeclaration(CSSParserTokenRange range, StyleRuleType ruleType)
    777811{
     
    783817    if (range.consume().type() != ColonToken)
    784818        return; // Parse error
     819
     820    if (isPropertyRuntimeDisabled(propertyID))
     821        propertyID = CSSPropertyInvalid;
    785822
    786823    bool important = false;
  • trunk/Source/WebCore/css/parser/CSSParserImpl.h

    r266253 r273385  
    144144    void consumeDeclarationValue(CSSParserTokenRange, CSSPropertyID, bool important, StyleRuleType);
    145145    void consumeCustomPropertyValue(CSSParserTokenRange, const AtomString& propertyName, bool important);
     146   
     147    bool isPropertyRuntimeDisabled(CSSPropertyID) const;
    146148
    147149    static Vector<double> consumeKeyframeKeyList(CSSParserTokenRange);
Note: See TracChangeset for help on using the changeset viewer.