Title: [235539] trunk
Revision
235539
Author
[email protected]
Date
2018-08-31 00:49:32 -0700 (Fri, 31 Aug 2018)

Log Message

Bug 182053 - [CSSOM View] Implement standard behavior for scrollingElement
https://bugs.webkit.org/show_bug.cgi?id=182053

Patch by Frederic Wang <[email protected]> on 2018-08-31
Reviewed by Simon Fraser.

Source/WebCore:

This commit introduces a new CSSOMViewScrollingAPIEnabled flag that will be used to implement
the standard behavior of DOM scroll* API as specified by the CSSOM View spec (see bug 5991).
It changes the behavior of document.scrollingElement so that it follows the spec when the
flag is enabled. This will allow to pass the WPT test cssom-view/scrollingElement.html when
it becomes the default behavior. WPT tests cssom-view/scrollingElement-quirks-dynamic*.html
still fail; comparing with Chromium's code, we might need to propagate the style of <html>
and <body> to the viewport element. Behaviors for other scrolling attributes will be changed
in follow-up bugs.

Tests: fast/dom/Document/scrollingElement-quirks-mode.html
       fast/dom/Document/scrollingElement-standard-mode.html

* dom/Document.cpp:
(WebCore::Document::isBodyPotentiallyScrollable): Helper function to verify whether the body
is potentially scrollable, as defined by the CSSOM View spec. It seems that
RenderObject::hasOverflowClip() may return incorrect value at this point and we might need
to do something similar to Chromium's style propagation to make it work. For now, we just
use the computed style. See bug 182292.
(WebCore::Document::scrollingElement): When CSSOMViewScrollingAPIEnabled is enabled, we
implement the algorithm of the CSSOM View spec.
(WebCore::Document::body const): Verify that the root is actually a <html> element or
otherwise return null. This is required by the CSSOM View spec and for WPT test
scrollingElement.html. It is consistent  with bodyOrFrameset().
* dom/Document.h: Add spec references for body() and bodyOrFrameset() and declare
isBodyPotentiallyScrollable().
* page/Settings.yaml: Add developer option for enabling the CSSOM View behavior.
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::isOverflowVisible const): Add helper function to check whether the
style implies visible overflow.

Source/WebKit:

Add developer flag to use standard behavior for scrolling* attributes.

