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