Add basic support for ScrollIntoViewOptions
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Sep 2018 05:19:58 +0000 (05:19 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Sep 2018 05:19:58 +0000 (05:19 +0000)
commit4730ae1915e193750c4cc745c6804cdc20620bbb
treec2442030e3fd5ff84d2b5dcd812f4d2a30e25b22
parentf2058e5793f0e9eb59911fd056b2c7b1301f0bf3
Add basic support for ScrollIntoViewOptions
https://bugs.webkit.org/show_bug.cgi?id=189258

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

LayoutTests/imported/w3c:

Update test expectations for WPT scrollIntoView tests.

* web-platform-tests/css/cssom-view/scrollIntoView-scrollMargin-expected.txt: This is not
supported yet but update the error message.
* web-platform-tests/css/cssom-view/scrollIntoView-scrollPadding-expected.txt: Ditto.
* web-platform-tests/css/cssom-view/scrollIntoView-shadow-expected.txt: Update expectation
now that this test passes.
* web-platform-tests/css/cssom-view/scrollIntoView-smooth-expected.txt: Ditto.
* web-platform-tests/css/cssom-view/scrollintoview-expected.txt: Ditto.

Source/WebCore:

This patch introduces a new ScrollIntoViewOptions parameter that can be passed into
Element.scrollIntoView instead of a boolean. A basic support for scroll alignments is
implemented, so that it is closer to the behavior of the CSSOMView spec while still remaining
compatible with the current boolean-parameter implementation. Full implementation that
takes into account orientation/direction will be handled in bug 161611. This patch is also a
preliminary step to support the ScrollBehavior (bug 188043) for ScrollIntoView.

Tests: web-platform-tests/css/cssom-view/scrollintoview-html
       web-platform-tests/css/cssom-view/scrollIntoView-smooth.html

* CMakeLists.txt: Add new IDL files.
* DerivedSources.make: Ditto.
* Sources.txt: Add new generated cpp JS bindings.
* WebCore.xcodeproj/project.pbxproj: Add files to build to XCode.
* dom/Element.cpp:
(WebCore::toScrollAlignment): Convert ScrollLogicalPosition to scroll alignment. Orientation
and direction are not implemented yet.
(WebCore::Element::scrollIntoView): Implement new scrollIntoView version accepting
ScrollIntoViewOptions parameter.
* dom/Element.h: Declare new scrollIntoView.
* dom/Element.idl: Make scrollIntoView accept a ScrollIntoViewOptions parameter.
* page/ScrollIntoViewOptions.h: Added.
* page/ScrollIntoViewOptions.idl: Added.
* page/ScrollLogicalPosition.h: Added.
* page/ScrollLogicalPosition.idl: Added.

Source/WebKit:

* DOM/DOMElement.mm: Add ScrollIntoViewOptions
header so that this file can build despite the new scrollIntoView function.

Source/WebKitLegacy/mac:

* WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementGtk.cpp: Add ScrollIntoViewOptions
header so that this file can build despite the new scrollIntoView function.

Source/WebKitLegacy/win:

* DOMCoreClasses.cpp: Add ScrollIntoViewOptions header so that this file
can build despite the new scrollIntoView function.

LayoutTests:

Update test expectations for WPT scrollIntoView tests.

* platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-smooth-expected.txt: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235659 268f45cc-cd09-0410-ab3c-d52691b4dbfc
26 files changed:
LayoutTests/ChangeLog
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-scrollMargin-expected.txt
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-scrollPadding-expected.txt
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-shadow-expected.txt
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-smooth-expected.txt
LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollintoview-expected.txt
LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-smooth-expected.txt [deleted file]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/Element.idl
Source/WebCore/page/ScrollIntoViewOptions.h [new file with mode: 0644]
Source/WebCore/page/ScrollIntoViewOptions.idl [new file with mode: 0644]
Source/WebCore/page/ScrollLogicalPosition.h [new file with mode: 0644]
Source/WebCore/page/ScrollLogicalPosition.idl [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElementGtk.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/DOM/DOMElement.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/DOMCoreClasses.cpp