Ignore:
Timestamp:
Dec 9, 2020, 10:39:21 PM (4 years ago)
Author:
cathiechen
Message:

Support overscroll-behavior parsing
https://bugs.webkit.org/show_bug.cgi?id=219305

Reviewed by Simon Fraser.

Based on Frédéric Wang's patch.

LayoutTests/imported/w3c:

Update expectations for overscroll-behavior parsing tests.

  • web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
  • web-platform-tests/css/css-overscroll-behavior/inheritance-expected.txt:
  • web-platform-tests/css/css-overscroll-behavior/overscroll-behavior-logical-expected.txt:
  • web-platform-tests/css/css-overscroll-behavior/parsing/overscroll-behavior-computed-expected.txt:
  • web-platform-tests/css/css-overscroll-behavior/parsing/overscroll-behavior-valid-expected.txt:
  • web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:

Source/WebCore:

Support parsing CSS properties: overscroll-behavior, overscroll-behavior-x and overscroll-behavior-y.

Tests: fast/css/overscroll-behavior-invalidate-if-disabled.html

fast/css/overscroll-behavior-validate-if-enable.html

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::CSSComputedStyleDeclaration::settings const):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):

  • css/CSSComputedStyleDeclaration.h:
  • css/CSSPrimitiveValueMappings.h:

(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator OverscrollBehavior const):

  • css/CSSProperties.json:
  • css/CSSStyleDeclaration.cpp:

(WebCore::CSSStyleDeclaration::settings const):
(WebCore::CSSStyleDeclaration::namedItem):
(WebCore::CSSStyleDeclaration::setNamedItem):
(WebCore::CSSStyleDeclaration::supportedPropertyNames const):

  • css/CSSStyleDeclaration.h:
  • css/CSSValueKeywords.in:
  • css/StyleProperties.cpp:

(WebCore::StyleProperties::getPropertyValue const):
(WebCore::StyleProperties::asText const):

  • css/parser/CSSParserContext.cpp:

(WebCore::CSSParserContext::CSSParserContext):
(WebCore::operator==):

  • css/parser/CSSParserContext.h:

(WebCore::CSSParserContextHash::hash):

  • css/parser/CSSParserFastPaths.cpp:

(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
(WebCore::CSSParserFastPaths::isKeywordPropertyID):

  • css/parser/CSSPropertyParser.cpp:

(WebCore::consumeOverscrollBehavior):
(WebCore::CSSPropertyParser::parseSingleValue):
(WebCore::CSSPropertyParser::consumeOverscrollBehaviorShorthand):
(WebCore::CSSPropertyParser::parseShorthand):

  • css/parser/CSSPropertyParser.h:
  • platform/ScrollTypes.h:
  • rendering/style/RenderStyle.h:

(WebCore::RenderStyle::overscrollBehaviorX const):
(WebCore::RenderStyle::overscrollBehaviorY const):
(WebCore::RenderStyle::setOverscrollBehaviorX):
(WebCore::RenderStyle::setOverscrollBehaviorY):
(WebCore::RenderStyle::initialOverscrollBehaviorX):
(WebCore::RenderStyle::initialOverscrollBehaviorY):

  • rendering/style/StyleRareNonInheritedData.cpp:

(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator== const):

  • rendering/style/StyleRareNonInheritedData.h:

Source/WebKitLegacy/win:

Add an experimental feature flag for overscroll-behavior.

  • Interfaces/IWebPreferencesPrivate.idl:
  • WebPreferenceKeysPrivate.h:
  • WebPreferences.cpp:

(WebPreferences::initializeDefaultSettings):
(WebPreferences::overscrollBehaviorEnabled):
(WebPreferences::setOverscrollBehaviorEnabled):

  • WebPreferences.h:
  • WebView.cpp:

(WebView::notifyPreferencesChanged):

Source/WTF:

Add an experimental feature flag for overscroll-behavior.

  • Scripts/Preferences/WebPreferencesExperimental.yaml:

Tools:

Add support for testing overscroll-behavior parsing.

  • DumpRenderTree/TestOptions.cpp:

(WTR::TestOptions::defaults):

LayoutTests:

Test overscrollBehavior's validation when enable or disable OverscrollBehaviorEnabled.

  • fast/css/overscroll-behavior-invalidate-if-disabled-expected.txt: Added.
  • fast/css/overscroll-behavior-invalidate-if-disabled.html: Added.
  • fast/css/overscroll-behavior-validate-if-enable-expected.txt: Added.
  • fast/css/overscroll-behavior-validate-if-enable.html: Added.
  • platform/ios-13/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
  • platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:
  • platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSStyleDeclaration.cpp

    r269314 r270613  
    255255}
    256256
     257const Settings* CSSStyleDeclaration::settings() const
     258{
     259    return parentElement() ? &parentElement()->document().settings() : nullptr;
     260}
     261
    257262Optional<Variant<String, double>> CSSStyleDeclaration::namedItem(const AtomString& propertyName)
    258263{
    259     auto* settings = parentElement() ? &parentElement()->document().settings() : nullptr;
    260     auto propertyInfo = propertyInfoFromJavaScriptCSSPropertyName(propertyName, settings);
     264    auto propertyInfo = propertyInfoFromJavaScriptCSSPropertyName(propertyName, settings());
    261265    if (!propertyInfo.propertyID)
    262266        return WTF::nullopt;
     
    280284ExceptionOr<void> CSSStyleDeclaration::setNamedItem(const AtomString& propertyName, String value, bool& propertySupported)
    281285{
    282     auto* settings = parentElement() ? &parentElement()->document().settings() : nullptr;
    283     auto propertyInfo = propertyInfoFromJavaScriptCSSPropertyName(propertyName, settings);
     286    auto propertyInfo = propertyInfoFromJavaScriptCSSPropertyName(propertyName, settings());
    284287    if (!propertyInfo.propertyID) {
    285288        propertySupported = false;
     
    311314{
    312315    static unsigned numNames = 0;
    313     static const AtomString* const cssPropertyNames = [] {
     316    static const AtomString* const cssPropertyNames = [this] {
    314317        String names[numCSSProperties];
    315318        for (int i = 0; i < numCSSProperties; ++i) {
    316319            CSSPropertyID id = static_cast<CSSPropertyID>(firstCSSProperty + i);
    317             // FIXME: Should take account for flags in settings().
    318             if (isEnabledCSSProperty(id))
     320            if (isEnabledCSSProperty(id) && isCSSPropertyEnabledBySettings(id, settings()))
    319321                names[numNames++] = getJSPropertyName(id);
    320322        }
Note: See TracChangeset for help on using the changeset viewer.