* Shared/WebPreferences.yaml:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetCSSOMViewScrollingAPIEnabled):
(WKPreferencesGetCSSOMViewScrollingAPIEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:

Source/WebKitLegacy/mac:

Add developer flag to use standard behavior for scrolling* attributes.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences CSSOMViewScrollingAPIEnabled]):
(-[WebPreferences setCSSOMViewScrollingAPIEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKitLegacy/win:

Add developer flag to use standard behavior for scrolling* attributes.

* Interfaces/IWebPreferencesPrivate.idl:
* WebPreferenceKeysPrivate.h:
* WebPreferences.cpp:
(WebPreferences::initializeDefaultSettings):
(WebPreferences::CSSOMViewScrollingAPIEnabled):
(WebPreferences::setCSSOMViewScrollingAPIEnabled):
* WebPreferences.h:
* WebView.cpp:
(WebView::notifyPreferencesChanged):

Tools:

Add FIXMEs comments to add the new developer flag in the future and  disable it for now.

* DumpRenderTree/mac/DumpRenderTree.mm:
(enableExperimentalFeatures):
(resetWebPreferencesToConsistentValues):
* DumpRenderTree/win/DumpRenderTree.cpp:
(enableExperimentalFeatures):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):

LayoutTests:

Add a test to check that in Quirks mode, the <body> element returned by
document.scrollingElement is indeed a child of a <html> root (i.e. in the HTML namespace).
Adjust scrollingElement*.html tests so that they are executed with the flag
CSSOMViewScrollingAPI enabled and update expectations now that these tests pass.

* fast/dom/Document/scrollingElement-quirks-mode.html:
* fast/dom/Document/scrollingElement-quirks-mode-expected.txt:
* fast/dom/Document/scrollingElement-standards-mode.html:
* fast/dom/Document/scrollingElement-standards-mode-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (235538 => 235539)


--- trunk/LayoutTests/ChangeLog	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/LayoutTests/ChangeLog	2018-08-31 07:49:32 UTC (rev 235539)
@@ -1,3 +1,20 @@
+2018-08-31  Frederic Wang  <[email protected]>
+
+        Bug 182053 - [CSSOM View] Implement standard behavior for scrollingElement
+        https://bugs.webkit.org/show_bug.cgi?id=182053
+
+        Reviewed by Simon Fraser.
+
+        Add a test to check that in Quirks mode, the <body> element returned by
+        document.scrollingElement is indeed a child of a <html> root (i.e. in the HTML namespace).
+        Adjust scrollingElement*.html tests so that they are executed with the flag
+        CSSOMViewScrollingAPI enabled and update expectations now that these tests pass.
+
+        * fast/dom/Document/scrollingElement-quirks-mode.html:
+        * fast/dom/Document/scrollingElement-quirks-mode-expected.txt:
+        * fast/dom/Document/scrollingElement-standards-mode.html:
+        * fast/dom/Document/scrollingElement-standards-mode-expected.txt:
+
 2018-08-30  Zalan Bujtas  <[email protected]>
 
         CounterMaps should hold a unique_ptr of CounterMap.

Modified: trunk/LayoutTests/fast/dom/Document/scrollingElement-quirks-mode-expected.txt (235538 => 235539)


--- trunk/LayoutTests/fast/dom/Document/scrollingElement-quirks-mode-expected.txt	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/LayoutTests/fast/dom/Document/scrollingElement-quirks-mode-expected.txt	2018-08-31 07:49:32 UTC (rev 235539)
@@ -8,10 +8,11 @@
 PASS document.scrollingElement is document.body
 PASS document.scrollingElement is document.body
 In quirks mode, if the `BODY` is scrollable, the scrolling element is `null`
-INTENTIONAL FAILURE. This can be fixed once https://bugs.webkit.org/show_bug.cgi?id=106133 is fixed.
-FAIL document.scrollingElement.scrollingElement should be null (of type object). Was undefined (of type undefined).
+PASS document.scrollingElement is null
 In quirks mode, if the `BODY` is `display: none`, the scrolling element is `BODY`
 PASS document.scrollingElement is document.body
+In quirks mode, the document.scrollingElement is null if there is no `HTML` root.
+PASS scrollingElement is null
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/dom/Document/scrollingElement-quirks-mode.html (235538 => 235539)


--- trunk/LayoutTests/fast/dom/Document/scrollingElement-quirks-mode.html	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/LayoutTests/fast/dom/Document/scrollingElement-quirks-mode.html	2018-08-31 07:49:32 UTC (rev 235539)
@@ -5,6 +5,8 @@
 </head>
 <body>
 <script>
+if (window.internals)
+    internals.settings.setCSSOMViewScrollingAPIEnabled(true);
 
 description("Tests the behavior of document.scrollingElement in quirks mode.");
 
@@ -20,10 +22,9 @@
 shouldBe("document.scrollingElement", "document.body");
 
 debug("In quirks mode, if the `BODY` is scrollable, the scrolling element is `null`");
-debug("INTENTIONAL FAILURE. This can be fixed once https://bugs.webkit.org/show_bug.cgi?id=106133 is fixed.");
 document.documentElement.setAttribute('style', 'overflow: scroll');
 document.body.setAttribute('style', 'overflow: scroll');
-shouldBeNull("document.scrollingElement.scrollingElement");
+shouldBeNull("document.scrollingElement");
 
 debug("In quirks mode, if the `BODY` is `display: none`, the scrolling element is `BODY`");
 document.documentElement.setAttribute('style', 'overflow: scroll');
@@ -32,6 +33,16 @@
 
 document.body.setAttribute('style', '');
 
+debug("In quirks mode, the document.scrollingElement is null if there is no `HTML` root.");
+// We save and restore the root before testing so that the result can be printed.
+var oldRoot = document.removeChild(document.documentElement);
+document.appendChild(document.createElementNS("foobarNS", "html"));
+document.documentElement.appendChild(document.createElement("body"));
+var scrollingElement = document.scrollingElement;
+document.removeChild(document.documentElement);
+document.appendChild(oldRoot);
+shouldBeNull("scrollingElement");
+
 </script>
 <script src=""
 </body>

Modified: trunk/LayoutTests/fast/dom/Document/scrollingElement-standards-mode-expected.txt (235538 => 235539)


--- trunk/LayoutTests/fast/dom/Document/scrollingElement-standards-mode-expected.txt	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/LayoutTests/fast/dom/Document/scrollingElement-standards-mode-expected.txt	2018-08-31 07:49:32 UTC (rev 235539)
@@ -4,8 +4,7 @@
 
 
 In standards mode the scrolling element is supposed to be `HTML`
-INTENTIONAL FAILURE. This can be fixed once https://bugs.webkit.org/show_bug.cgi?id=106133 is fixed.
-FAIL document.scrollingElement should be [object HTMLHtmlElement]. Was [object HTMLBodyElement].
+PASS document.scrollingElement is document.documentElement
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/dom/Document/scrollingElement-standards-mode.html (235538 => 235539)


--- trunk/LayoutTests/fast/dom/Document/scrollingElement-standards-mode.html	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/LayoutTests/fast/dom/Document/scrollingElement-standards-mode.html	2018-08-31 07:49:32 UTC (rev 235539)
@@ -6,11 +6,12 @@
 </head>
 <body>
 <script>
+if (window.internals)
+    internals.settings.setCSSOMViewScrollingAPIEnabled(true);
 
 description("Tests the behavior of document.scrollingElement in standards mode.");
 
 debug("In standards mode the scrolling element is supposed to be `HTML`");
-debug("INTENTIONAL FAILURE. This can be fixed once https://bugs.webkit.org/show_bug.cgi?id=106133 is fixed.");
 shouldBe("document.scrollingElement", "document.documentElement");
 
 </script>

Modified: trunk/Source/WebCore/ChangeLog (235538 => 235539)


--- trunk/Source/WebCore/ChangeLog	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebCore/ChangeLog	2018-08-31 07:49:32 UTC (rev 235539)
@@ -1,3 +1,40 @@
+2018-08-31  Frederic Wang  <[email protected]>
+
+        Bug 182053 - [CSSOM View] Implement standard behavior for scrollingElement
+        https://bugs.webkit.org/show_bug.cgi?id=182053
+
+        Reviewed by Simon Fraser.
+
+        This commit introduces a new CSSOMViewScrollingAPIEnabled flag that will be used to implement
+        the standard behavior of DOM scroll* API as specified by the CSSOM View spec (see bug 5991).
+        It changes the behavior of document.scrollingElement so that it follows the spec when the
+        flag is enabled. This will allow to pass the WPT test cssom-view/scrollingElement.html when
+        it becomes the default behavior. WPT tests cssom-view/scrollingElement-quirks-dynamic*.html
+        still fail; comparing with Chromium's code, we might need to propagate the style of <html>
+        and <body> to the viewport element. Behaviors for other scrolling attributes will be changed
+        in follow-up bugs.
+
+        Tests: fast/dom/Document/scrollingElement-quirks-mode.html
+               fast/dom/Document/scrollingElement-standard-mode.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::isBodyPotentiallyScrollable): Helper function to verify whether the body
+        is potentially scrollable, as defined by the CSSOM View spec. It seems that
+        RenderObject::hasOverflowClip() may return incorrect value at this point and we might need
+        to do something similar to Chromium's style propagation to make it work. For now, we just
+        use the computed style. See bug 182292.
+        (WebCore::Document::scrollingElement): When CSSOMViewScrollingAPIEnabled is enabled, we
+        implement the algorithm of the CSSOM View spec.
+        (WebCore::Document::body const): Verify that the root is actually a <html> element or
+        otherwise return null. This is required by the CSSOM View spec and for WPT test
+        scrollingElement.html. It is consistent  with bodyOrFrameset().
+        * dom/Document.h: Add spec references for body() and bodyOrFrameset() and declare
+        isBodyPotentiallyScrollable().
+        * page/Settings.yaml: Add developer option for enabling the CSSOM View behavior.
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::isOverflowVisible const): Add helper function to check whether the
+        style implies visible overflow.
+
 2018-08-30  Zalan Bujtas  <[email protected]>
 
         CounterMaps should hold a unique_ptr of CounterMap.

