[CSSOM View] Handle the scrollingElement in Element::scroll(Left/Top/Width/Height/To)
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Sep 2018 21:12:41 +0000 (21:12 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Sep 2018 21:12:41 +0000 (21:12 +0000)
commita5daad5c2cd6a4aa52820c27f0a0249b7eadd441
tree630689d67add21289217f7c17d05a93a94e8a628
parent7b28dd9051d51b44f6e4d8c547519cc713331792
[CSSOM View] Handle the scrollingElement in Element::scroll(Left/Top/Width/Height/To)
https://bugs.webkit.org/show_bug.cgi?id=182230

Patch by Frederic Wang <fwang@igalia.com> on 2018-09-07
Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

This commit updates expectations for some WPT tests so that they have only PASS results.
Note that css/cssom-view/scrollingElement-quirks-dynamic-*.html still fail for now (bug 182292).

* web-platform-tests/css/cssom-view/HTMLBody-ScrollArea_quirksmode-expected.txt:
* web-platform-tests/css/cssom-view/scrolling-quirks-vs-nonquirks-expected.txt:
* web-platform-tests/css/cssom-view/scrollingElement-expected.txt: Added.

Source/WebCore:

This commit moves the special logic for "scrolling element" body from the
HtmlBodyElement::scroll(Left/Top/Width/Height/To) functions to the Element class. The code
is executed when the element is the scrolling element which includes the case of body
in Quirks mode and of documentElement in standard mode. This makes the behavior closer to
the CSSOM View spec (bug 5991) while not deviating too much from the current implementation.
Finally, CSSOMViewScrollingAPI is now enabled for running tests and some adjustments are made
to existing tests. Further improvements will be performed in dependencies of bug 5991.

No new tests, already covered by existing tests.

* dom/Document.cpp: Split scrollingElement into two functions so that one can be called
internally without updating the layout.
(WebCore::Document::scrollingElement):
(WebCore::Document::scrollingElementForAPI):
* dom/Document.h: Ditto.
* dom/Document.idl: Use the version updating the layout for API calls.
* dom/Element.cpp: Add include to call DOMWindow::ScrollTo
(WebCore::Element::scrollTo): Moved some logic from HtmlBodyElement to handle the case of
the scrolling element. Also skip special handling of documentElement() when
CSSOMViewScrollingAPI is disabled.
(WebCore::adjustContentsScrollPositionOrSizeForZoom): Moved some logic from HtmlBodyElement
to handle the case of the scrolling element. Also add a FIXME for improving these kinds of
helper functions. Renamed to make more explicit the semantic of the value argument.
(WebCore::Element::scrollLeft): Moved some logic from HtmlBodyElement to handle the case of
the scrolling element. Use the new documentFrameWithNonNullView() helper function.
(WebCore::Element::scrollTop): Ditto.
(WebCore::Element::setScrollLeft): Ditto
(WebCore::Element::setScrollTop): Ditto.
(WebCore::Element::scrollWidth): Ditto.
(WebCore::Element::scrollHeight): Ditto.
* dom/Element.h:
(WebCore::Document::documentFrameWithNonNullView): New helper function to retrieve the
frame and ensure a view is available.
* html/HTMLBodyElement.cpp: Remove code that is now in Element.
* html/HTMLBodyElement.h: Ditto.

Source/WebKit:

* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp:
(webkit_dom_document_get_scrolling_element): Use the new name.

Source/WebKitLegacy/mac:

* DOM/DOMDocument.mm:
(-[DOMDocument scrollingElement]): Use the new name.

Tools:

This patch enables CSSOMViewScrollingAPI during test execution.

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

LayoutTests:

This commit updates some tests to work when CSSOMViewScrollingAPI is enabled.

* TestExpectations: Enable web-platform-tests/cssom-view/scrollingElement.html.
* fast/dom/Document/scrollingElement-quirks-mode.html: Do not enable explictly enable
CSSOMViewScrollingAPI.
* fast/dom/Document/scrollingElement-standards-mode.html: Ditto.
* fast/dom/Element/body-scrollLeft-expected.txt: Updated to follow the CSSOMView spec.
* fast/dom/Element/body-scrollLeft.html: Ditto.
* fast/dom/Element/body-scrollTop-expected.txt: Ditto.
* fast/dom/Element/body-scrollTop.html: Ditto.
* fast/dom/Element/documentElement-scrollLeft-expected.txt: Ditto.
* fast/dom/Element/documentElement-scrollLeft.html: Ditto.
* fast/dom/Element/documentElement-scrollTop-expected.txt: Ditto.
* fast/dom/Element/documentElement-scrollTop.html: Ditto.
* fast/dom/Element/scrollLeft-expected.txt: Ditto.
* fast/dom/Element/scrollLeft.html: Ditto.
* fast/dom/Element/scrollTop-expected.txt: Ditto.
* fast/dom/Element/scrollTop.html: Ditto.
* fast/dom/Element/scrolling-funtions-on-body-expected.txt: Ditto.
* fast/dom/Element/scrolling-funtions-on-body.html: Ditto.
* platform/ios/TestExpectations: Add expectation for one WPT test that was already failing
on iOS.
* platform/ios/ios/fast/coordinates/page-offsets-expected.txt: Use documentElement instead
of body for this test when running in standard mode.
* platform/ios/ios/fast/coordinates/resources/helpers.js: Ditto.
(verifyScrollOffsets):
* tiled-drawing/scrolling/fast-scroll-div-latched-mainframe.html: Use
document.scrollingElement instead of document.body to access viewport scroll offset.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235806 268f45cc-cd09-0410-ab3c-d52691b4dbfc
43 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/fast/dom/Document/scrollingElement-quirks-mode.html
LayoutTests/fast/dom/Document/scrollingElement-standards-mode.html
LayoutTests/fast/dom/Element/body-scrollLeft-expected.txt
LayoutTests/fast/dom/Element/body-scrollLeft.html
LayoutTests/fast/dom/Element/body-scrollTop-expected.txt
LayoutTests/fast/dom/Element/body-scrollTop.html
LayoutTests/fast/dom/Element/documentElement-scrollLeft-expected.txt
LayoutTests/fast/dom/Element/documentElement-scrollLeft.html
LayoutTests/fast/dom/Element/documentElement-scrollTop-expected.txt
LayoutTests/fast/dom/Element/documentElement-scrollTop.html
LayoutTests/fast/dom/Element/scrollLeft-expected.txt
LayoutTests/fast/dom/Element/scrollLeft.html
LayoutTests/fast/dom/Element/scrollTop-expected.txt
LayoutTests/fast/dom/Element/scrollTop.html
LayoutTests/fast/dom/Element/scrolling-funtions-on-body-expected.txt
LayoutTests/fast/dom/Element/scrolling-funtions-on-body.html
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/HTMLBody-ScrollArea_quirksmode-expected.txt
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrolling-quirks-vs-nonquirks-expected.txt
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollingElement-expected.txt [new file with mode: 0644]
LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom-view/scrolling-quirks-vs-nonquirks-expected.txt [deleted file]
LayoutTests/platform/ios/TestExpectations
LayoutTests/platform/ios/ios/fast/coordinates/page-offsets-expected.txt
LayoutTests/platform/ios/ios/fast/coordinates/resources/helpers.js
LayoutTests/tiled-drawing/scrolling/fast-scroll-div-latched-mainframe.html
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Document.idl
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/html/HTMLBodyElement.cpp
Source/WebCore/html/HTMLBodyElement.h
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMDocumentGtk.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/DOM/DOMDocument.mm
Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/DumpRenderTree/win/DumpRenderTree.cpp
Tools/WebKitTestRunner/TestController.cpp