Modified: trunk/Source/WebCore/dom/Document.cpp (235538 => 235539)


--- trunk/Source/WebCore/dom/Document.cpp	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebCore/dom/Document.cpp	2018-08-31 07:49:32 UTC (rev 235539)
@@ -1443,11 +1443,47 @@
     return Range::create(*this, node, offset, node, offset);
 }
 
+bool Document::isBodyPotentiallyScrollable(HTMLBodyElement& body)
+{
+    // See https://www.w3.org/TR/cssom-view-1/#potentially-scrollable.
+    // An element is potentially scrollable if all of the following conditions are true:
+    // - The element has an associated CSS layout box.
+    // - The element is not the HTML body element, or it is and the root element's used value of the
+    //   overflow-x or overflow-y properties is not visible.
+    // - The element's used value of the overflow-x or overflow-y properties is not visible.
+    //
+    // FIXME: We should use RenderObject::hasOverflowClip() instead of Element::computedStyle() but
+    // the used values are currently not correctly updated. See https://webkit.org/b/182292.
+    return body.renderer()
+        && documentElement()->computedStyle()
+        && !documentElement()->computedStyle()->isOverflowVisible()
+        && body.computedStyle()
+        && !body.computedStyle()->isOverflowVisible();
+}
+
 Element* Document::scrollingElement()
 {
-    // FIXME: When we fix https://bugs.webkit.org/show_bug.cgi?id=106133, this should be replaced with the full implementation
-    // of Document.scrollingElement() as specified at http://dev.w3.org/csswg/cssom-view/#dom-document-scrollingelement.
+    if (settings().CSSOMViewScrollingAPIEnabled()) {
+        // See https://drafts.csswg.org/cssom-view/#dom-document-scrollingelement.
+        // The scrollingElement attribute, on getting, must run these steps:
+        // 1. If the Document is in quirks mode, follow these substeps:
+        if (inQuirksMode()) {
+            updateLayoutIgnorePendingStylesheets();
+            auto* firstBody = body();
+            // 1. If the HTML body element exists, and it is not potentially scrollable, return the
+            // HTML body element and abort these steps.
+            if (firstBody && !isBodyPotentiallyScrollable(*firstBody))
+                return firstBody;
 
+            // 2. Return null and abort these steps.
+            return nullptr;
+        }
+
+        // 2. If there is a root element, return the root element and abort these steps.
+        // 3. Return null.
+        return documentElement();
+    }
+
     return body();
 }
 
@@ -2704,7 +2740,7 @@
 HTMLBodyElement* Document::body() const
 {
     auto* element = documentElement();
-    if (!element)
+    if (!is<HTMLHtmlElement>(element))
         return nullptr;
     return childrenOfType<HTMLBodyElement>(*element).first();
 }

Modified: trunk/Source/WebCore/dom/Document.h (235538 => 235539)


--- trunk/Source/WebCore/dom/Document.h	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebCore/dom/Document.h	2018-08-31 07:49:32 UTC (rev 235539)
@@ -960,7 +960,12 @@
     static bool hasValidNamespaceForElements(const QualifiedName&);
     static bool hasValidNamespaceForAttributes(const QualifiedName&);
 
+    // This is the "HTML body element" as defined by CSSOM View spec, the first body child of the
+    // document element. See http://dev.w3.org/csswg/cssom-view/#the-html-body-element.
     WEBCORE_EXPORT HTMLBodyElement* body() const;
+
+    // This is the "body element" as defined by HTML5, the first body or frameset child of the
+    // document element. See https://html.spec.whatwg.org/multipage/dom.html#the-body-element-2.
     WEBCORE_EXPORT HTMLElement* bodyOrFrameset() const;
     WEBCORE_EXPORT ExceptionOr<void> setBodyOrFrameset(RefPtr<HTMLElement>&&);
 
@@ -1604,6 +1609,8 @@
 
     void enableTemporaryTimeUserGesture();
 
+    bool isBodyPotentiallyScrollable(HTMLBodyElement&);
+
     const Ref<Settings> m_settings;
 
     std::unique_ptr<StyleResolver> m_userAgentShadowTreeStyleResolver;

Modified: trunk/Source/WebCore/page/Settings.yaml (235538 => 235539)


--- trunk/Source/WebCore/page/Settings.yaml	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebCore/page/Settings.yaml	2018-08-31 07:49:32 UTC (rev 235539)
@@ -554,6 +554,9 @@
 visualViewportAPIEnabled:
   initial: false
 
+CSSOMViewScrollingAPIEnabled:
+  initial: false
+
 inputEventsEnabled:
   initial: true
 

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (235538 => 235539)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2018-08-31 07:49:32 UTC (rev 235539)
@@ -331,6 +331,7 @@
     Overflow overflowY() const { return static_cast<Overflow>(m_nonInheritedFlags.overflowY); }
     Overflow overflowInlineDirection() const { return isHorizontalWritingMode() ? overflowX() : overflowY(); }
     Overflow overflowBlockDirection() const { return isHorizontalWritingMode() ? overflowY() : overflowX(); }
+    bool isOverflowVisible() const { return overflowX() == Overflow::Visible || overflowY() == Overflow::Visible; }
     
     Visibility visibility() const { return static_cast<Visibility>(m_inheritedFlags.visibility); }
     VerticalAlign verticalAlign() const { return static_cast<VerticalAlign>(m_nonInheritedFlags.verticalAlign); }

Modified: trunk/Source/WebKit/ChangeLog (235538 => 235539)


--- trunk/Source/WebKit/ChangeLog	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebKit/ChangeLog	2018-08-31 07:49:32 UTC (rev 235539)
@@ -1,3 +1,18 @@
+2018-08-31  Frederic Wang  <[email protected]>
+
+        Bug 182053 - [CSSOM View] Implement standard behavior for scrollingElement
+        https://bugs.webkit.org/show_bug.cgi?id=182053
+
+        Reviewed by Simon Fraser.
+
+        Add developer flag to use standard behavior for scrolling* attributes.
+
+        * Shared/WebPreferences.yaml:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetCSSOMViewScrollingAPIEnabled):
+        (WKPreferencesGetCSSOMViewScrollingAPIEnabled):
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+
 2018-08-30  Tim Horton  <[email protected]>
 
         One more build fix

Modified: trunk/Source/WebKit/Shared/WebPreferences.yaml (235538 => 235539)


--- trunk/Source/WebKit/Shared/WebPreferences.yaml	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebKit/Shared/WebPreferences.yaml	2018-08-31 07:49:32 UTC (rev 235539)
@@ -1198,6 +1198,13 @@
   humanReadableDescription: "Enable Visual Viewport API"
   category: experimental
 
+CSSOMViewScrollingAPIEnabled:
+  type: bool
+  defaultValue: false
+  humanReadableName: "CSSOM View Scrolling API"
+  humanReadableDescription: "Implement standard behavior for scrollLeft, scrollTop, scrollWidth, scrollHeight, scrollTo, scrollBy and scrollingElement."
+  category: experimental
+
 WebAnimationsEnabled:
   type: bool
   defaultValue: DEFAULT_EXPERIMENTAL_FEATURES_ENABLED

Modified: trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp (235538 => 235539)


--- trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp	2018-08-31 07:49:32 UTC (rev 235539)
@@ -1978,6 +1978,16 @@
     return toImpl(preferencesRef)->ariaReflectionEnabled();
 }
 
+void WKPreferencesSetCSSOMViewScrollingAPIEnabled(WKPreferencesRef preferencesRef, bool flag)
+{
+    toImpl(preferencesRef)->setCSSOMViewScrollingAPIEnabled(flag);
+}
+
+bool WKPreferencesGetCSSOMViewScrollingAPIEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->cssOMViewScrollingAPIEnabled();
+}
+
 void WKPreferencesSetShouldAllowUserInstalledFonts(WKPreferencesRef preferencesRef, bool flag)
 {
     toImpl(preferencesRef)->setShouldAllowUserInstalledFonts(flag);

Modified: trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h (235538 => 235539)


--- trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h	2018-08-31 07:49:32 UTC (rev 235539)
@@ -570,6 +570,10 @@
 WK_EXPORT bool WKPreferencesGetAriaReflectionEnabled(WKPreferencesRef);
 
 // Defaults to false.
+WK_EXPORT void WKPreferencesSetCSSOMViewScrollingAPIEnabled(WKPreferencesRef, bool);
+WK_EXPORT bool WKPreferencesGetCSSOMViewScrollingAPIEnabled(WKPreferencesRef);
+
+// Defaults to false.
 WK_EXPORT void WKPreferencesSetShouldAllowUserInstalledFonts(WKPreferencesRef, bool flag);
 WK_EXPORT bool WKPreferencesGetShouldAllowUserInstalledFonts(WKPreferencesRef);
 

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (235538 => 235539)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2018-08-31 07:49:32 UTC (rev 235539)
@@ -1,3 +1,21 @@
+2018-08-31  Frederic Wang  <[email protected]>
+
+        Bug 182053 - [CSSOM View] Implement standard behavior for scrollingElement
+        https://bugs.webkit.org/show_bug.cgi?id=182053
+
+        Reviewed by Simon Fraser.
+
+        Add developer flag to use standard behavior for scrolling* attributes.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences CSSOMViewScrollingAPIEnabled]):
+        (-[WebPreferences setCSSOMViewScrollingAPIEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2018-08-29  Olivia Barnett  <[email protected]>
 
         Implement the Web Share API

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h (235538 => 235539)


--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h	2018-08-31 07:49:32 UTC (rev 235539)
@@ -182,6 +182,7 @@
 #define WebKitDirectoryUploadEnabledPreferenceKey @"WebKitDirectoryUploadEnabled"
 #define WebKitVisualViewportEnabledPreferenceKey @"WebKitVisualViewportEnabled"
 #define WebKitVisualViewportAPIEnabledPreferenceKey @"WebKitVisualViewportAPIEnabled"
+#define WebKitCSSOMViewScrollingAPIEnabledPreferenceKey @"WebKitCSSOMViewScrollingAPIEnabled"
 #define WebKitModernMediaControlsEnabledPreferenceKey @"WebKitModernMediaControlsEnabled"
 #define WebKitSubtleCryptoEnabledPreferenceKey @"WebKitSubtleCryptoEnabled"
 #define WebKitMediaDevicesEnabledPreferenceKey @"WebKitMediaDevicesEnabled"

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm (235538 => 235539)


--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm	2018-08-31 07:49:32 UTC (rev 235539)
@@ -654,6 +654,7 @@
 #endif
         [NSNumber numberWithBool:NO], WebKitVisualViewportAPIEnabledPreferenceKey,
 
+        [NSNumber numberWithBool:NO], WebKitCSSOMViewScrollingAPIEnabledPreferenceKey,
         [NSNumber numberWithBool:YES], WebKitNeedsStorageAccessFromFileURLsQuirkKey,
         [NSNumber numberWithBool:NO], WebKitAllowCrossOriginSubresourcesToAskForCredentialsKey,
 #if ENABLE(MEDIA_STREAM)
@@ -3092,6 +3093,16 @@
     [self _setBoolValue:flag forKey:WebKitVisualViewportAPIEnabledPreferenceKey];
 }
 
+- (BOOL)CSSOMViewScrollingAPIEnabled
+{
+    return [self _boolValueForKey:WebKitCSSOMViewScrollingAPIEnabledPreferenceKey];
+}
+
+- (void)setCSSOMViewScrollingAPIEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitCSSOMViewScrollingAPIEnabledPreferenceKey];
+}
+
 - (BOOL)webAnimationsEnabled
 {
     return [self _boolValueForKey:WebKitWebAnimationsEnabledPreferenceKey];

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h (235538 => 235539)


--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h	2018-08-31 07:49:32 UTC (rev 235539)
@@ -584,6 +584,7 @@
 
 @property (nonatomic) BOOL visualViewportEnabled;
 @property (nonatomic) BOOL visualViewportAPIEnabled;
+@property (nonatomic) BOOL CSSOMViewScrollingAPIEnabled;
 @property (nonatomic) BOOL largeImageAsyncDecodingEnabled;
 @property (nonatomic) BOOL animatedImageAsyncDecodingEnabled;
 @property (nonatomic) BOOL _javascript_MarkupEnabled;

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (235538 => 235539)


--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2018-08-31 07:49:32 UTC (rev 235539)
@@ -2938,6 +2938,7 @@
 
     settings.setVisualViewportEnabled([preferences visualViewportEnabled]);
     settings.setVisualViewportAPIEnabled([preferences visualViewportAPIEnabled]);
+    settings.setCSSOMViewScrollingAPIEnabled([preferences CSSOMViewScrollingAPIEnabled]);
     settings.setMediaContentTypesRequiringHardwareSupport([preferences mediaContentTypesRequiringHardwareSupport]);
 
     switch ([preferences storageBlockingPolicy]) {

Modified: trunk/Source/WebKitLegacy/win/ChangeLog (235538 => 235539)


--- trunk/Source/WebKitLegacy/win/ChangeLog	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebKitLegacy/win/ChangeLog	2018-08-31 07:49:32 UTC (rev 235539)
@@ -1,3 +1,22 @@
+2018-08-31  Frederic Wang  <[email protected]>
+
+        Bug 182053 - [CSSOM View] Implement standard behavior for scrollingElement
+        https://bugs.webkit.org/show_bug.cgi?id=182053
+
+        Reviewed by Simon Fraser.
+
+        Add developer flag to use standard behavior for scrolling* attributes.
+
+        * Interfaces/IWebPreferencesPrivate.idl:
+        * WebPreferenceKeysPrivate.h:
+        * WebPreferences.cpp:
+        (WebPreferences::initializeDefaultSettings):
+        (WebPreferences::CSSOMViewScrollingAPIEnabled):
+        (WebPreferences::setCSSOMViewScrollingAPIEnabled):
+        * WebPreferences.h:
+        * WebView.cpp:
+        (WebView::notifyPreferencesChanged):
+
 2018-08-30  Don Olmstead  <[email protected]>
 
         [CMake] Replace AVFoundationSupport.py using CMake

Modified: trunk/Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl (235538 => 235539)


--- trunk/Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl	2018-08-31 07:49:32 UTC (rev 235539)
@@ -221,6 +221,8 @@
     HRESULT setInspectorAdditionsEnabled([in] BOOL enabled);
     HRESULT visualViewportAPIEnabled([out, retval] BOOL*);
     HRESULT setVisualViewportAPIEnabled([in] BOOL enabled);
+    HRESULT CSSOMViewScrollingAPIEnabled([out, retval] BOOL*);
+    HRESULT setCSSOMViewScrollingAPIEnabled([in] BOOL enabled);
     HRESULT fetchAPIKeepAliveEnabled([out, retval] BOOL* enabled);
     HRESULT setFetchAPIKeepAliveEnabled([in] BOOL enabled);
     HRESULT spatialNavigationEnabled([out, retval] BOOL *enabled);

Modified: trunk/Source/WebKitLegacy/win/WebPreferenceKeysPrivate.h (235538 => 235539)


--- trunk/Source/WebKitLegacy/win/WebPreferenceKeysPrivate.h	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebKitLegacy/win/WebPreferenceKeysPrivate.h	2018-08-31 07:49:32 UTC (rev 235539)
@@ -205,3 +205,6 @@
 #define WebKitVisualViewportAPIEnabledPreferenceKey "WebKitVisualViewportAPIEnabled"
 
 #define WebKitServerTimingEnabledPreferenceKey "WebKitServerTimingEnabled"
+
+#define WebKitCSSOMViewScrollingAPIEnabledPreferenceKey "WebKitCSSOMViewScrollingAPIEnabled"
+

Modified: trunk/Source/WebKitLegacy/win/WebPreferences.cpp (235538 => 235539)


--- trunk/Source/WebKitLegacy/win/WebPreferences.cpp	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebKitLegacy/win/WebPreferences.cpp	2018-08-31 07:49:32 UTC (rev 235539)
@@ -328,6 +328,8 @@
 
     CFDictionaryAddValue(defaults, CFSTR(WebKitVisualViewportAPIEnabledPreferenceKey), kCFBooleanFalse);
 
+    CFDictionaryAddValue(defaults, CFSTR(WebKitCSSOMViewScrollingAPIEnabledPreferenceKey), kCFBooleanFalse);
+
     defaultSettings = defaults;
 }
 
@@ -2185,6 +2187,20 @@
     return S_OK;
 }
 
+HRESULT WebPreferences::CSSOMViewScrollingAPIEnabled(_Out_ BOOL* enabled)
+{
+    if (!enabled)
+        return E_POINTER;
+    *enabled = boolValueForKey(WebKitCSSOMViewScrollingAPIEnabledPreferenceKey);
+    return S_OK;
+}
+
+HRESULT WebPreferences::setCSSOMViewScrollingAPIEnabled(BOOL enabled)
+{
+    setBoolValue(WebKitCSSOMViewScrollingAPIEnabledPreferenceKey, enabled);
+    return S_OK;
+}
+
 HRESULT WebPreferences::setApplicationId(BSTR applicationId)
 {
     m_applicationId = String(applicationId).createCFString();

Modified: trunk/Source/WebKitLegacy/win/WebPreferences.h (235538 => 235539)


--- trunk/Source/WebKitLegacy/win/WebPreferences.h	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebKitLegacy/win/WebPreferences.h	2018-08-31 07:49:32 UTC (rev 235539)
@@ -269,6 +269,8 @@
     virtual HRESULT STDMETHODCALLTYPE setInspectorAdditionsEnabled(BOOL);
     virtual HRESULT STDMETHODCALLTYPE visualViewportAPIEnabled(_Out_ BOOL*);
     virtual HRESULT STDMETHODCALLTYPE setVisualViewportAPIEnabled(BOOL);
+    virtual HRESULT STDMETHODCALLTYPE CSSOMViewScrollingAPIEnabled(_Out_ BOOL*);
+    virtual HRESULT STDMETHODCALLTYPE setCSSOMViewScrollingAPIEnabled(BOOL);
     virtual HRESULT STDMETHODCALLTYPE fetchAPIKeepAliveEnabled(_Out_ BOOL*);
     virtual HRESULT STDMETHODCALLTYPE setFetchAPIKeepAliveEnabled(BOOL);
     virtual HRESULT STDMETHODCALLTYPE spatialNavigationEnabled(_Out_ BOOL*);

Modified: trunk/Source/WebKitLegacy/win/WebView.cpp (235538 => 235539)


--- trunk/Source/WebKitLegacy/win/WebView.cpp	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Source/WebKitLegacy/win/WebView.cpp	2018-08-31 07:49:32 UTC (rev 235539)
@@ -5284,6 +5284,11 @@
         return hr;
     settings.setCrossOriginWindowPolicySupportEnabled(!!enabled);
 
+    hr = prefsPrivate->CSSOMViewScrollingAPIEnabled(&enabled);
+    if (FAILED(hr))
+        return hr;
+    settings.setCSSOMViewScrollingAPIEnabled(!!enabled);
+
     hr = preferences->privateBrowsingEnabled(&enabled);
     if (FAILED(hr))
         return hr;

Modified: trunk/Tools/ChangeLog (235538 => 235539)


--- trunk/Tools/ChangeLog	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Tools/ChangeLog	2018-08-31 07:49:32 UTC (rev 235539)
@@ -1,3 +1,20 @@
+2018-08-31  Frederic Wang  <[email protected]>
+
+        Bug 182053 - [CSSOM View] Implement standard behavior for scrollingElement
+        https://bugs.webkit.org/show_bug.cgi?id=182053
+
+        Reviewed by Simon Fraser.
+
+        Add FIXMEs comments to add the new developer flag in the future and  disable it for now.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (enableExperimentalFeatures):
+        (resetWebPreferencesToConsistentValues):
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (enableExperimentalFeatures):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::resetPreferencesToConsistentValues):
+
 2018-08-30  Thomas Denney  <[email protected]>
 
         [WHLSL] Fix array indexing behavior

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (235538 => 235539)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2018-08-31 07:49:32 UTC (rev 235539)
@@ -869,6 +869,7 @@
     [preferences setServerTimingEnabled:YES];
     [preferences setIntersectionObserverEnabled:YES];
     preferences.sourceBufferChangeTypeEnabled = YES;
+    // FIXME: CSSOMViewScrollingAPIEnabled
 }
 
 // Called before each test.
@@ -921,6 +922,7 @@
     [preferences setLoadsSiteIconsIgnoringImageLoadingPreference:NO];
     [preferences setFrameFlattening:WebKitFrameFlatteningDisabled];
     [preferences setAsyncFrameScrollingEnabled:NO];
+    [preferences setCSSOMViewScrollingAPIEnabled:NO];
     [preferences setSpatialNavigationEnabled:NO];
     [preferences setMetaRefreshEnabled:YES];
 

Modified: trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp (235538 => 235539)


--- trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2018-08-31 07:49:32 UTC (rev 235539)
@@ -785,6 +785,7 @@
     // FIXME: InputEvents
     // FIXME: SubtleCrypto
     prefsPrivate->setVisualViewportAPIEnabled(TRUE);
+    // FIXME: CSSOMViewScrollingAPI
     prefsPrivate->setWebAnimationsEnabled(TRUE);
     prefsPrivate->setServerTimingEnabled(TRUE);
     // FIXME: WebGL2

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (235538 => 235539)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2018-08-31 07:45:02 UTC (rev 235538)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2018-08-31 07:49:32 UTC (rev 235539)
@@ -791,6 +791,7 @@
     
     WKPreferencesSetAccessibilityObjectModelEnabled(preferences, true);
     WKPreferencesSetAriaReflectionEnabled(preferences, true);
+    WKPreferencesSetCSSOMViewScrollingAPIEnabled(preferences, false);
     WKPreferencesSetMediaCapabilitiesEnabled(preferences, true);
 
     WKPreferencesSetCrossOriginWindowPolicyEnabled(preferences, true);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to