WebKit Bugzilla
Attachment 358313 Details for
Bug 188043
: Add support for ScrollOptions' ScrollBehavior and CSS scroll-behavior properties
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
0001-Bug-188043-Add-support-for-ScrollOptions-ScrollBehav.patch (text/plain), 132.31 KB, created by
Frédéric Wang (:fredw)
on 2019-01-04 05:31:45 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Frédéric Wang (:fredw)
Created:
2019-01-04 05:31:45 PST
Size:
132.31 KB
patch
obsolete
>From 8cf30716761b5c648716a8d6e1d5e9cf4c180c5a Mon Sep 17 00:00:00 2001 >From: Frederic Wang <fwang@igalia.com> >Date: Fri, 30 Nov 2018 08:31:28 +0100 >Subject: [PATCH xserver] Bug 188043 - Add support for ScrollOptions' > ScrollBehavior and CSS scroll-behavior properties > >--- > LayoutTests/ChangeLog | 10 ++ > LayoutTests/imported/w3c/ChangeLog | 25 +++ > .../scroll-behavior-default-css-expected.txt | 2 +- > .../scroll-behavior-default-css.html | 2 +- > .../scroll-behavior-element-expected.txt | 32 ++-- > .../cssom-view/scroll-behavior-element.html | 2 +- > ...roll-behavior-main-frame-root-expected.txt | 32 ++-- > .../scroll-behavior-main-frame-root.html | 2 +- > ...ll-behavior-main-frame-window-expected.txt | 24 +-- > .../scroll-behavior-main-frame-window.html | 2 +- > ...ehavior-scrollintoview-nested-expected.txt | 4 +- > ...scroll-behavior-scrollintoview-nested.html | 2 +- > .../scroll-behavior-smooth-positions.html | 2 +- > ...scroll-behavior-subframe-root-expected.txt | 32 ++-- > .../scroll-behavior-subframe-root.html | 2 +- > ...roll-behavior-subframe-window-expected.txt | 24 +-- > .../scroll-behavior-subframe-window.html | 2 +- > LayoutTests/platform/mac-wk1/TestExpectations | 6 + > Source/WebCore/CMakeLists.txt | 2 + > Source/WebCore/ChangeLog | 144 ++++++++++++++++++ > Source/WebCore/DerivedSources.make | 2 + > Source/WebCore/Sources.txt | 4 + > Source/WebCore/SourcesGTK.txt | 1 - > .../WebCore/WebCore.xcodeproj/project.pbxproj | 28 ++++ > .../css/CSSComputedStyleDeclaration.cpp | 5 + > Source/WebCore/css/CSSProperties.json | 16 ++ > Source/WebCore/css/CSSValueKeywords.in | 4 + > Source/WebCore/css/StyleBuilderConverter.h | 6 + > .../WebCore/css/parser/CSSParserContext.cpp | 2 + > Source/WebCore/css/parser/CSSParserContext.h | 4 +- > .../WebCore/css/parser/CSSParserFastPaths.cpp | 5 - > .../WebCore/css/parser/CSSPropertyParser.cpp | 12 ++ > Source/WebCore/dom/Element.cpp | 29 +++- > Source/WebCore/page/DOMWindow.cpp | 14 +- > Source/WebCore/page/ScrollBehavior.cpp | 48 ++++++ > Source/WebCore/page/ScrollBehavior.h | 34 +++++ > Source/WebCore/page/ScrollBehavior.idl | 20 +++ > Source/WebCore/page/ScrollIntoViewOptions.h | 5 +- > Source/WebCore/page/ScrollIntoViewOptions.idl | 3 +- > Source/WebCore/page/ScrollOptions.h | 30 ++++ > Source/WebCore/page/ScrollOptions.idl | 22 +++ > Source/WebCore/page/ScrollToOptions.h | 13 +- > Source/WebCore/page/ScrollToOptions.idl | 3 +- > Source/WebCore/page/Settings.yaml | 3 + > Source/WebCore/platform/ScrollAnimation.h | 3 + > .../platform/ScrollAnimationKinetic.cpp | 5 + > .../WebCore/platform/ScrollAnimationKinetic.h | 1 + > .../platform/ScrollAnimationSmooth.cpp | 26 +++- > .../WebCore/platform/ScrollAnimationSmooth.h | 8 +- > Source/WebCore/platform/ScrollAnimator.cpp | 48 ++++++ > Source/WebCore/platform/ScrollAnimator.h | 15 +- > Source/WebCore/platform/ScrollView.cpp | 6 +- > Source/WebCore/platform/ScrollableArea.cpp | 11 ++ > Source/WebCore/platform/ScrollableArea.h | 2 + > .../WebCore/platform/mac/ScrollAnimatorMac.mm | 1 + > Source/WebCore/rendering/RenderBox.cpp | 8 + > Source/WebCore/rendering/RenderBox.h | 1 + > Source/WebCore/rendering/RenderLayer.cpp | 39 ++++- > Source/WebCore/rendering/RenderLayer.h | 3 + > Source/WebCore/rendering/style/RenderStyle.h | 6 + > .../style/StyleRareNonInheritedData.cpp | 3 + > .../style/StyleRareNonInheritedData.h | 2 + > Source/WebCore/testing/Internals.cpp | 2 +- > Source/WebKit/ChangeLog | 11 ++ > Source/WebKit/Shared/WebPreferences.yaml | 8 +- > Source/WebKitLegacy/mac/ChangeLog | 17 +++ > .../mac/WebView/WebPreferenceKeysPrivate.h | 1 + > .../mac/WebView/WebPreferences.mm | 11 ++ > .../mac/WebView/WebPreferencesPrivate.h | 1 + > Source/WebKitLegacy/mac/WebView/WebView.mm | 1 + > Source/WebKitLegacy/win/ChangeLog | 17 +++ > .../win/Interfaces/IWebPreferencesPrivate.idl | 2 + > .../win/WebPreferenceKeysPrivate.h | 1 + > Source/WebKitLegacy/win/WebPreferences.cpp | 16 ++ > Source/WebKitLegacy/win/WebPreferences.h | 2 + > Source/WebKitLegacy/win/WebView.cpp | 5 + > Tools/ChangeLog | 11 ++ > Tools/DumpRenderTree/TestOptions.cpp | 2 + > Tools/DumpRenderTree/TestOptions.h | 1 + > Tools/DumpRenderTree/mac/DumpRenderTree.mm | 1 + > 80 files changed, 832 insertions(+), 132 deletions(-) > create mode 100644 Source/WebCore/page/ScrollBehavior.cpp > create mode 100644 Source/WebCore/page/ScrollBehavior.h > create mode 100644 Source/WebCore/page/ScrollBehavior.idl > create mode 100644 Source/WebCore/page/ScrollOptions.h > create mode 100644 Source/WebCore/page/ScrollOptions.idl > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 893fd43ca84..0d21f583df2 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,13 @@ >+2018-11-07 Frederic Wang <fwang@igalia.com> >+ >+ Add support for ScrollOptions' ScrollBehavior and CSS scroll-behavior properties >+ https://bugs.webkit.org/show_bug.cgi?id=188043 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * platform/mac-wk1/TestExpectations: Skip these tests on WK1 as they don't work for now and >+ are slow anyway. >+ > 2019-01-03 Zalan Bujtas <zalan@apple.com> > > REGRESSION: -webkit-appearance test case crashes >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index 6a43ef63a38..152008b008e 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,28 @@ >+2018-11-06 Frederic Wang <fwang@igalia.com> >+ >+ Add support for ScrollOptions' ScrollBehavior and CSS scroll-behavior properties >+ https://bugs.webkit.org/show_bug.cgi?id=188043 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Enable CSSOMViewSmoothScrollingEnabled on scroll behavior tests and update expectations. >+ >+ * web-platform-tests/css/cssom-view/scroll-behavior-default-css-expected.txt: >+ * web-platform-tests/css/cssom-view/scroll-behavior-default-css.html: >+ * web-platform-tests/css/cssom-view/scroll-behavior-element-expected.txt: >+ * web-platform-tests/css/cssom-view/scroll-behavior-element.html: >+ * web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root-expected.txt: >+ * web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root.html: >+ * web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window-expected.txt: >+ * web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window.html: >+ * web-platform-tests/css/cssom-view/scroll-behavior-scrollintoview-nested-expected.txt: >+ * web-platform-tests/css/cssom-view/scroll-behavior-scrollintoview-nested.html: >+ * web-platform-tests/css/cssom-view/scroll-behavior-smooth-positions.html: >+ * web-platform-tests/css/cssom-view/scroll-behavior-subframe-root-expected.txt: >+ * web-platform-tests/css/cssom-view/scroll-behavior-subframe-root.html: >+ * web-platform-tests/css/cssom-view/scroll-behavior-subframe-window-expected.txt: >+ * web-platform-tests/css/cssom-view/scroll-behavior-subframe-window.html: >+ > 2019-01-02 Simon Fraser <simon.fraser@apple.com> > > Support css-color-4 rgb functions >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-default-css-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-default-css-expected.txt >index 9068b797552..8d4ca64155f 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-default-css-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-default-css-expected.txt >@@ -1,4 +1,4 @@ > > PASS Instant scrolling of an element with default scroll-behavior >-FAIL Smooth scrolling of an element with default scroll-behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Smooth scrolling of an element with default scroll-behavior > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-default-css.html b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-default-css.html >index 8606b1f3ed4..eed63a06932 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-default-css.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-default-css.html >@@ -1,4 +1,4 @@ >-<!DOCTYPE html> >+<!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSOMViewSmoothScrollingEnabled=true ] --> > <title>Testing default value of scroll-behavior</title> > <meta name="timeout" content="long"/> > <link rel="author" title="Frédéric Wang" href="mailto:fwang@igalia.com"> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-element-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-element-expected.txt >index 2b9129c1cf4..53a961ef56a 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-element-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-element-expected.txt >@@ -2,35 +2,35 @@ > PASS Element with auto scroll-behavior ; scroll() with default behavior > PASS Element with auto scroll-behavior ; scroll() with auto behavior > PASS Element with auto scroll-behavior ; scroll() with instant behavior >-FAIL Element with auto scroll-behavior ; scroll() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Element with smooth scroll-behavior ; scroll() with default behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Element with smooth scroll-behavior ; scroll() with auto behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Element with auto scroll-behavior ; scroll() with smooth behavior >+PASS Element with smooth scroll-behavior ; scroll() with default behavior >+PASS Element with smooth scroll-behavior ; scroll() with auto behavior > PASS Element with smooth scroll-behavior ; scroll() with instant behavior >-FAIL Element with smooth scroll-behavior ; scroll() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Element with smooth scroll-behavior ; scroll() with smooth behavior > PASS Element with auto scroll-behavior ; scrollTo() with default behavior > PASS Element with auto scroll-behavior ; scrollTo() with auto behavior > PASS Element with auto scroll-behavior ; scrollTo() with instant behavior >-FAIL Element with auto scroll-behavior ; scrollTo() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Element with smooth scroll-behavior ; scrollTo() with default behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Element with smooth scroll-behavior ; scrollTo() with auto behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Element with auto scroll-behavior ; scrollTo() with smooth behavior >+PASS Element with smooth scroll-behavior ; scrollTo() with default behavior >+PASS Element with smooth scroll-behavior ; scrollTo() with auto behavior > PASS Element with smooth scroll-behavior ; scrollTo() with instant behavior >-FAIL Element with smooth scroll-behavior ; scrollTo() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Element with smooth scroll-behavior ; scrollTo() with smooth behavior > PASS Element with auto scroll-behavior ; scrollBy() with default behavior > PASS Element with auto scroll-behavior ; scrollBy() with auto behavior > PASS Element with auto scroll-behavior ; scrollBy() with instant behavior >-FAIL Element with auto scroll-behavior ; scrollBy() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Element with smooth scroll-behavior ; scrollBy() with default behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Element with smooth scroll-behavior ; scrollBy() with auto behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Element with auto scroll-behavior ; scrollBy() with smooth behavior >+PASS Element with smooth scroll-behavior ; scrollBy() with default behavior >+PASS Element with smooth scroll-behavior ; scrollBy() with auto behavior > PASS Element with smooth scroll-behavior ; scrollBy() with instant behavior >-FAIL Element with smooth scroll-behavior ; scrollBy() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Element with smooth scroll-behavior ; scrollBy() with smooth behavior > PASS Element with auto scroll-behavior ; scrollIntoView() with default behavior > PASS Element with auto scroll-behavior ; scrollIntoView() with auto behavior > PASS Element with auto scroll-behavior ; scrollIntoView() with instant behavior >-FAIL Element with auto scroll-behavior ; scrollIntoView() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Element with smooth scroll-behavior ; scrollIntoView() with default behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Element with smooth scroll-behavior ; scrollIntoView() with auto behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Element with auto scroll-behavior ; scrollIntoView() with smooth behavior >+PASS Element with smooth scroll-behavior ; scrollIntoView() with default behavior >+PASS Element with smooth scroll-behavior ; scrollIntoView() with auto behavior > PASS Element with smooth scroll-behavior ; scrollIntoView() with instant behavior >-FAIL Element with smooth scroll-behavior ; scrollIntoView() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Element with smooth scroll-behavior ; scrollIntoView() with smooth behavior > PASS Aborting an ongoing smooth scrolling on an element with another smooth scrolling > PASS Aborting an ongoing smooth scrolling on an element with an instant scrolling > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-element.html b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-element.html >index 9f60ca77112..556b66c824f 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-element.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-element.html >@@ -1,4 +1,4 @@ >-<!DOCTYPE html> >+<!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSOMViewSmoothScrollingEnabled=true ] --> > <title>Testing scrollOptions' behavior for Element.scroll* and scroll-behavior on an element</title> > <meta name="timeout" content="long"/> > <link rel="author" title="Frédéric Wang" href="mailto:fwang@igalia.com"> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root-expected.txt >index d922258af27..97caea27bb5 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root-expected.txt >@@ -3,35 +3,35 @@ PASS Page loaded > PASS Main frame with auto scroll-behavior ; scroll() with default behavior > PASS Main frame with auto scroll-behavior ; scroll() with auto behavior > PASS Main frame with auto scroll-behavior ; scroll() with instant behavior >-FAIL Main frame with auto scroll-behavior ; scroll() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >-FAIL Main frame with smooth scroll-behavior ; scroll() with default behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >-FAIL Main frame with smooth scroll-behavior ; scroll() with auto behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >+PASS Main frame with auto scroll-behavior ; scroll() with smooth behavior >+PASS Main frame with smooth scroll-behavior ; scroll() with default behavior >+PASS Main frame with smooth scroll-behavior ; scroll() with auto behavior > PASS Main frame with smooth scroll-behavior ; scroll() with instant behavior >-FAIL Main frame with smooth scroll-behavior ; scroll() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >+PASS Main frame with smooth scroll-behavior ; scroll() with smooth behavior > PASS Main frame with auto scroll-behavior ; scrollTo() with default behavior > PASS Main frame with auto scroll-behavior ; scrollTo() with auto behavior > PASS Main frame with auto scroll-behavior ; scrollTo() with instant behavior >-FAIL Main frame with auto scroll-behavior ; scrollTo() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >-FAIL Main frame with smooth scroll-behavior ; scrollTo() with default behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >-FAIL Main frame with smooth scroll-behavior ; scrollTo() with auto behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >+PASS Main frame with auto scroll-behavior ; scrollTo() with smooth behavior >+PASS Main frame with smooth scroll-behavior ; scrollTo() with default behavior >+PASS Main frame with smooth scroll-behavior ; scrollTo() with auto behavior > PASS Main frame with smooth scroll-behavior ; scrollTo() with instant behavior >-FAIL Main frame with smooth scroll-behavior ; scrollTo() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >+PASS Main frame with smooth scroll-behavior ; scrollTo() with smooth behavior > PASS Main frame with auto scroll-behavior ; scrollBy() with default behavior > PASS Main frame with auto scroll-behavior ; scrollBy() with auto behavior > PASS Main frame with auto scroll-behavior ; scrollBy() with instant behavior >-FAIL Main frame with auto scroll-behavior ; scrollBy() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >-FAIL Main frame with smooth scroll-behavior ; scrollBy() with default behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >-FAIL Main frame with smooth scroll-behavior ; scrollBy() with auto behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >+PASS Main frame with auto scroll-behavior ; scrollBy() with smooth behavior >+PASS Main frame with smooth scroll-behavior ; scrollBy() with default behavior >+PASS Main frame with smooth scroll-behavior ; scrollBy() with auto behavior > PASS Main frame with smooth scroll-behavior ; scrollBy() with instant behavior >-FAIL Main frame with smooth scroll-behavior ; scrollBy() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >+PASS Main frame with smooth scroll-behavior ; scrollBy() with smooth behavior > PASS Main frame with auto scroll-behavior ; scrollIntoView() with default behavior > PASS Main frame with auto scroll-behavior ; scrollIntoView() with auto behavior > PASS Main frame with auto scroll-behavior ; scrollIntoView() with instant behavior >-FAIL Main frame with auto scroll-behavior ; scrollIntoView() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >-FAIL Main frame with smooth scroll-behavior ; scrollIntoView() with default behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >-FAIL Main frame with smooth scroll-behavior ; scrollIntoView() with auto behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >+PASS Main frame with auto scroll-behavior ; scrollIntoView() with smooth behavior >+PASS Main frame with smooth scroll-behavior ; scrollIntoView() with default behavior >+PASS Main frame with smooth scroll-behavior ; scrollIntoView() with auto behavior > PASS Main frame with smooth scroll-behavior ; scrollIntoView() with instant behavior >-FAIL Main frame with smooth scroll-behavior ; scrollIntoView() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >+PASS Main frame with smooth scroll-behavior ; scrollIntoView() with smooth behavior > PASS Aborting an ongoing smooth scrolling on the main frame with another smooth scrolling > PASS Aborting an ongoing smooth scrolling on the main frame with an instant scrolling > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root.html b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root.html >index 7ef0a4aa0da..188863ff82c 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root.html >@@ -1,4 +1,4 @@ >-<!DOCTYPE html> >+<!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSOMViewSmoothScrollingEnabled=true ] --> > <title>Testing scrollOptions' behavior for Element.scroll* and scroll-behavior on the root of the main frame</title> > <meta name="timeout" content="long"/> > <link rel="author" title="Frédéric Wang" href="mailto:fwang@igalia.com"> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window-expected.txt >index c6be96661c2..382385aab49 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window-expected.txt >@@ -3,27 +3,27 @@ PASS Page loaded > PASS Main frame with auto scroll-behavior ; scroll() with default behavior > PASS Main frame with auto scroll-behavior ; scroll() with auto behavior > PASS Main frame with auto scroll-behavior ; scroll() with instant behavior >-FAIL Main frame with auto scroll-behavior ; scroll() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >-FAIL Main frame with smooth scroll-behavior ; scroll() with default behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >-FAIL Main frame with smooth scroll-behavior ; scroll() with auto behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >+PASS Main frame with auto scroll-behavior ; scroll() with smooth behavior >+PASS Main frame with smooth scroll-behavior ; scroll() with default behavior >+PASS Main frame with smooth scroll-behavior ; scroll() with auto behavior > PASS Main frame with smooth scroll-behavior ; scroll() with instant behavior >-FAIL Main frame with smooth scroll-behavior ; scroll() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >+PASS Main frame with smooth scroll-behavior ; scroll() with smooth behavior > PASS Main frame with auto scroll-behavior ; scrollTo() with default behavior > PASS Main frame with auto scroll-behavior ; scrollTo() with auto behavior > PASS Main frame with auto scroll-behavior ; scrollTo() with instant behavior >-FAIL Main frame with auto scroll-behavior ; scrollTo() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >-FAIL Main frame with smooth scroll-behavior ; scrollTo() with default behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >-FAIL Main frame with smooth scroll-behavior ; scrollTo() with auto behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >+PASS Main frame with auto scroll-behavior ; scrollTo() with smooth behavior >+PASS Main frame with smooth scroll-behavior ; scrollTo() with default behavior >+PASS Main frame with smooth scroll-behavior ; scrollTo() with auto behavior > PASS Main frame with smooth scroll-behavior ; scrollTo() with instant behavior >-FAIL Main frame with smooth scroll-behavior ; scrollTo() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >+PASS Main frame with smooth scroll-behavior ; scrollTo() with smooth behavior > PASS Main frame with auto scroll-behavior ; scrollBy() with default behavior > PASS Main frame with auto scroll-behavior ; scrollBy() with auto behavior > PASS Main frame with auto scroll-behavior ; scrollBy() with instant behavior >-FAIL Main frame with auto scroll-behavior ; scrollBy() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >-FAIL Main frame with smooth scroll-behavior ; scrollBy() with default behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >-FAIL Main frame with smooth scroll-behavior ; scrollBy() with auto behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >+PASS Main frame with auto scroll-behavior ; scrollBy() with smooth behavior >+PASS Main frame with smooth scroll-behavior ; scrollBy() with default behavior >+PASS Main frame with smooth scroll-behavior ; scrollBy() with auto behavior > PASS Main frame with smooth scroll-behavior ; scrollBy() with instant behavior >-FAIL Main frame with smooth scroll-behavior ; scrollBy() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 2430 but got 2430 >+PASS Main frame with smooth scroll-behavior ; scrollBy() with smooth behavior > PASS Aborting an ongoing smooth scrolling on the main frame with another smooth scrolling > PASS Aborting an ongoing smooth scrolling on the main frame with an instant scrolling > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window.html b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window.html >index 57b0d913461..23e298dfdf0 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window.html >@@ -1,4 +1,4 @@ >-<!DOCTYPE html> >+<!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSOMViewSmoothScrollingEnabled=true ] --> > <title>Testing scrollOptions' behavior for Element.scroll* on the window of the main frame</title> > <meta name="timeout" content="long"/> > <link rel="author" title="Frédéric Wang" href="mailto:fwang@igalia.com"> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-scrollintoview-nested-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-scrollintoview-nested-expected.txt >index 7ce10c08961..a3a51d3e6ab 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-scrollintoview-nested-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-scrollintoview-nested-expected.txt >@@ -1,3 +1,5 @@ > >-FAIL scrollIntoView with nested elements with different scroll-behavior assert_less_than: Element with smooth behavior should not scroll immediately expected a number less than 500 but got 500 >+FAIL scrollIntoView with nested elements with different scroll-behavior assert_equals: Element with instant behavior should jump to the final position expected 0 but got 1000 >+ >+assert_equals: Element with instant behavior should jump to the final position expected 500 but got 1000 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-scrollintoview-nested.html b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-scrollintoview-nested.html >index 2a97e065663..ece539b3352 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-scrollintoview-nested.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-scrollintoview-nested.html >@@ -1,4 +1,4 @@ >-<!DOCTYPE html> >+<!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSOMViewSmoothScrollingEnabled=true ] --> > <title>Testing scrollOptions' behavior with scrollIntoView for nested scrolling nodes</title> > <meta name="timeout" content="long"/> > <link rel="author" title="Frédéric Wang" href="mailto:fwang@igalia.com"> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-smooth-positions.html b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-smooth-positions.html >index 19e317d5e4b..b610a47b5c7 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-smooth-positions.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-smooth-positions.html >@@ -1,4 +1,4 @@ >-<!DOCTYPE html> >+<!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSOMViewSmoothScrollingEnabled=true ] --> > <title>Testing scroll positions when scrolling an element with smooth behavior</title> > <meta name="timeout" content="long"/> > <link rel="author" title="Frédéric Wang" href="mailto:fwang@igalia.com"> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-root-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-root-expected.txt >index b6fa1c2ec8b..2799fdcc29e 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-root-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-root-expected.txt >@@ -3,35 +3,35 @@ PASS iframe loaded > PASS Subframe with auto scroll-behavior ; scroll() with default behavior > PASS Subframe with auto scroll-behavior ; scroll() with auto behavior > PASS Subframe with auto scroll-behavior ; scroll() with instant behavior >-FAIL Subframe with auto scroll-behavior ; scroll() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Subframe with smooth scroll-behavior ; scroll() with default behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Subframe with smooth scroll-behavior ; scroll() with auto behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Subframe with auto scroll-behavior ; scroll() with smooth behavior >+PASS Subframe with smooth scroll-behavior ; scroll() with default behavior >+PASS Subframe with smooth scroll-behavior ; scroll() with auto behavior > PASS Subframe with smooth scroll-behavior ; scroll() with instant behavior >-FAIL Subframe with smooth scroll-behavior ; scroll() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Subframe with smooth scroll-behavior ; scroll() with smooth behavior > PASS Subframe with auto scroll-behavior ; scrollTo() with default behavior > PASS Subframe with auto scroll-behavior ; scrollTo() with auto behavior > PASS Subframe with auto scroll-behavior ; scrollTo() with instant behavior >-FAIL Subframe with auto scroll-behavior ; scrollTo() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Subframe with smooth scroll-behavior ; scrollTo() with default behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Subframe with smooth scroll-behavior ; scrollTo() with auto behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Subframe with auto scroll-behavior ; scrollTo() with smooth behavior >+PASS Subframe with smooth scroll-behavior ; scrollTo() with default behavior >+PASS Subframe with smooth scroll-behavior ; scrollTo() with auto behavior > PASS Subframe with smooth scroll-behavior ; scrollTo() with instant behavior >-FAIL Subframe with smooth scroll-behavior ; scrollTo() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Subframe with smooth scroll-behavior ; scrollTo() with smooth behavior > PASS Subframe with auto scroll-behavior ; scrollBy() with default behavior > PASS Subframe with auto scroll-behavior ; scrollBy() with auto behavior > PASS Subframe with auto scroll-behavior ; scrollBy() with instant behavior >-FAIL Subframe with auto scroll-behavior ; scrollBy() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Subframe with smooth scroll-behavior ; scrollBy() with default behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Subframe with smooth scroll-behavior ; scrollBy() with auto behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Subframe with auto scroll-behavior ; scrollBy() with smooth behavior >+PASS Subframe with smooth scroll-behavior ; scrollBy() with default behavior >+PASS Subframe with smooth scroll-behavior ; scrollBy() with auto behavior > PASS Subframe with smooth scroll-behavior ; scrollBy() with instant behavior >-FAIL Subframe with smooth scroll-behavior ; scrollBy() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Subframe with smooth scroll-behavior ; scrollBy() with smooth behavior > PASS Subframe with auto scroll-behavior ; scrollIntoView() with default behavior > PASS Subframe with auto scroll-behavior ; scrollIntoView() with auto behavior > PASS Subframe with auto scroll-behavior ; scrollIntoView() with instant behavior >-FAIL Subframe with auto scroll-behavior ; scrollIntoView() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Subframe with smooth scroll-behavior ; scrollIntoView() with default behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Subframe with smooth scroll-behavior ; scrollIntoView() with auto behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Subframe with auto scroll-behavior ; scrollIntoView() with smooth behavior >+PASS Subframe with smooth scroll-behavior ; scrollIntoView() with default behavior >+PASS Subframe with smooth scroll-behavior ; scrollIntoView() with auto behavior > PASS Subframe with smooth scroll-behavior ; scrollIntoView() with instant behavior >-FAIL Subframe with smooth scroll-behavior ; scrollIntoView() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Subframe with smooth scroll-behavior ; scrollIntoView() with smooth behavior > PASS Aborting an ongoing smooth scrolling on a subframe with another smooth scrolling > PASS Aborting an ongoing smooth scrolling on a subframe with an instant scrolling > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-root.html b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-root.html >index 32de1b62038..d36c9d03bff 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-root.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-root.html >@@ -1,4 +1,4 @@ >-<!DOCTYPE html> >+<!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSOMViewSmoothScrollingEnabled=true ] --> > <title>Testing scrollOptions' behavior for Element.scroll* and scroll-behavior on the root of a subframe</title> > <meta name="timeout" content="long"/> > <link rel="author" title="Frédéric Wang" href="mailto:fwang@igalia.com"> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-window-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-window-expected.txt >index cc665ebdb8b..05eb3272f40 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-window-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-window-expected.txt >@@ -3,27 +3,27 @@ PASS iframe loaded > PASS Main frame with auto scroll-behavior ; scroll() with default behavior > PASS Main frame with auto scroll-behavior ; scroll() with auto behavior > PASS Main frame with auto scroll-behavior ; scroll() with instant behavior >-FAIL Main frame with auto scroll-behavior ; scroll() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Main frame with smooth scroll-behavior ; scroll() with default behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Main frame with smooth scroll-behavior ; scroll() with auto behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Main frame with auto scroll-behavior ; scroll() with smooth behavior >+PASS Main frame with smooth scroll-behavior ; scroll() with default behavior >+PASS Main frame with smooth scroll-behavior ; scroll() with auto behavior > PASS Main frame with smooth scroll-behavior ; scroll() with instant behavior >-FAIL Main frame with smooth scroll-behavior ; scroll() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Main frame with smooth scroll-behavior ; scroll() with smooth behavior > PASS Main frame with auto scroll-behavior ; scrollTo() with default behavior > PASS Main frame with auto scroll-behavior ; scrollTo() with auto behavior > PASS Main frame with auto scroll-behavior ; scrollTo() with instant behavior >-FAIL Main frame with auto scroll-behavior ; scrollTo() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Main frame with smooth scroll-behavior ; scrollTo() with default behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Main frame with smooth scroll-behavior ; scrollTo() with auto behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Main frame with auto scroll-behavior ; scrollTo() with smooth behavior >+PASS Main frame with smooth scroll-behavior ; scrollTo() with default behavior >+PASS Main frame with smooth scroll-behavior ; scrollTo() with auto behavior > PASS Main frame with smooth scroll-behavior ; scrollTo() with instant behavior >-FAIL Main frame with smooth scroll-behavior ; scrollTo() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Main frame with smooth scroll-behavior ; scrollTo() with smooth behavior > PASS Main frame with auto scroll-behavior ; scrollBy() with default behavior > PASS Main frame with auto scroll-behavior ; scrollBy() with auto behavior > PASS Main frame with auto scroll-behavior ; scrollBy() with instant behavior >-FAIL Main frame with auto scroll-behavior ; scrollBy() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Main frame with smooth scroll-behavior ; scrollBy() with default behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >-FAIL Main frame with smooth scroll-behavior ; scrollBy() with auto behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Main frame with auto scroll-behavior ; scrollBy() with smooth behavior >+PASS Main frame with smooth scroll-behavior ; scrollBy() with default behavior >+PASS Main frame with smooth scroll-behavior ; scrollBy() with auto behavior > PASS Main frame with smooth scroll-behavior ; scrollBy() with instant behavior >-FAIL Main frame with smooth scroll-behavior ; scrollBy() with smooth behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 >+PASS Main frame with smooth scroll-behavior ; scrollBy() with smooth behavior > PASS Aborting an ongoing smooth scrolling on the main frame with another smooth scrolling > PASS Aborting an ongoing smooth scrolling on the main frame with an instant scrolling > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-window.html b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-window.html >index 0a8ed39d1b9..74aec5467ff 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-window.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-window.html >@@ -1,4 +1,4 @@ >-<!DOCTYPE html> >+<!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSOMViewSmoothScrollingEnabled=true ] --> > <title>Testing scrollOptions' behavior for Element.scroll* and scroll-behavior on the root of a subframe</title> > <meta name="timeout" content="long"/> > <link rel="author" title="Frédéric Wang" href="mailto:fwang@igalia.com"> >diff --git a/LayoutTests/platform/mac-wk1/TestExpectations b/LayoutTests/platform/mac-wk1/TestExpectations >index 0dfb6d44981..c6da978b067 100644 >--- a/LayoutTests/platform/mac-wk1/TestExpectations >+++ b/LayoutTests/platform/mac-wk1/TestExpectations >@@ -643,6 +643,12 @@ css-custom-properties-api [ Skip ] > css-typedom [ Skip ] > css-dark-mode [ Skip ] > >+# Tests for smooth scroll behavior do not all work and they are slow, so let's just skip them. >+webkit.org/b/191357 imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root.html [ Skip ] >+webkit.org/b/191357 imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window.html [ Skip ] >+webkit.org/b/191357 imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-root.html [ Skip ] >+webkit.org/b/191357 imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-window.html [ Skip ] >+ > webkit.org/b/189908 imported/w3c/web-platform-tests/resource-timing/resource_timing.worker.html [ Failure ] > > webkit.org/b/189756 [ Mojave+ ] compositing/filters/opacity-change-on-filtered-paints-into-ancestor.html [ Pass ImageOnlyFailure ] >diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt >index 9c51418af76..22cf8685d48 100644 >--- a/Source/WebCore/CMakeLists.txt >+++ b/Source/WebCore/CMakeLists.txt >@@ -919,8 +919,10 @@ set(WebCore_NON_SVG_IDL_FILES > page/PerformanceTiming.idl > page/RemoteDOMWindow.idl > page/Screen.idl >+ page/ScrollBehavior.idl > page/ScrollIntoViewOptions.idl > page/ScrollLogicalPosition.idl >+ page/ScrollOptions.idl > page/ScrollToOptions.idl > page/ShareData.idl > page/VisualViewport.idl >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index a3920592b9b..25f9d9aed71 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,147 @@ >+2018-11-09 Frederic Wang <fwang@igalia.com> >+ >+ Add support for ScrollOptions' ScrollBehavior and CSS scroll-behavior properties >+ https://bugs.webkit.org/show_bug.cgi?id=188043 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch introduces a programmatic smooth scrolling in WebKit from the CSSOM View >+ specification [1]. To use this effect, web developers can pass a behavior parameter (auto, >+ smooth, or instant) to Element.scroll, Element.scrollTo, Element.scrollBy, >+ Element.scrollIntoView, Window.scroll, Window.scrollTo or Window.scrollBy [2]. When behavior >+ is auto, the instant/smooth characteristic is actually taken from the value of a new CSS >+ scroll-behavior property [3]. Both the new CSS and DOM behavior are protected by a runtime >+ flag. The Element.scrollIntoView part will be refined later in bug 189907. The actual >+ animation relies on the existing ScrollAnimationSmooth. >+ >+ [1] https://drafts.csswg.org/cssom-view >+ [2] https://drafts.csswg.org/cssom-view/#dictdef-scrolloptions >+ [3] https://drafts.csswg.org/cssom-view/#propdef-scroll-behavior >+ >+ Add support for ScrollOptions' ScrollBehavior and CSS scroll-behavior properties >+ >+ Tests: imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-default-css.html >+ imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-element.html >+ imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root.html >+ imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window.html >+ imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-scrollintoview-nested.html >+ imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-smooth-positions.html >+ imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-root.html >+ imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-window.html >+ >+ * CMakeLists.txt: Add IDL files for ScrollOptions and ScrollBehavior. >+ * DerivedSources.make: Ditto. >+ * Sources.txt: Add ScrollBehavor and ScrollOptions implementation. Also build >+ ScrollAnimationSmooth.cpp on all platforms. >+ * SourcesGTK.txt: Remove ScrollAnimationSmooth.cpp since it is built on all platforms now. >+ * WebCore.xcodeproj/project.pbxproj: Add files to the build system. >+ * css/CSSComputedStyleDeclaration.cpp: Handle scroll-behavior. >+ (WebCore::ComputedStyleExtractor::valueForPropertyinStyle): >+ * css/CSSProperties.json: Add scroll-behavior. >+ * css/CSSValueKeywords.in: Add keywords for scroll-behavior. >+ * css/StyleBuilderConverter.h: >+ (WebCore::StyleBuilderConverter::convertSmoothScrolling): New function to convert >+ scroll-behavior into a "is smooth" boolean. >+ * css/parser/CSSParserContext.cpp: Add runtime config for scroll-behavior. >+ (WebCore::CSSParserContext::CSSParserContext): >+ (WebCore::operator==): >+ * css/parser/CSSParserContext.h: Ditto. >+ (WebCore::CSSParserContextHash::hash): >+ * css/parser/CSSParserFastPaths.cpp: Remove scroll-behavior templates. It is handled in the >+ slow path since property can be disabled. >+ (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): >+ (WebCore::CSSParserFastPaths::isKeywordPropertyID): >+ * css/parser/CSSPropertyParser.cpp: >+ (WebCore::CSSPropertyParser::parseSingleValue): Parse scroll-behavior (only if enabled). >+ * dom/Element.cpp: >+ (WebCore::Element::scrollIntoView): Pass scroll behavior, if any. >+ (WebCore::Element::scrollBy): Use fromCoordinates helper function. >+ (WebCore::Element::scrollTo): Handle the case when scroll behavior is smooth. Use >+ fromCoordinates helper function. >+ * page/DOMWindow.cpp: >+ (WebCore::DOMWindow::scrollBy const): Use fromCoordinates helper function. >+ (WebCore::DOMWindow::scrollTo const): Use fromCoordinates helper function. Handle the case >+ when scroll behavior is smooth. The optimization when scroll position is (0, 0) is skipped >+ when a scroll is in progress, otherwise such a scroll can't be cancelled by a follow-up >+ scroll. >+ * page/ScrollBehavior.cpp: Added. >+ (WebCore::useSmoothScrolling): Helper funciton to determine the scroll behavior to apply to >+ an element from the CSS and DOM behavior. >+ * page/ScrollBehavior.h: Added. >+ * page/ScrollBehavior.idl: Added. >+ * page/ScrollIntoViewOptions.h: Make this class inherits from ScrollOption. Also remove >+ unnecessary forward declaration. >+ * page/ScrollIntoViewOptions.idl: Make this class inherits from ScrollOption. >+ * page/ScrollOptions.h: Added. >+ * page/ScrollOptions.idl: Added. >+ * page/ScrollToOptions.h: Make this struct inherits from ScrollOptions. >+ (WebCore::fromCoordinates): New helper function to generate a ScrollToOptions with undefined >+ behavior. This is necessary to replace curly brace { x, y } declarations now that there is >+ an extra behavior member from the parent class. >+ (WebCore::normalizeNonFiniteCoordinatesOrFallBackTo): Copy the current ScrollToOptions so >+ that the scroll behavior is preserved. >+ * page/ScrollToOptions.idl: Make this class inherit from ScrollOptions. >+ * page/Settings.yaml: New setting for CSSOM View smooth scrolling. >+ * platform/ScrollAnimation.h: >+ (WebCore::ScrollAnimation::scroll): Function to animate scrolling to a specified position. >+ (WebCore::ScrollAnimation::isScrollInProgress const): >+ * platform/ScrollAnimationKinetic.cpp: >+ (WebCore::ScrollAnimationKinetic::isScrollInProgress const): >+ * platform/ScrollAnimationKinetic.h: >+ * platform/ScrollAnimationSmooth.cpp: Build this file on all platforms. Add a >+ smoothFactorForProgrammaticScroll parameter to slow down the smooth scrolling. >+ (WebCore::ScrollAnimationSmooth::scroll): >+ (WebCore::ScrollAnimationSmooth::updatePerAxisData): Scale the time parameters of the >+ animation so that it looks smoother. >+ * platform/ScrollAnimationSmooth.h: Declare the class on all platforms. >+ * platform/ScrollAnimator.cpp: >+ (WebCore::ScrollAnimator::ScrollAnimator): Initialize animation member for programmatic scrolling. >+ (WebCore::ScrollAnimator::isScrollInProgress const): For now, only claims scroll is in >+ progress if smooth programmatic scroll is in progress. >+ (WebCore::ScrollAnimator::scrollToOffset): Animate scrolling to the specified position. >+ (WebCore::ScrollAnimator::cancelAnimations): Copy logic from ScrollAnimationSmooth.cpp. >+ (WebCore::ScrollAnimator::serviceScrollAnimations): Ditto. >+ (WebCore::ScrollAnimator::willEndLiveResize): Ditto. >+ (WebCore::ScrollAnimator::didAddVerticalScrollbar): Ditto. >+ (WebCore::ScrollAnimator::didAddHorizontalScrollbar): Ditto. >+ * platform/ScrollAnimator.h: New animation member for smooth programmatic scrolling. >+ * platform/ScrollAnimatorMac.mm: >+ (WebCore::ScrollAnimatorMac::cancelAnimations): Call parent member to handle programmatic scrolling. >+ * platform/ScrollView.cpp: >+ (WebCore::ScrollView::setScrollPosition): Follow the CSSOM View spec: If a scroll is in >+ progress, we interrupt it and continue the scroll call (even when we are at the final >+ position). >+ * platform/ScrollableArea.cpp: >+ (WebCore::ScrollableArea::isScrollInProgress const): Helper function to check whether scroll >+ is in progress on the animator. If m_scrollAnimator does not exist we don't construct it. >+ (WebCore::ScrollableArea::scrollToOffsetWithAnimation): >+ * platform/ScrollableArea.h: >+ * rendering/RenderBox.cpp: >+ (WebCore::RenderBox::scrollToPositionWithAnimation): Similar to setScrollTop/setScrollLeft >+ but animate the scrolling. >+ * rendering/RenderBox.h: >+ * rendering/RenderLayer.cpp: >+ (WebCore::RenderLayer::scrollToOffset): Follow the CSSOM View spec: If a scroll is in >+ progress, we interrupt it and continue the scroll call (even when we are at the final >+ position). >+ (WebCore::RenderLayer::scrollToOffsetWithAnimation): Ditto. This is similar to scrollToOffset >+ but animates the scroll. >+ (WebCore::RenderLayer::scrollRectToVisible): Again don't do an early return if scroll is in >+ progress. We call scrollToOffsetWithAnimation instead of scrollToOffset when appropriate. >+ Note that this function may not work well for several nested scroll boxes with at least one >+ element with smooth behavior. It will handled in bug Follow. >+ * rendering/RenderLayer.h: Add scroll behavior to ScrollTectToVisibleOptions. >+ * rendering/style/RenderStyle.h: Handle 'smooth scrolling' boolean data. >+ (WebCore::RenderStyle::useSmoothScrolling const): >+ (WebCore::RenderStyle::setUseSmoothScrolling): >+ (WebCore::RenderStyle::initialUseSmoothScrolling): >+ * rendering/style/StyleRareNonInheritedData.cpp: Ditto. >+ (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): >+ (WebCore::StyleRareNonInheritedData::operator== const): >+ * rendering/style/StyleRareNonInheritedData.h: Ditto. >+ * testing/Internals.cpp: >+ (WebCore::Internals::unconstrainedScrollTo): Use fromCoordinates helper function. >+ > 2019-01-03 Zalan Bujtas <zalan@apple.com> > > REGRESSION: -webkit-appearance test case crashes >diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make >index e948b702f37..eb7c7f53993 100644 >--- a/Source/WebCore/DerivedSources.make >+++ b/Source/WebCore/DerivedSources.make >@@ -868,8 +868,10 @@ JS_BINDING_IDLS = \ > $(WebCore)/page/PerformanceTiming.idl \ > $(WebCore)/page/RemoteDOMWindow.idl \ > $(WebCore)/page/Screen.idl \ >+ $(WebCore)/page/ScrollBehavior.idl \ > $(WebCore)/page/ScrollIntoViewOptions.idl \ > $(WebCore)/page/ScrollLogicalPosition.idl \ >+ $(WebCore)/page/ScrollOptions.idl \ > $(WebCore)/page/ScrollToOptions.idl \ > $(WebCore)/page/ShareData.idl \ > $(WebCore)/page/UserMessageHandler.idl \ >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index e7d934ad27f..697614b9327 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -1481,6 +1481,7 @@ page/ResourceUsageOverlay.cpp > page/ResourceUsageThread.cpp > page/RuntimeEnabledFeatures.cpp > page/Screen.cpp >+page/ScrollBehavior.cpp > page/SecurityOrigin.cpp > page/SecurityOriginData.cpp > page/SecurityPolicy.cpp >@@ -1579,6 +1580,7 @@ platform/RuntimeApplicationChecks.cpp > platform/SSLKeyGenerator.cpp > platform/SchemeRegistry.cpp > platform/ScrollAnimator.cpp >+platform/ScrollAnimationSmooth.cpp > platform/ScrollView.cpp > platform/ScrollableArea.cpp > platform/Scrollbar.cpp >@@ -3163,8 +3165,10 @@ JSSVGZoomEvent.cpp > JSScreen.cpp > JSScreenLuminance.cpp > JSScriptProcessorNode.cpp >+JSScrollBehavior.cpp > JSScrollIntoViewOptions.cpp > JSScrollLogicalPosition.cpp >+JSScrollOptions.cpp > JSScrollToOptions.cpp > JSSecurityPolicyViolationEvent.cpp > JSServiceWorker.cpp >diff --git a/Source/WebCore/SourcesGTK.txt b/Source/WebCore/SourcesGTK.txt >index 5e2356dbb66..85c6bbbbd27 100644 >--- a/Source/WebCore/SourcesGTK.txt >+++ b/Source/WebCore/SourcesGTK.txt >@@ -56,7 +56,6 @@ page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp > page/scrolling/generic/ScrollingThreadGeneric.cpp > > platform/ScrollAnimationKinetic.cpp >-platform/ScrollAnimationSmooth.cpp > platform/UserAgentQuirks.cpp > > platform/generic/ScrollAnimatorGeneric.cpp >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index de452c062a6..939b4fc693e 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -2398,6 +2398,8 @@ > 83407FC11E8D9C1700E048D3 /* VisibilityChangeClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 83407FC01E8D9C1200E048D3 /* VisibilityChangeClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 834476EF1DA5BC5E002B5EB0 /* JSScrollLogicalPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E9B3011DA5A51E00FFD8D4 /* JSScrollLogicalPosition.h */; }; > 834476EF1DA5BC5E002B5EC1 /* JSScrollIntoViewOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E9B3011DA5A51E00FFD8E5 /* JSScrollIntoViewOptions.h */; }; >+ 834476EF1DA5BC5E002B6EB0 /* JSScrollBehavior.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E9B3011DA5A51E00FFE8D4 /* JSScrollBehavior.h */; }; >+ 834476EF1DA5BC5E002B6EC1 /* JSScrollOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E9B3011DA5A51E00FFE8E5 /* JSScrollOptions.h */; }; > 834476EF1DA5BC5E002B6ED2 /* JSScrollToOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E9B3011DA5A51E00FFE8F6 /* JSScrollToOptions.h */; }; > 8348BFAC1B85729800912F36 /* ClassCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 8348BFAA1B85729500912F36 /* ClassCollection.h */; }; > 834DFAD01F7DAE5D00C2725B /* SharedStringHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 834DFACC1F7DAE5600C2725B /* SharedStringHash.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -2472,6 +2474,8 @@ > 83C45B8E1DC2B68A008871BA /* ValidationBubble.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C45B8D1DC2B67C008871BA /* ValidationBubble.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 83C5795D1DA5C301006F9C86 /* ScrollLogicalPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = 8350C3E71DA59B6200355424 /* ScrollLogicalPosition.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 83C5795D1DA5C301006F9C97 /* ScrollIntoViewOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 8350C3E71DA59B6200355435 /* ScrollIntoViewOptions.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 83C5795D1DA5C301006FAC86 /* ScrollBehavior.h in Headers */ = {isa = PBXBuildFile; fileRef = 8350C3E71DA59B6200356424 /* ScrollBehavior.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 83C5795D1DA5C301006FAC97 /* ScrollOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 8350C3E71DA59B6200356435 /* ScrollOptions.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 83C5795D1DA5C301006FACA8 /* ScrollToOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 8350C3E71DA59B6200356446 /* ScrollToOptions.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 83D35AEC1C7187FA00F70D5A /* XMLHttpRequestEventTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D35AEA1C7187ED00F70D5A /* XMLHttpRequestEventTarget.h */; }; > 83D35AF21C718D9000F70D5A /* JSXMLHttpRequestEventTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D35AF01C718D8400F70D5A /* JSXMLHttpRequestEventTarget.h */; }; >@@ -9971,6 +9975,12 @@ > 834DFACE1F7DAE5700C2725B /* SharedStringHash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedStringHash.cpp; sourceTree = "<group>"; }; > 8350C3E71DA59B6200355424 /* ScrollLogicalPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollLogicalPosition.h; sourceTree = "<group>"; }; > 8350C3E71DA59B6200355435 /* ScrollIntoViewOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollIntoViewOptions.h; sourceTree = "<group>"; }; >+ 8350C3E81DA59B6200355435 /* ScrollIntoViewOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ScrollIntoViewOptions.idl; sourceTree = "<group>"; }; >+ 8350C3E71DA59B6200356424 /* ScrollBehavior.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollBehavior.h; sourceTree = "<group>"; }; >+ 8350C3E71DA59B6200356434 /* ScrollBehavior.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollBehavior.cpp; sourceTree = "<group>"; }; >+ 8350C3E81DA59B6200356424 /* ScrollBehavior.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ScrollBehavior.idl; sourceTree = "<group>"; }; >+ 8350C3E71DA59B6200356435 /* ScrollOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollOptions.h; sourceTree = "<group>"; }; >+ 8350C3E81DA59B6200356435 /* ScrollOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ScrollOptions.idl; sourceTree = "<group>"; }; > 8350C3E71DA59B6200356446 /* ScrollToOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollToOptions.h; sourceTree = "<group>"; }; > 8350C3E81DA59B6200355424 /* ScrollLogicalPosition.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ScrollLogicalPosition.idl; sourceTree = "<group>"; }; > 8350C3E81DA59B6200355435 /* ScrollIntoViewOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ScrollIntoViewOptions.idl; sourceTree = "<group>"; }; >@@ -10112,6 +10122,11 @@ > 83E959E11B8BC22B004D9385 /* NativeNodeFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeNodeFilter.h; sourceTree = "<group>"; }; > 83E9B3001DA5A51E00FFD8D4 /* JSScrollLogicalPosition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScrollLogicalPosition.cpp; sourceTree = "<group>"; }; > 83E9B3001DA5A51E00FFD8E5 /* JSScrollIntoViewOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScrollIntoViewOptions.cpp; sourceTree = "<group>"; }; >+ 83E9B3011DA5A51E00FFD8E5 /* JSScrollIntoViewOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScrollIntoViewOptions.h; sourceTree = "<group>"; }; >+ 83E9B3001DA5A51E00FFE8D4 /* JSScrollBehavior.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScrollBehavior.cpp; sourceTree = "<group>"; }; >+ 83E9B3011DA5A51E00FFE8D4 /* JSScrollBehavior.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScrollBehavior.h; sourceTree = "<group>"; }; >+ 83E9B3001DA5A51E00FFE8E5 /* JSScrollOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScrollOptions.cpp; sourceTree = "<group>"; }; >+ 83E9B3011DA5A51E00FFE8E5 /* JSScrollOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScrollOptions.h; sourceTree = "<group>"; }; > 83E9B3001DA5A51E00FFE8F6 /* JSScrollToOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScrollToOptions.cpp; sourceTree = "<group>"; }; > 83E9B3011DA5A51E00FFD8D4 /* JSScrollLogicalPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScrollLogicalPosition.h; sourceTree = "<group>"; }; > 83E9B3011DA5A51E00FFD8E5 /* JSScrollIntoViewOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScrollIntoViewOptions.h; sourceTree = "<group>"; }; >@@ -20078,10 +20093,15 @@ > BCEC01BA0C274DAC009F4EC9 /* Screen.cpp */, > BCEC01BB0C274DAC009F4EC9 /* Screen.h */, > BCEC01BC0C274DAC009F4EC9 /* Screen.idl */, >+ 8350C3E71DA59B6200356434 /* ScrollBehavior.cpp */, >+ 8350C3E71DA59B6200356424 /* ScrollBehavior.h */, >+ 8350C3E81DA59B6200356424 /* ScrollBehavior.idl */, > 8350C3E71DA59B6200355435 /* ScrollIntoViewOptions.h */, > 8350C3E81DA59B6200355435 /* ScrollIntoViewOptions.idl */, > 8350C3E71DA59B6200355424 /* ScrollLogicalPosition.h */, > 8350C3E81DA59B6200355424 /* ScrollLogicalPosition.idl */, >+ 8350C3E71DA59B6200356435 /* ScrollOptions.h */, >+ 8350C3E81DA59B6200356435 /* ScrollOptions.idl */, > 8350C3E71DA59B6200356446 /* ScrollToOptions.h */, > 8350C3E81DA59B6200356446 /* ScrollToOptions.idl */, > BCD0E0F70E972C3500265DEA /* SecurityOrigin.cpp */, >@@ -24823,10 +24843,14 @@ > 46C376612085176D00C73829 /* JSRemoteDOMWindow.h */, > BCEC01C00C274DDD009F4EC9 /* JSScreen.cpp */, > BCEC01C10C274DDD009F4EC9 /* JSScreen.h */, >+ 83E9B3001DA5A51E00FFE8D4 /* JSScrollBehavior.cpp */, >+ 83E9B3011DA5A51E00FFE8D4 /* JSScrollBehavior.h */, > 83E9B3001DA5A51E00FFD8E5 /* JSScrollIntoViewOptions.cpp */, > 83E9B3011DA5A51E00FFD8E5 /* JSScrollIntoViewOptions.h */, > 83E9B3001DA5A51E00FFD8D4 /* JSScrollLogicalPosition.cpp */, > 83E9B3011DA5A51E00FFD8D4 /* JSScrollLogicalPosition.h */, >+ 83E9B3001DA5A51E00FFE8E5 /* JSScrollOptions.cpp */, >+ 83E9B3011DA5A51E00FFE8E5 /* JSScrollOptions.h */, > 83E9B3001DA5A51E00FFE8F6 /* JSScrollToOptions.cpp */, > 83E9B3011DA5A51E00FFE8F6 /* JSScrollToOptions.h */, > 7C73FB0F191EF6F4007DE061 /* JSUserMessageHandler.cpp */, >@@ -29812,8 +29836,10 @@ > 5E2C436C1BCF071E0001E2BC /* JSRTCTrackEvent.h in Headers */, > BCEC01C30C274DDD009F4EC9 /* JSScreen.h in Headers */, > FDA15ECE12B03F61003A583A /* JSScriptProcessorNode.h in Headers */, >+ 834476EF1DA5BC5E002B6EB0 /* JSScrollBehavior.h in Headers */, > 834476EF1DA5BC5E002B5EC1 /* JSScrollIntoViewOptions.h in Headers */, > 834476EF1DA5BC5E002B5EB0 /* JSScrollLogicalPosition.h in Headers */, >+ 834476EF1DA5BC5E002B6EC1 /* JSScrollOptions.h in Headers */, > 834476EF1DA5BC5E002B6ED2 /* JSScrollToOptions.h in Headers */, > CED06AD11C77754800FDFAF1 /* JSSecurityPolicyViolationEvent.h in Headers */, > 5182C2561F3143CD0059BA7C /* JSServiceWorker.h in Headers */, >@@ -30980,6 +31006,7 @@ > 44C991860F3D1EBE00586670 /* ScrollbarThemeIOS.h in Headers */, > BC8B853E0E7C7F1100AB6984 /* ScrollbarThemeMac.h in Headers */, > 0FE71406142170B800DB33BA /* ScrollbarThemeMock.h in Headers */, >+ 83C5795D1DA5C301006FAC86 /* ScrollBehavior.h in Headers */, > 1AA84F05143BA7BD0051D153 /* ScrollController.h in Headers */, > 0F605AED15F94848004DF0C0 /* ScrollingConstraints.h in Headers */, > 1AF62EE814DA22A70041556C /* ScrollingCoordinator.h in Headers */, >@@ -31010,6 +31037,7 @@ > 83C5795D1DA5C301006F9C97 /* ScrollIntoViewOptions.h in Headers */, > 7AAFE8D019CB8672000F56D8 /* ScrollLatchingState.h in Headers */, > 83C5795D1DA5C301006F9C86 /* ScrollLogicalPosition.h in Headers */, >+ 83C5795D1DA5C301006FAC97 /* ScrollOptions.h in Headers */, > F478755419983AFF0024A287 /* ScrollSnapAnimatorState.h in Headers */, > F46729281E0DE68500ACC3D8 /* ScrollSnapOffsetsInfo.h in Headers */, > 83C5795D1DA5C301006FACA8 /* ScrollToOptions.h in Headers */, >diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >index 9ebc3abbee6..64ad6ae90d3 100644 >--- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >+++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >@@ -382,6 +382,7 @@ static const CSSPropertyID computedProperties[] = { > #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) > CSSPropertyWebkitOverflowScrolling, > #endif >+ CSSPropertyScrollBehavior, > CSSPropertyPerspective, > CSSPropertyPerspectiveOrigin, > CSSPropertyWebkitPrintColorAdjust, >@@ -3707,6 +3708,10 @@ RefPtr<CSSValue> ComputedStyleExtractor::valueForPropertyinStyle(const RenderSty > return cssValuePool.createIdentifierValue(CSSValueAuto); > return cssValuePool.createIdentifierValue(CSSValueTouch); > #endif >+ case CSSPropertyScrollBehavior: >+ if (!style.useSmoothScrolling()) >+ return cssValuePool.createIdentifierValue(CSSValueAuto); >+ return cssValuePool.createIdentifierValue(CSSValueSmooth); > case CSSPropertyPerspective: > if (!style.hasPerspective()) > return cssValuePool.createIdentifierValue(CSSValueNone); >diff --git a/Source/WebCore/css/CSSProperties.json b/Source/WebCore/css/CSSProperties.json >index fe012ba4b22..cd2fb194ad8 100644 >--- a/Source/WebCore/css/CSSProperties.json >+++ b/Source/WebCore/css/CSSProperties.json >@@ -6259,6 +6259,22 @@ > "url": "https://www.w3.org/TR/css-ui-4/#propdef-user-select" > } > }, >+ "scroll-behavior": { >+ "values": [ >+ "auto", >+ "smooth" >+ ], >+ "codegen-properties": { >+ "converter": "SmoothScrolling", >+ "name-for-methods": "UseSmoothScrolling" >+ }, >+ "status": { >+ "status": "experimental" >+ }, >+ "specification": { >+ "url": "https://drafts.csswg.org/cssom-view/#propdef-scroll-behavior" >+ } >+ }, > "scroll-padding": { > "codegen-properties": { > "enable-if": "ENABLE_CSS_SCROLL_SNAP", >diff --git a/Source/WebCore/css/CSSValueKeywords.in b/Source/WebCore/css/CSSValueKeywords.in >index 86b5e5914f4..9bbaa4b0ad0 100644 >--- a/Source/WebCore/css/CSSValueKeywords.in >+++ b/Source/WebCore/css/CSSValueKeywords.in >@@ -1357,6 +1357,10 @@ scroll-position > manipulation > #endif > >+// scroll-behavior >+// auto >+smooth >+ > // hanging-punctuation > allow-end > first >diff --git a/Source/WebCore/css/StyleBuilderConverter.h b/Source/WebCore/css/StyleBuilderConverter.h >index da000d3af01..25ae7353cf9 100644 >--- a/Source/WebCore/css/StyleBuilderConverter.h >+++ b/Source/WebCore/css/StyleBuilderConverter.h >@@ -120,6 +120,7 @@ public: > #if ENABLE(ACCELERATED_OVERFLOW_SCROLLING) > static bool convertOverflowScrolling(StyleResolver&, const CSSValue&); > #endif >+ static bool convertSmoothScrolling(StyleResolver&, const CSSValue&); > static FontFeatureSettings convertFontFeatureSettings(StyleResolver&, const CSSValue&); > static FontSelectionValue convertFontWeightFromValue(const CSSValue&); > static FontSelectionValue convertFontStretchFromValue(const CSSValue&); >@@ -1354,6 +1355,11 @@ inline bool StyleBuilderConverter::convertOverflowScrolling(StyleResolver&, cons > } > #endif > >+inline bool StyleBuilderConverter::convertSmoothScrolling(StyleResolver&, const CSSValue& value) >+{ >+ return downcast<CSSPrimitiveValue>(value).valueID() == CSSValueSmooth; >+} >+ > inline SVGLengthValue StyleBuilderConverter::convertSVGLengthValue(StyleResolver&, const CSSValue& value) > { > return SVGLengthValue::fromCSSPrimitiveValue(downcast<CSSPrimitiveValue>(value)); >diff --git a/Source/WebCore/css/parser/CSSParserContext.cpp b/Source/WebCore/css/parser/CSSParserContext.cpp >index 06c702a0db4..005a2605a85 100644 >--- a/Source/WebCore/css/parser/CSSParserContext.cpp >+++ b/Source/WebCore/css/parser/CSSParserContext.cpp >@@ -73,6 +73,7 @@ CSSParserContext::CSSParserContext(const Document& document, const URL& sheetBas > attachmentEnabled = RuntimeEnabledFeatures::sharedFeatures().attachmentElementEnabled(); > #endif > deferredCSSParserEnabled = document.settings().deferredCSSParserEnabled(); >+ scrollBehaviorEnabled = document.settings().CSSOMViewSmoothScrollingEnabled(); > useSystemAppearance = document.page() ? document.page()->useSystemAppearance() : false; > > #if PLATFORM(IOS_FAMILY) >@@ -102,6 +103,7 @@ bool operator==(const CSSParserContext& a, const CSSParserContext& b) > && a.attachmentEnabled == b.attachmentEnabled > #endif > && a.deferredCSSParserEnabled == b.deferredCSSParserEnabled >+ && a.scrollBehaviorEnabled == b.scrollBehaviorEnabled > && a.hasDocumentSecurityOrigin == b.hasDocumentSecurityOrigin > && a.useSystemAppearance == b.useSystemAppearance; > } >diff --git a/Source/WebCore/css/parser/CSSParserContext.h b/Source/WebCore/css/parser/CSSParserContext.h >index 758b6eeb3af..45ac56e3b46 100644 >--- a/Source/WebCore/css/parser/CSSParserContext.h >+++ b/Source/WebCore/css/parser/CSSParserContext.h >@@ -59,6 +59,7 @@ public: > bool attachmentEnabled { false }; > #endif > bool deferredCSSParserEnabled { false }; >+ bool scrollBehaviorEnabled { false }; > > // This is only needed to support getMatchedCSSRules. > bool hasDocumentSecurityOrigin { false }; >@@ -106,7 +107,8 @@ struct CSSParserContextHash { > #if ENABLE(ATTACHMENT_ELEMENT) > & key.attachmentEnabled << 11 > #endif >- & key.mode << 12; // Keep this last. >+ & key.scrollBehaviorEnabled << 12 >+ & key.mode << 13; // Keep this last. > hash ^= WTF::intHash(bits); > return hash; > } >diff --git a/Source/WebCore/css/parser/CSSParserFastPaths.cpp b/Source/WebCore/css/parser/CSSParserFastPaths.cpp >index 3835f239b08..3bf88ee01d9 100644 >--- a/Source/WebCore/css/parser/CSSParserFastPaths.cpp >+++ b/Source/WebCore/css/parser/CSSParserFastPaths.cpp >@@ -621,10 +621,6 @@ bool CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyID propertyId > return valueID == CSSValueStatic || valueID == CSSValueRelative || valueID == CSSValueAbsolute || valueID == CSSValueFixed || valueID == CSSValueWebkitSticky; > case CSSPropertyResize: // none | both | horizontal | vertical | auto > return valueID == CSSValueNone || valueID == CSSValueBoth || valueID == CSSValueHorizontal || valueID == CSSValueVertical || valueID == CSSValueAuto; >- // FIXME-NEWPARSER: Investigate this property. >- // case CSSPropertyScrollBehavior: // auto | smooth >- // ASSERT(RuntimeEnabledFeatures::cssomSmoothScrollEnabled()); >- // return valueID == CSSValueAuto || valueID == CSSValueSmooth; > case CSSPropertyShapeRendering: > return valueID == CSSValueAuto || valueID == CSSValueOptimizeSpeed || valueID == CSSValueCrispedges || valueID == CSSValueGeometricPrecision; > case CSSPropertyStrokeLinejoin: >@@ -926,7 +922,6 @@ bool CSSParserFastPaths::isKeywordPropertyID(CSSPropertyID propertyId) > // case CSSPropertyFontKerning: > // case CSSPropertyHyphens: > // case CSSPropertyOverflowAnchor: >- // case CSSPropertyScrollBehavior: > // case CSSPropertyScrollSnapType: > // case CSSPropertyTextAlignLast: > // case CSSPropertyTextCombineUpright: >diff --git a/Source/WebCore/css/parser/CSSPropertyParser.cpp b/Source/WebCore/css/parser/CSSPropertyParser.cpp >index 98df41895a3..4f86ab80240 100644 >--- a/Source/WebCore/css/parser/CSSPropertyParser.cpp >+++ b/Source/WebCore/css/parser/CSSPropertyParser.cpp >@@ -2326,6 +2326,14 @@ static RefPtr<CSSValueList> consumeScrollSnapType(CSSParserTokenRange& range) > > #endif > >+static RefPtr<CSSPrimitiveValue> consumeScrollBehavior(CSSParserTokenRange& range) >+{ >+ auto valueID = range.peek().id(); >+ if (valueID != CSSValueAuto && valueID != CSSValueSmooth) >+ return nullptr; >+ return consumeIdent(range); >+} >+ > static RefPtr<CSSValue> consumeBorderRadiusCorner(CSSParserTokenRange& range, CSSParserMode cssParserMode) > { > RefPtr<CSSPrimitiveValue> parsedValue1 = consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative); >@@ -4015,6 +4023,10 @@ RefPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID property, CSS > case CSSPropertyScrollSnapType: > return consumeScrollSnapType(m_range); > #endif >+ case CSSPropertyScrollBehavior: >+ if (!m_context.scrollBehaviorEnabled) >+ return nullptr; >+ return consumeScrollBehavior(m_range); > case CSSPropertyClip: > return consumeClip(m_range, m_context.mode); > #if ENABLE(TOUCH_EVENTS) >diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp >index 5ff302fbe65..96fa27b4527 100644 >--- a/Source/WebCore/dom/Element.cpp >+++ b/Source/WebCore/dom/Element.cpp >@@ -682,7 +682,6 @@ void Element::scrollIntoView(Optional<Variant<bool, ScrollIntoViewOptions>>&& ar > bool insideFixed; > LayoutRect absoluteBounds = renderer()->absoluteAnchorRect(&insideFixed); > >- // FIXME(webkit.org/b/188043): Support ScrollBehavior. > ScrollIntoViewOptions options; > if (arg) { > auto value = arg.value(); >@@ -692,9 +691,15 @@ void Element::scrollIntoView(Optional<Variant<bool, ScrollIntoViewOptions>>&& ar > options.blockPosition = ScrollLogicalPosition::End; > } > >- ScrollAlignment alignX = toScrollAlignment(options.inlinePosition, false); >- ScrollAlignment alignY = toScrollAlignment(options.blockPosition, true); >- renderer()->scrollRectToVisible(absoluteBounds, insideFixed, { SelectionRevealMode::Reveal, alignX, alignY, ShouldAllowCrossOriginScrolling::No }); >+ ScrollRectToVisibleOptions scrollRectToVisibleOptions { >+ SelectionRevealMode::Reveal, >+ toScrollAlignment(options.inlinePosition, false), >+ toScrollAlignment(options.blockPosition, true), >+ ShouldAllowCrossOriginScrolling::No, >+ }; >+ if (options.behavior) >+ scrollRectToVisibleOptions.behavior = options.behavior.value(); >+ renderer()->scrollRectToVisible(absoluteBounds, insideFixed, scrollRectToVisibleOptions); > } > > void Element::scrollIntoView(bool alignToTop) >@@ -753,7 +758,7 @@ void Element::scrollBy(const ScrollToOptions& options) > > void Element::scrollBy(double x, double y) > { >- scrollBy({ x, y }); >+ scrollBy(fromCoordinates(x, y)); > } > > void Element::scrollTo(const ScrollToOptions& options, ScrollClamping clamping) >@@ -789,13 +794,21 @@ void Element::scrollTo(const ScrollToOptions& options, ScrollClamping clamping) > adjustForAbsoluteZoom(renderer->scrollLeft(), *renderer), > adjustForAbsoluteZoom(renderer->scrollTop(), *renderer) > ); >- renderer->setScrollLeft(clampToInteger(scrollToOptions.left.value() * renderer->style().effectiveZoom()), clamping); >- renderer->setScrollTop(clampToInteger(scrollToOptions.top.value() * renderer->style().effectiveZoom()), clamping); >+ IntPoint scrollPosition( >+ clampToInteger(scrollToOptions.left.value() * renderer->style().effectiveZoom()), >+ clampToInteger(scrollToOptions.top.value() * renderer->style().effectiveZoom()) >+ ); >+ if (useSmoothScrolling(scrollToOptions.behavior.valueOr(ScrollBehavior::Auto), *this)) { >+ renderer->scrollToPositionWithAnimation(scrollPosition, clamping); >+ return; >+ } >+ renderer->setScrollLeft(scrollPosition.x(), clamping); >+ renderer->setScrollTop(scrollPosition.y(), clamping); > } > > void Element::scrollTo(double x, double y) > { >- scrollTo({ x, y }); >+ scrollTo(fromCoordinates(x, y)); > } > > void Element::scrollByUnits(int units, ScrollGranularity granularity) >diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp >index 19f8f5275ac..443d63e62c5 100644 >--- a/Source/WebCore/page/DOMWindow.cpp >+++ b/Source/WebCore/page/DOMWindow.cpp >@@ -1542,7 +1542,7 @@ double DOMWindow::devicePixelRatio() const > > void DOMWindow::scrollBy(double x, double y) const > { >- scrollBy({ x, y }); >+ scrollBy(fromCoordinates(x, y)); > } > > void DOMWindow::scrollBy(const ScrollToOptions& options) const >@@ -1564,10 +1564,10 @@ void DOMWindow::scrollBy(const ScrollToOptions& options) const > > void DOMWindow::scrollTo(double x, double y, ScrollClamping clamping) const > { >- scrollTo({ x, y }, clamping); >+ scrollTo(fromCoordinates(x, y), clamping); > } > >-void DOMWindow::scrollTo(const ScrollToOptions& options, ScrollClamping) const >+void DOMWindow::scrollTo(const ScrollToOptions& options, ScrollClamping clamping) const > { > if (!isCurrentlyDisplayedInFrame()) > return; >@@ -1580,12 +1580,18 @@ void DOMWindow::scrollTo(const ScrollToOptions& options, ScrollClamping) const > view->contentsScrollPosition().x(), view->contentsScrollPosition().y() > ); > >- if (!scrollToOptions.left.value() && !scrollToOptions.top.value() && view->contentsScrollPosition() == IntPoint(0, 0)) >+ if (!view->isScrollInProgress() && !scrollToOptions.left.value() && !scrollToOptions.top.value() && view->contentsScrollPosition() == IntPoint(0, 0)) > return; > > document()->updateLayoutIgnorePendingStylesheets(); > > IntPoint layoutPos(view->mapFromCSSToLayoutUnits(scrollToOptions.left.value()), view->mapFromCSSToLayoutUnits(scrollToOptions.top.value())); >+ // FIXME: Should we use document()->scrollingElement()? >+ // See https://github.com/w3c/csswg-drafts/issues/2977 >+ if (document()->documentElement() && useSmoothScrolling(scrollToOptions.behavior.valueOr(ScrollBehavior::Auto), *document()->documentElement())) { >+ view->scrollToOffsetWithAnimation(layoutPos, clamping); >+ return; >+ } > view->setContentsScrollPosition(layoutPos); > } > >diff --git a/Source/WebCore/page/ScrollBehavior.cpp b/Source/WebCore/page/ScrollBehavior.cpp >new file mode 100644 >index 00000000000..5328c9b83a8 >--- /dev/null >+++ b/Source/WebCore/page/ScrollBehavior.cpp >@@ -0,0 +1,48 @@ >+/* >+ * Copyright (C) 2018 Igalia S.L. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#include "config.h" >+#include "ScrollBehavior.h" >+ >+#include "Element.h" >+#include "RenderElement.h" >+#include "RenderStyle.h" >+#include "Settings.h" >+ >+namespace WebCore { >+ >+bool useSmoothScrolling(ScrollBehavior behavior, Element& associatedElement) >+{ >+ if (!associatedElement.document().settings().CSSOMViewSmoothScrollingEnabled() || !associatedElement.renderer()) >+ return false; >+ >+ // https://drafts.csswg.org/cssom-view/#scrolling >+ switch (behavior) { >+ case ScrollBehavior::Auto: >+ return associatedElement.renderer()->style().useSmoothScrolling(); >+ case ScrollBehavior::Instant: >+ return false; >+ case ScrollBehavior::Smooth: >+ return true; >+ } >+ ASSERT_NOT_REACHED(); >+ return false; >+} >+ >+} // namespace WebCore >diff --git a/Source/WebCore/page/ScrollBehavior.h b/Source/WebCore/page/ScrollBehavior.h >new file mode 100644 >index 00000000000..f01497b0307 >--- /dev/null >+++ b/Source/WebCore/page/ScrollBehavior.h >@@ -0,0 +1,34 @@ >+/* >+ * Copyright (C) 2018 Igalia S.L. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#pragma once >+ >+namespace WebCore { >+ >+class Element; >+ >+enum class ScrollBehavior : uint8_t { >+ Auto = 0, >+ Instant, >+ Smooth >+}; >+ >+bool useSmoothScrolling(ScrollBehavior, Element& associatedElement); >+ >+} // namespace WebCore >diff --git a/Source/WebCore/page/ScrollBehavior.idl b/Source/WebCore/page/ScrollBehavior.idl >new file mode 100644 >index 00000000000..a865fbe665b >--- /dev/null >+++ b/Source/WebCore/page/ScrollBehavior.idl >@@ -0,0 +1,20 @@ >+/* >+ * Copyright (C) 2018 Igalia S.L. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+enum ScrollBehavior { "auto", "instant", "smooth" }; >diff --git a/Source/WebCore/page/ScrollIntoViewOptions.h b/Source/WebCore/page/ScrollIntoViewOptions.h >index 939cd73425a..f275f2fbd1a 100644 >--- a/Source/WebCore/page/ScrollIntoViewOptions.h >+++ b/Source/WebCore/page/ScrollIntoViewOptions.h >@@ -20,12 +20,11 @@ > #pragma once > > #include "ScrollLogicalPosition.h" >+#include "ScrollOptions.h" > > namespace WebCore { > >-class Element; >- >-struct ScrollIntoViewOptions { >+struct ScrollIntoViewOptions : ScrollOptions { > Optional<ScrollLogicalPosition> blockPosition { ScrollLogicalPosition::Start }; > Optional<ScrollLogicalPosition> inlinePosition { ScrollLogicalPosition::Nearest }; > }; >diff --git a/Source/WebCore/page/ScrollIntoViewOptions.idl b/Source/WebCore/page/ScrollIntoViewOptions.idl >index cf9d1fd7678..1b24c686fc7 100644 >--- a/Source/WebCore/page/ScrollIntoViewOptions.idl >+++ b/Source/WebCore/page/ScrollIntoViewOptions.idl >@@ -17,8 +17,7 @@ > * Boston, MA 02110-1301, USA. > */ > >-// FIXME(webkit.org/b/188043): Support ScrollBehavior. >-dictionary ScrollIntoViewOptions { >+dictionary ScrollIntoViewOptions : ScrollOptions { > [ImplementedAs=blockPosition] ScrollLogicalPosition block = "start"; > [ImplementedAs=inlinePosition] ScrollLogicalPosition inline = "nearest"; > }; >diff --git a/Source/WebCore/page/ScrollOptions.h b/Source/WebCore/page/ScrollOptions.h >new file mode 100644 >index 00000000000..e7f63b9ff1c >--- /dev/null >+++ b/Source/WebCore/page/ScrollOptions.h >@@ -0,0 +1,30 @@ >+/* >+ * Copyright (C) 2018 Igalia S.L. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+#pragma once >+ >+#include "ScrollBehavior.h" >+ >+namespace WebCore { >+ >+struct ScrollOptions { >+ Optional<ScrollBehavior> behavior { ScrollBehavior::Auto }; >+}; >+ >+} // namespace WebCore >diff --git a/Source/WebCore/page/ScrollOptions.idl b/Source/WebCore/page/ScrollOptions.idl >new file mode 100644 >index 00000000000..140f5c70ed1 >--- /dev/null >+++ b/Source/WebCore/page/ScrollOptions.idl >@@ -0,0 +1,22 @@ >+/* >+ * Copyright (C) 2018 Igalia S.L. >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ */ >+ >+dictionary ScrollOptions { >+ ScrollBehavior behavior = "auto"; >+}; >diff --git a/Source/WebCore/page/ScrollToOptions.h b/Source/WebCore/page/ScrollToOptions.h >index ce1cba1c7c0..65b6e571db9 100644 >--- a/Source/WebCore/page/ScrollToOptions.h >+++ b/Source/WebCore/page/ScrollToOptions.h >@@ -28,16 +28,25 @@ > > #pragma once > >+#include "ScrollOptions.h" > #include <cmath> > #include <wtf/Optional.h> > > namespace WebCore { > >-struct ScrollToOptions { >+struct ScrollToOptions : ScrollOptions { > Optional<double> left; > Optional<double> top; > }; > >+inline ScrollToOptions fromCoordinates(double x, double y) >+{ >+ ScrollToOptions options; >+ options.left = x; >+ options.top = y; >+ return options; >+}; >+ > inline double normalizeNonFiniteValueOrFallBackTo(Optional<double> value, double fallbackValue) > { > // Normalize non-finite values (https://drafts.csswg.org/cssom-view/#normalize-non-finite-values). >@@ -47,7 +56,7 @@ inline double normalizeNonFiniteValueOrFallBackTo(Optional<double> value, double > // FIXME(https://webkit.org/b/88339): Consider using FloatPoint or DoublePoint for fallback and return values. > inline ScrollToOptions normalizeNonFiniteCoordinatesOrFallBackTo(const ScrollToOptions& value, double x, double y) > { >- ScrollToOptions options; >+ ScrollToOptions options = value; > options.left = normalizeNonFiniteValueOrFallBackTo(value.left, x); > options.top = normalizeNonFiniteValueOrFallBackTo(value.top, y); > return options; >diff --git a/Source/WebCore/page/ScrollToOptions.idl b/Source/WebCore/page/ScrollToOptions.idl >index 510bc071a68..2b9b554122a 100644 >--- a/Source/WebCore/page/ScrollToOptions.idl >+++ b/Source/WebCore/page/ScrollToOptions.idl >@@ -26,8 +26,7 @@ > * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > >-// FIXME(webkit.org/b/188043): Support ScrollBehavior. >-dictionary ScrollToOptions { >+dictionary ScrollToOptions : ScrollOptions { > unrestricted double left; > unrestricted double top; > }; >diff --git a/Source/WebCore/page/Settings.yaml b/Source/WebCore/page/Settings.yaml >index cb29eac3eff..95fdba1ab94 100644 >--- a/Source/WebCore/page/Settings.yaml >+++ b/Source/WebCore/page/Settings.yaml >@@ -571,6 +571,9 @@ visualViewportAPIEnabled: > CSSOMViewScrollingAPIEnabled: > initial: false > >+CSSOMViewSmoothScrollingEnabled: >+ initial: false >+ > inputEventsEnabled: > initial: true > >diff --git a/Source/WebCore/platform/ScrollAnimation.h b/Source/WebCore/platform/ScrollAnimation.h >index 2e5f63bcef2..072e94bc13b 100644 >--- a/Source/WebCore/platform/ScrollAnimation.h >+++ b/Source/WebCore/platform/ScrollAnimation.h >@@ -32,15 +32,18 @@ namespace WebCore { > > class FloatPoint; > class ScrollableArea; >+enum class ScrollClamping; > > class ScrollAnimation { > public: > virtual ~ScrollAnimation() { }; > virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float /* step */, float /* multiplier */) { return true; }; >+ virtual void scroll(const FloatPoint&, ScrollClamping) { }; > virtual void stop() = 0; > virtual void updateVisibleLengths() { }; > virtual void setCurrentPosition(const FloatPoint&) { }; > virtual void serviceAnimation() { }; >+ virtual bool isScrollInProgress() const { return false; } > > protected: > ScrollAnimation(ScrollableArea& scrollableArea) >diff --git a/Source/WebCore/platform/ScrollAnimationKinetic.cpp b/Source/WebCore/platform/ScrollAnimationKinetic.cpp >index 7466ee93c4a..484287a3afb 100644 >--- a/Source/WebCore/platform/ScrollAnimationKinetic.cpp >+++ b/Source/WebCore/platform/ScrollAnimationKinetic.cpp >@@ -163,4 +163,9 @@ void ScrollAnimationKinetic::animationTimerFired() > m_notifyPositionChangedFunction(FloatPoint(m_position)); > } > >+bool ScrollAnimationKinetic::isScrollInProgress() const >+{ >+ return m_animationTimer.isActive(); >+} >+ > } // namespace WebCore >diff --git a/Source/WebCore/platform/ScrollAnimationKinetic.h b/Source/WebCore/platform/ScrollAnimationKinetic.h >index cfd33ce5b49..291fa9c19a7 100644 >--- a/Source/WebCore/platform/ScrollAnimationKinetic.h >+++ b/Source/WebCore/platform/ScrollAnimationKinetic.h >@@ -66,6 +66,7 @@ public: > private: > void stop() override; > void animationTimerFired(); >+ bool isScrollInProgress() const override; > > std::function<void(FloatPoint&&)> m_notifyPositionChangedFunction; > >diff --git a/Source/WebCore/platform/ScrollAnimationSmooth.cpp b/Source/WebCore/platform/ScrollAnimationSmooth.cpp >index d064e69379f..7cc1958a1c5 100644 >--- a/Source/WebCore/platform/ScrollAnimationSmooth.cpp >+++ b/Source/WebCore/platform/ScrollAnimationSmooth.cpp >@@ -28,8 +28,6 @@ > #include "config.h" > #include "ScrollAnimationSmooth.h" > >-#if ENABLE(SMOOTH_SCROLLING) >- > #include "FloatPoint.h" > #include "ScrollableArea.h" > >@@ -38,6 +36,7 @@ namespace WebCore { > static const double frameRate = 60; > static const Seconds tickTime = 1_s / frameRate; > static const Seconds minimumTimerInterval { 1_ms }; >+static const double smoothFactorForProgrammaticScroll = 5; > > ScrollAnimationSmooth::ScrollAnimationSmooth(ScrollableArea& scrollableArea, const FloatPoint& position, WTF::Function<void (FloatPoint&&)>&& notifyPositionChangedFunction) > : ScrollAnimation(scrollableArea) >@@ -67,6 +66,19 @@ bool ScrollAnimationSmooth::scroll(ScrollbarOrientation orientation, ScrollGranu > return needToScroll; > } > >+void ScrollAnimationSmooth::scroll(const FloatPoint& position, ScrollClamping) >+{ >+ // FIXME: Consider clamping? >+ ScrollGranularity granularity = ScrollByPage; >+ bool needToScroll = updatePerAxisData(m_horizontalData, granularity, position.x() - m_horizontalData.currentPosition, m_scrollableArea.minimumScrollPosition().x(), m_scrollableArea.maximumScrollPosition().x(), smoothFactorForProgrammaticScroll); >+ needToScroll |= >+ updatePerAxisData(m_verticalData, granularity, position.y() - m_verticalData.currentPosition, m_scrollableArea.minimumScrollPosition().y(), m_scrollableArea.maximumScrollPosition().y(), smoothFactorForProgrammaticScroll); >+ if (needToScroll && !animationTimerActive()) { >+ m_startTime = m_horizontalData.startTime; >+ animationTimerFired(); >+ } >+}; >+ > void ScrollAnimationSmooth::stop() > { > m_animationTimer.stop(); >@@ -247,7 +259,7 @@ static inline void getAnimationParametersForGranularity(ScrollGranularity granul > } > } > >-bool ScrollAnimationSmooth::updatePerAxisData(PerAxisData& data, ScrollGranularity granularity, float delta, float minScrollPosition, float maxScrollPosition) >+bool ScrollAnimationSmooth::updatePerAxisData(PerAxisData& data, ScrollGranularity granularity, float delta, float minScrollPosition, float maxScrollPosition, double smoothFactor) > { > if (!data.startTime || !delta || (delta < 0) != (data.desiredPosition - data.currentPosition < 0)) { > data.desiredPosition = data.currentPosition; >@@ -264,6 +276,12 @@ bool ScrollAnimationSmooth::updatePerAxisData(PerAxisData& data, ScrollGranulari > Curve coastTimeCurve; > getAnimationParametersForGranularity(granularity, animationTime, repeatMinimumSustainTime, attackTime, releaseTime, coastTimeCurve, maximumCoastTime); > >+ animationTime *= smoothFactor; >+ repeatMinimumSustainTime *= smoothFactor; >+ attackTime *= smoothFactor; >+ releaseTime *= smoothFactor; >+ maximumCoastTime *= smoothFactor; >+ > data.desiredPosition = newPosition; > if (!data.startTime) > data.attackTime = attackTime; >@@ -407,5 +425,3 @@ bool ScrollAnimationSmooth::animationTimerActive() const > } > > } // namespace WebCore >- >-#endif // ENABLE(SMOOTH_SCROLLING) >diff --git a/Source/WebCore/platform/ScrollAnimationSmooth.h b/Source/WebCore/platform/ScrollAnimationSmooth.h >index 02cc4ee2bd7..505b2ef4105 100644 >--- a/Source/WebCore/platform/ScrollAnimationSmooth.h >+++ b/Source/WebCore/platform/ScrollAnimationSmooth.h >@@ -27,14 +27,13 @@ > > #include "ScrollAnimation.h" > >-#if ENABLE(SMOOTH_SCROLLING) >- > #include "Timer.h" > > namespace WebCore { > > class FloatPoint; > class ScrollableArea; >+enum class ScrollClamping; > > class ScrollAnimationSmooth final: public ScrollAnimation { > public: >@@ -51,9 +50,11 @@ public: > > private: > bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier) override; >+ void scroll(const FloatPoint&, ScrollClamping) override; > void stop() override; > void updateVisibleLengths() override; > void setCurrentPosition(const FloatPoint&) override; >+ bool isScrollInProgress() const override { return animationTimerActive(); } > > struct PerAxisData { > PerAxisData() = delete; >@@ -89,7 +90,7 @@ private: > int visibleLength { 0 }; > }; > >- bool updatePerAxisData(PerAxisData&, ScrollGranularity, float delta, float minScrollPosition, float maxScrollPosition); >+ bool updatePerAxisData(PerAxisData&, ScrollGranularity, float delta, float minScrollPosition, float maxScrollPosition, double smoothFactor = 1); > bool animateScroll(PerAxisData&, MonotonicTime currentTime); > > void requestAnimationTimerFired(); >@@ -108,4 +109,3 @@ private: > > } // namespace WebCore > >-#endif // ENABLE(SMOOTH_SCROLLING) >diff --git a/Source/WebCore/platform/ScrollAnimator.cpp b/Source/WebCore/platform/ScrollAnimator.cpp >index d9154d9351a..e6c95f9062a 100644 >--- a/Source/WebCore/platform/ScrollAnimator.cpp >+++ b/Source/WebCore/platform/ScrollAnimator.cpp >@@ -35,6 +35,7 @@ > #include "FloatPoint.h" > #include "LayoutSize.h" > #include "PlatformWheelEvent.h" >+#include "ScrollAnimationSmooth.h" > #include "ScrollableArea.h" > #include <algorithm> > >@@ -52,11 +53,22 @@ ScrollAnimator::ScrollAnimator(ScrollableArea& scrollableArea) > #if ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING) > , m_scrollController(*this) > #endif >+ , m_animationProgrammaticScroll(std::make_unique<ScrollAnimationSmooth>(scrollableArea, m_currentPosition, [this](FloatPoint&& position) { >+ FloatSize delta = position - m_currentPosition; >+ m_currentPosition = WTFMove(position); >+ notifyPositionChanged(delta); >+ })) > { > } > > ScrollAnimator::~ScrollAnimator() = default; > >+bool ScrollAnimator::isScrollInProgress() const >+{ >+ // FIXME (TODO): This should also take into account animations in derived classes. >+ return m_animationProgrammaticScroll->isScrollInProgress(); >+} >+ > bool ScrollAnimator::scroll(ScrollbarOrientation orientation, ScrollGranularity, float step, float multiplier) > { > FloatPoint currentPosition = this->currentPosition(); >@@ -75,6 +87,13 @@ bool ScrollAnimator::scroll(ScrollbarOrientation orientation, ScrollGranularity, > return true; > } > >+void ScrollAnimator::scrollToOffset(const FloatPoint& offset, ScrollClamping clamping) >+{ >+ m_animationProgrammaticScroll->setCurrentPosition(m_currentPosition); >+ auto newPosition = ScrollableArea::scrollPositionFromOffset(offset, toFloatSize(m_scrollableArea.scrollOrigin())); >+ m_animationProgrammaticScroll->scroll(newPosition, clamping); >+} >+ > void ScrollAnimator::scrollToOffsetWithoutAnimation(const FloatPoint& offset, ScrollClamping) > { > FloatPoint newPositon = ScrollableArea::scrollPositionFromOffset(offset, toFloatSize(m_scrollableArea.scrollOrigin())); >@@ -245,4 +264,33 @@ void ScrollAnimator::removeTestDeferralForReason(WheelEventTestTrigger::Scrollab > } > #endif > >+void ScrollAnimator::cancelAnimations() >+{ >+#if !USE(REQUEST_ANIMATION_FRAME_TIMER) >+ m_animationProgrammaticScroll->stop(); >+#endif >+} >+ >+void ScrollAnimator::serviceScrollAnimations() >+{ >+#if !USE(REQUEST_ANIMATION_FRAME_TIMER) >+ m_animationProgrammaticScroll->serviceAnimation(); >+#endif >+} >+ >+void ScrollAnimator::willEndLiveResize() >+{ >+ m_animationProgrammaticScroll->updateVisibleLengths(); >+} >+ >+void ScrollAnimator::didAddVerticalScrollbar(Scrollbar*) >+{ >+ m_animationProgrammaticScroll->updateVisibleLengths(); >+} >+ >+void ScrollAnimator::didAddHorizontalScrollbar(Scrollbar*) >+{ >+ m_animationProgrammaticScroll->updateVisibleLengths(); >+} >+ > } // namespace WebCore >diff --git a/Source/WebCore/platform/ScrollAnimator.h b/Source/WebCore/platform/ScrollAnimator.h >index 6e2a884abb2..6914483d730 100644 >--- a/Source/WebCore/platform/ScrollAnimator.h >+++ b/Source/WebCore/platform/ScrollAnimator.h >@@ -46,6 +46,7 @@ namespace WebCore { > > class FloatPoint; > class PlatformTouchEvent; >+class ScrollAnimation; > class ScrollableArea; > class Scrollbar; > class WheelEventTestTrigger; >@@ -68,6 +69,7 @@ public: > // The base class implementation always scrolls immediately, never animates. > virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier); > >+ void scrollToOffset(const FloatPoint&, ScrollClamping = ScrollClamping::Clamped); > virtual void scrollToOffsetWithoutAnimation(const FloatPoint&, ScrollClamping = ScrollClamping::Clamped); > > ScrollableArea& scrollableArea() const { return m_scrollableArea; } >@@ -85,8 +87,8 @@ public: > void setCurrentPosition(const FloatPoint&); > const FloatPoint& currentPosition() const { return m_currentPosition; } > >- virtual void cancelAnimations() { } >- virtual void serviceScrollAnimations() { } >+ virtual void cancelAnimations(); >+ virtual void serviceScrollAnimations(); > > virtual void contentAreaWillPaint() const { } > virtual void mouseEnteredContentArea() { } >@@ -97,16 +99,16 @@ public: > virtual void mouseIsDownInScrollbar(Scrollbar*, bool) const { } > virtual void willStartLiveResize() { } > virtual void contentsResized() const { } >- virtual void willEndLiveResize() { } >+ virtual void willEndLiveResize(); > virtual void contentAreaDidShow() { } > virtual void contentAreaDidHide() { } > > virtual void lockOverlayScrollbarStateToHidden(bool) { } > virtual bool scrollbarsCanBeActive() const { return true; } > >- virtual void didAddVerticalScrollbar(Scrollbar*) { } >+ virtual void didAddVerticalScrollbar(Scrollbar*); > virtual void willRemoveVerticalScrollbar(Scrollbar*) { } >- virtual void didAddHorizontalScrollbar(Scrollbar*) { } >+ virtual void didAddHorizontalScrollbar(Scrollbar*); > virtual void willRemoveHorizontalScrollbar(Scrollbar*) { } > > virtual void invalidateScrollbarPartLayers(Scrollbar*) { } >@@ -120,6 +122,7 @@ public: > > virtual bool isRubberBandInProgress() const { return false; } > virtual bool isScrollSnapInProgress() const { return false; } >+ bool isScrollInProgress() const; > > void setWheelEventTestTrigger(RefPtr<WheelEventTestTrigger>&& testTrigger) { m_wheelEventTestTrigger = testTrigger; } > #if (ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING)) && PLATFORM(MAC) >@@ -150,6 +153,8 @@ protected: > ScrollController m_scrollController; > #endif > FloatPoint m_currentPosition; >+ >+ std::unique_ptr<ScrollAnimation> m_animationProgrammaticScroll; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/ScrollView.cpp b/Source/WebCore/platform/ScrollView.cpp >index b19806f2635..053fb8fd8d4 100644 >--- a/Source/WebCore/platform/ScrollView.cpp >+++ b/Source/WebCore/platform/ScrollView.cpp >@@ -501,9 +501,13 @@ void ScrollView::setScrollPosition(const ScrollPosition& scrollPosition) > > ScrollPosition newScrollPosition = !delegatesScrolling() ? adjustScrollPositionWithinRange(scrollPosition) : scrollPosition; > >- if ((!delegatesScrolling() || !inProgrammaticScroll()) && newScrollPosition == this->scrollPosition()) >+ bool scrollInProgress = isScrollInProgress(); >+ if ((!delegatesScrolling() || !inProgrammaticScroll()) && !scrollInProgress && newScrollPosition == this->scrollPosition()) > return; > >+ if (scrollInProgress) >+ scrollAnimator().cancelAnimations(); >+ > if (requestScrollPositionUpdate(newScrollPosition)) > return; > >diff --git a/Source/WebCore/platform/ScrollableArea.cpp b/Source/WebCore/platform/ScrollableArea.cpp >index 94629214544..0ee5658399e 100644 >--- a/Source/WebCore/platform/ScrollableArea.cpp >+++ b/Source/WebCore/platform/ScrollableArea.cpp >@@ -100,6 +100,11 @@ float ScrollableArea::adjustScrollStepForFixedContent(float step, ScrollbarOrien > return step; > } > >+bool ScrollableArea::isScrollInProgress() const >+{ >+ return m_scrollAnimator && scrollAnimator().isScrollInProgress(); >+} >+ > bool ScrollableArea::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier) > { > ScrollbarOrientation orientation; >@@ -138,6 +143,12 @@ bool ScrollableArea::scroll(ScrollDirection direction, ScrollGranularity granula > return scrollAnimator().scroll(orientation, granularity, step, multiplier); > } > >+void ScrollableArea::scrollToOffsetWithAnimation(const FloatPoint& offset, ScrollClamping clamping) >+{ >+ LOG_WITH_STREAM(Scrolling, stream << "ScrollableArea " << this << " scrollToOffset " << offset); >+ scrollAnimator().scrollToOffset(offset, clamping); >+} >+ > void ScrollableArea::scrollToOffsetWithoutAnimation(const FloatPoint& offset, ScrollClamping clamping) > { > LOG_WITH_STREAM(Scrolling, stream << "ScrollableArea " << this << " scrollToOffsetWithoutAnimation " << offset); >diff --git a/Source/WebCore/platform/ScrollableArea.h b/Source/WebCore/platform/ScrollableArea.h >index e15ec3f1359..9a86a51f676 100644 >--- a/Source/WebCore/platform/ScrollableArea.h >+++ b/Source/WebCore/platform/ScrollableArea.h >@@ -50,7 +50,9 @@ typedef IntPoint ScrollOffset; > > class ScrollableArea : public CanMakeWeakPtr<ScrollableArea> { > public: >+ WEBCORE_EXPORT bool isScrollInProgress() const; > WEBCORE_EXPORT bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1); >+ WEBCORE_EXPORT void scrollToOffsetWithAnimation(const FloatPoint&, ScrollClamping = ScrollClamping::Clamped); > WEBCORE_EXPORT void scrollToOffsetWithoutAnimation(const FloatPoint&, ScrollClamping = ScrollClamping::Clamped); > void scrollToOffsetWithoutAnimation(ScrollbarOrientation, float offset); > >diff --git a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm >index d08cc59fff1..0ad23b5c1e5 100644 >--- a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm >+++ b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm >@@ -1152,6 +1152,7 @@ void ScrollAnimatorMac::notifyContentAreaScrolled(const FloatSize& delta) > > void ScrollAnimatorMac::cancelAnimations() > { >+ ScrollAnimator::cancelAnimations(); > m_haveScrolledSincePageLoad = false; > > if (scrollbarPaintTimerIsActive()) >diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp >index 06aebaf65d5..c00bed6d8bb 100644 >--- a/Source/WebCore/rendering/RenderBox.cpp >+++ b/Source/WebCore/rendering/RenderBox.cpp >@@ -591,6 +591,14 @@ void RenderBox::setScrollTop(int newTop, ScrollClamping clamping) > layer()->scrollToYPosition(newTop, clamping); > } > >+void RenderBox::scrollToPositionWithAnimation(ScrollPosition scrollPosition, ScrollClamping clamping) >+{ >+ if (!hasOverflowClip() || !layer()) >+ return; >+ setupWheelEventTestTrigger(*layer()); >+ layer()->scrollToOffsetWithAnimation(scrollPosition, clamping); >+} >+ > void RenderBox::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const > { > rects.append(snappedIntRect(accumulatedOffset, size())); >diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h >index 55106852942..5d9385cff1c 100644 >--- a/Source/WebCore/rendering/RenderBox.h >+++ b/Source/WebCore/rendering/RenderBox.h >@@ -245,6 +245,7 @@ public: > virtual int scrollHeight() const; > virtual void setScrollLeft(int, ScrollClamping = ScrollClamping::Clamped); > virtual void setScrollTop(int, ScrollClamping = ScrollClamping::Clamped); >+ void scrollToPositionWithAnimation(ScrollPosition, ScrollClamping = ScrollClamping::Clamped); > > LayoutUnit marginTop() const override { return m_marginBox.top(); } > LayoutUnit marginBottom() const override { return m_marginBox.bottom(); } >diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp >index 0e2e0f16b44..125609ce90e 100644 >--- a/Source/WebCore/rendering/RenderLayer.cpp >+++ b/Source/WebCore/rendering/RenderLayer.cpp >@@ -114,6 +114,7 @@ > #include "ScaleTransformOperation.h" > #include "ScriptDisallowedScope.h" > #include "ScrollAnimator.h" >+#include "ScrollBehavior.h" > #include "Scrollbar.h" > #include "ScrollbarTheme.h" > #include "ScrollingCoordinator.h" >@@ -2337,10 +2338,23 @@ ScrollOffset RenderLayer::clampScrollOffset(const ScrollOffset& scrollOffset) co > void RenderLayer::scrollToOffset(const ScrollOffset& scrollOffset, ScrollClamping clamping) > { > ScrollOffset newScrollOffset = clamping == ScrollClamping::Clamped ? clampScrollOffset(scrollOffset) : scrollOffset; >- if (newScrollOffset != this->scrollOffset()) >+ bool scrollInProgress = isScrollInProgress(); >+ if (scrollInProgress) >+ scrollAnimator().cancelAnimations(); >+ if (scrollInProgress || newScrollOffset != this->scrollOffset()) > scrollToOffsetWithoutAnimation(newScrollOffset, clamping); > } > >+void RenderLayer::scrollToOffsetWithAnimation(const ScrollOffset& scrollOffset, ScrollClamping clamping) >+{ >+ ScrollOffset newScrollOffset = clamping == ScrollClamping::Clamped ? clampScrollOffset(scrollOffset) : scrollOffset; >+ bool scrollInProgress = isScrollInProgress(); >+ if (scrollInProgress) >+ scrollAnimator().cancelAnimations(); >+ if (scrollInProgress || newScrollOffset != this->scrollOffset()) >+ ScrollableArea::scrollToOffsetWithAnimation(newScrollOffset, clamping); >+} >+ > void RenderLayer::scrollTo(const ScrollPosition& position) > { > RenderBox* box = renderBox(); >@@ -2490,6 +2504,7 @@ bool RenderLayer::allowsCurrentScroll() const > > void RenderLayer::scrollRectToVisible(const LayoutRect& absoluteRect, bool insideFixed, const ScrollRectToVisibleOptions& options) > { >+ // FIXME (https://webkit.org/b/189907): Make this work with nested scrollable boxes when a smooth scrolling must be performed. > LOG_WITH_STREAM(Scrolling, stream << "Layer " << this << " scrollRectToVisible " << absoluteRect); > > RenderLayer* parentLayer = nullptr; >@@ -2512,9 +2527,12 @@ void RenderLayer::scrollRectToVisible(const LayoutRect& absoluteRect, bool insid > LayoutRect revealRect = getRectToExpose(layerBounds, localExposeRect, insideFixed, options.alignX, options.alignY); > > ScrollOffset clampedScrollOffset = clampScrollOffset(scrollOffset() + toIntSize(roundedIntRect(revealRect).location())); >- if (clampedScrollOffset != scrollOffset()) { >+ if (isScrollInProgress() || clampedScrollOffset != scrollOffset()) { > ScrollOffset oldScrollOffset = scrollOffset(); >- scrollToOffset(clampedScrollOffset); >+ if (box->element() && useSmoothScrolling(options.behavior, *box->element())) >+ scrollToOffsetWithAnimation(clampedScrollOffset); >+ else >+ scrollToOffset(clampedScrollOffset); > IntSize scrollOffsetDifference = scrollOffset() - oldScrollOffset; > localExposeRect.move(-scrollOffsetDifference); > newRect = LayoutRect(box->localToAbsoluteQuad(FloatQuad(FloatRect(localExposeRect)), UseTransforms).boundingBox()); >@@ -2538,7 +2556,12 @@ void RenderLayer::scrollRectToVisible(const LayoutRect& absoluteRect, bool insid > IntPoint scrollOffset(roundedIntPoint(exposeRect.location())); > // Adjust offsets if they're outside of the allowable range. > scrollOffset = scrollOffset.constrainedBetween(IntPoint(), IntPoint(frameView.contentsSize())); >- frameView.setScrollPosition(scrollOffset); >+ // FIXME: Should we use contentDocument()->scrollingElement()? >+ // See https://github.com/w3c/csswg-drafts/issues/2977 >+ if (ownerElement->contentDocument() && ownerElement->contentDocument()->documentElement() && useSmoothScrolling(options.behavior, *ownerElement->contentDocument()->documentElement())) >+ frameView.scrollToOffsetWithAnimation(scrollOffset); >+ else >+ frameView.setScrollPosition(scrollOffset); > > if (options.shouldAllowCrossOriginScrolling == ShouldAllowCrossOriginScrolling::Yes || frameView.safeToPropagateScrollToParent()) { > parentLayer = ownerElement->renderer()->enclosingLayer(); >@@ -2563,7 +2586,13 @@ void RenderLayer::scrollRectToVisible(const LayoutRect& absoluteRect, bool insid > > LayoutRect revealRect = getRectToExpose(viewRect, targetRect, insideFixed, options.alignX, options.alignY); > >- frameView.setScrollPosition(roundedIntPoint(revealRect.location())); >+ IntPoint scrollOffset(roundedIntPoint(revealRect.location())); >+ // FIXME: Should we use document()->scrollingElement()? >+ // See https://github.com/w3c/csswg-drafts/issues/2977 >+ if (renderer().document().documentElement() && useSmoothScrolling(options.behavior, *renderer().document().documentElement())) >+ frameView.scrollToOffsetWithAnimation(scrollOffset); >+ else >+ frameView.setScrollPosition(scrollOffset); > > // This is the outermost view of a web page, so after scrolling this view we > // scroll its container by calling Page::scrollRectIntoView. >diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h >index 78ff638c198..f5c2cd059b9 100644 >--- a/Source/WebCore/rendering/RenderLayer.h >+++ b/Source/WebCore/rendering/RenderLayer.h >@@ -50,6 +50,7 @@ > #include "PaintInfo.h" > #include "RenderBox.h" > #include "RenderPtr.h" >+#include "ScrollBehavior.h" > #include "ScrollableArea.h" > #include <memory> > #include <wtf/WeakPtr.h> >@@ -120,6 +121,7 @@ struct ScrollRectToVisibleOptions { > const ScrollAlignment& alignX { ScrollAlignment::alignCenterIfNeeded }; > const ScrollAlignment& alignY { ScrollAlignment::alignCenterIfNeeded }; > ShouldAllowCrossOriginScrolling shouldAllowCrossOriginScrolling { ShouldAllowCrossOriginScrolling::No }; >+ ScrollBehavior behavior { ScrollBehavior::Auto }; > }; > > class RenderLayer final : public ScrollableArea { >@@ -402,6 +404,7 @@ public: > void scrollByRecursively(const IntSize& delta, ScrollableArea** scrolledArea = nullptr); > > WEBCORE_EXPORT void scrollToOffset(const ScrollOffset&, ScrollClamping = ScrollClamping::Clamped); >+ WEBCORE_EXPORT void scrollToOffsetWithAnimation(const ScrollOffset&, ScrollClamping = ScrollClamping::Clamped); > void scrollToXOffset(int x, ScrollClamping clamping = ScrollClamping::Clamped) { scrollToOffset(ScrollOffset(x, scrollOffset().y()), clamping); } > void scrollToYOffset(int y, ScrollClamping clamping = ScrollClamping::Clamped) { scrollToOffset(ScrollOffset(scrollOffset().x(), y), clamping); } > >diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h >index 54cbfaa4887..7ed2a1faf9f 100644 >--- a/Source/WebCore/rendering/style/RenderStyle.h >+++ b/Source/WebCore/rendering/style/RenderStyle.h >@@ -739,6 +739,8 @@ public: > bool useTouchOverflowScrolling() const { return m_rareInheritedData->useTouchOverflowScrolling; } > #endif > >+ bool useSmoothScrolling() const { return m_rareNonInheritedData->useSmoothScrolling; } >+ > #if ENABLE(TEXT_AUTOSIZING) > TextSizeAdjustment textSizeAdjust() const { return m_rareInheritedData->textSizeAdjust; } > #endif >@@ -1252,6 +1254,8 @@ public: > void setUseTouchOverflowScrolling(bool v) { SET_VAR(m_rareInheritedData, useTouchOverflowScrolling, v); } > #endif > >+ void setUseSmoothScrolling(bool v) { SET_VAR(m_rareNonInheritedData, useSmoothScrolling, v); } >+ > #if ENABLE(TEXT_AUTOSIZING) > void setTextSizeAdjust(TextSizeAdjustment adjustment) { SET_VAR(m_rareInheritedData, textSizeAdjust, adjustment); } > #endif >@@ -1688,6 +1692,8 @@ public: > static bool initialUseTouchOverflowScrolling() { return false; } > #endif > >+ static bool initialUseSmoothScrolling() { return false; } >+ > #if ENABLE(DASHBOARD_SUPPORT) > static const Vector<StyleDashboardRegion>& initialDashboardRegions(); > static const Vector<StyleDashboardRegion>& noneDashboardRegions(); >diff --git a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp >index a312bdaebd5..b5e5222c976 100644 >--- a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp >+++ b/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp >@@ -79,6 +79,7 @@ StyleRareNonInheritedData::StyleRareNonInheritedData() > #if ENABLE(TOUCH_EVENTS) > , touchAction(static_cast<unsigned>(RenderStyle::initialTouchAction())) > #endif >+ , useSmoothScrolling(static_cast<unsigned>(RenderStyle::initialUseSmoothScrolling())) > , pageSizeType(PAGE_SIZE_AUTO) > , transformStyle3D(static_cast<unsigned>(RenderStyle::initialTransformStyle3D())) > , backfaceVisibility(static_cast<unsigned>(RenderStyle::initialBackfaceVisibility())) >@@ -173,6 +174,7 @@ inline StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonIn > #if ENABLE(TOUCH_EVENTS) > , touchAction(o.touchAction) > #endif >+ , useSmoothScrolling(o.useSmoothScrolling) > , pageSizeType(o.pageSizeType) > , transformStyle3D(o.transformStyle3D) > , backfaceVisibility(o.backfaceVisibility) >@@ -288,6 +290,7 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c > #if ENABLE(TOUCH_EVENTS) > && touchAction == o.touchAction > #endif >+ && useSmoothScrolling == o.useSmoothScrolling > #if ENABLE(CSS_COMPOSITING) > && effectiveBlendMode == o.effectiveBlendMode > && isolation == o.isolation >diff --git a/Source/WebCore/rendering/style/StyleRareNonInheritedData.h b/Source/WebCore/rendering/style/StyleRareNonInheritedData.h >index f9baa142305..8b2ecd19709 100644 >--- a/Source/WebCore/rendering/style/StyleRareNonInheritedData.h >+++ b/Source/WebCore/rendering/style/StyleRareNonInheritedData.h >@@ -178,6 +178,8 @@ public: > unsigned touchAction : 1; // TouchAction > #endif > >+ unsigned useSmoothScrolling : 1; // ScrollBehavior >+ > unsigned pageSizeType : 2; // PageSizeType > unsigned transformStyle3D : 1; // TransformStyle3D > unsigned backfaceVisibility : 1; // BackfaceVisibility >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index 3c0a59f1d72..314e36a531c 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -1670,7 +1670,7 @@ ExceptionOr<void> Internals::unconstrainedScrollTo(Element& element, double x, d > if (!document || !document->view()) > return Exception { InvalidAccessError }; > >- element.scrollTo({ x, y }, ScrollClamping::Unclamped); >+ element.scrollTo(fromCoordinates(x, y), ScrollClamping::Unclamped); > return { }; > } > >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 2466949f8c0..9a3db922a4d 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,14 @@ >+2018-11-06 Frederic Wang <fwang@igalia.com> >+ >+ Add support for ScrollOptions' ScrollBehavior and CSS scroll-behavior properties >+ https://bugs.webkit.org/show_bug.cgi?id=188043 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add CSSOM smooth scrolling as an experimental feature. >+ >+ * Shared/WebPreferences.yaml: >+ > 2019-01-03 Brent Fulgham <bfulgham@apple.com> > > [iOS] Update sandbox profile to use iconservices instead of lsdiconservice >diff --git a/Source/WebKit/Shared/WebPreferences.yaml b/Source/WebKit/Shared/WebPreferences.yaml >index bff125239ff..0a6ceb045d9 100644 >--- a/Source/WebKit/Shared/WebPreferences.yaml >+++ b/Source/WebKit/Shared/WebPreferences.yaml >@@ -1211,7 +1211,6 @@ EditableImagesEnabled: > # DEFAULT_EXPERIMENTAL_FEATURES_ENABLED (for features that are ready for > # wider testing). > >- > SpringTimingFunctionEnabled: > type: bool > defaultValue: DEFAULT_EXPERIMENTAL_FEATURES_ENABLED >@@ -1258,6 +1257,13 @@ CSSOMViewScrollingAPIEnabled: > humanReadableDescription: "Implement standard behavior for scrollLeft, scrollTop, scrollWidth, scrollHeight, scrollTo, scrollBy and scrollingElement." > category: experimental > >+CSSOMViewSmoothScrollingEnabled: >+ type: bool >+ defaultValue: false >+ humanReadableName: "CSSOM View Smooth Scrolling" >+ humanReadableDescription: "Enable DOM API and CSS property for 'smooth' scroll behavior" >+ category: experimental >+ > WebAnimationsEnabled: > type: bool > defaultValue: DEFAULT_EXPERIMENTAL_FEATURES_ENABLED >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index 1372daf11ad..c417ce7ec2e 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,20 @@ >+2018-11-07 Frederic Wang <fwang@igalia.com> >+ >+ Add support for ScrollOptions' ScrollBehavior and CSS scroll-behavior properties >+ https://bugs.webkit.org/show_bug.cgi?id=188043 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebView/WebPreferenceKeysPrivate.h: Handle CSSOMViewSmoothScrolling by. >+ * WebView/WebPreferencesPrivate.h: Ditto. >+ * WebView/WebView.mm: >+ (-[WebView _preferencesChanged:]): Ditto. >+ >+ * WebView/WebPreferences.mm: >+ (+[WebPreferences initialize]): Disable CSSOMViewSmoothScrolling by default. >+ (-[WebPreferences CSSOMViewSmoothScrollingEnabled]): Getter. >+ (-[WebPreferences setCSSOMViewSmoothScrollingEnabled:]): Setter. >+ > 2019-01-02 Wenson Hsieh <wenson_hsieh@apple.com> > > Add support for using the current text selection as the find string on iOS >diff --git a/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h b/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h >index 090b8380687..4c41b24cd11 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h >+++ b/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h >@@ -183,6 +183,7 @@ > #define WebKitVisualViewportEnabledPreferenceKey @"WebKitVisualViewportEnabled" > #define WebKitVisualViewportAPIEnabledPreferenceKey @"WebKitVisualViewportAPIEnabled" > #define WebKitCSSOMViewScrollingAPIEnabledPreferenceKey @"WebKitCSSOMViewScrollingAPIEnabled" >+#define WebKitCSSOMViewSmoothScrollingEnabledPreferenceKey @"WebKitCSSOMViewSmoothScrollingEnabled" > #define WebKitModernMediaControlsEnabledPreferenceKey @"WebKitModernMediaControlsEnabled" > #define WebKitSubtleCryptoEnabledPreferenceKey @"WebKitSubtleCryptoEnabled" > #define WebKitMediaDevicesEnabledPreferenceKey @"WebKitMediaDevicesEnabled" >diff --git a/Source/WebKitLegacy/mac/WebView/WebPreferences.mm b/Source/WebKitLegacy/mac/WebView/WebPreferences.mm >index 22aa954cd61..8193b515739 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebPreferences.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebPreferences.mm >@@ -657,6 +657,7 @@ public: > [NSNumber numberWithBool:NO], WebKitVisualViewportAPIEnabledPreferenceKey, > > [NSNumber numberWithBool:NO], WebKitCSSOMViewScrollingAPIEnabledPreferenceKey, >+ [NSNumber numberWithBool:NO], WebKitCSSOMViewSmoothScrollingEnabledPreferenceKey, > [NSNumber numberWithBool:YES], WebKitNeedsStorageAccessFromFileURLsQuirkKey, > [NSNumber numberWithBool:NO], WebKitAllowCrossOriginSubresourcesToAskForCredentialsKey, > #if ENABLE(MEDIA_STREAM) >@@ -3106,6 +3107,16 @@ static NSString *classIBCreatorID = nil; > [self _setBoolValue:flag forKey:WebKitCSSOMViewScrollingAPIEnabledPreferenceKey]; > } > >+- (BOOL)CSSOMViewSmoothScrollingEnabled >+{ >+ return [self _boolValueForKey:WebKitCSSOMViewSmoothScrollingEnabledPreferenceKey]; >+} >+ >+- (void)setCSSOMViewSmoothScrollingEnabled:(BOOL)flag >+{ >+ [self _setBoolValue:flag forKey:WebKitCSSOMViewSmoothScrollingEnabledPreferenceKey]; >+} >+ > - (BOOL)webAnimationsEnabled > { > return [self _boolValueForKey:WebKitWebAnimationsEnabledPreferenceKey]; >diff --git a/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h b/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h >index 162ada1d644..36f69f7cc2c 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h >+++ b/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h >@@ -585,6 +585,7 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification WEBKIT_DEPR > @property (nonatomic) BOOL visualViewportEnabled; > @property (nonatomic) BOOL visualViewportAPIEnabled; > @property (nonatomic) BOOL CSSOMViewScrollingAPIEnabled; >+@property (nonatomic) BOOL CSSOMViewSmoothScrollingEnabled; > @property (nonatomic) BOOL largeImageAsyncDecodingEnabled; > @property (nonatomic) BOOL animatedImageAsyncDecodingEnabled; > @property (nonatomic) BOOL javaScriptMarkupEnabled; >diff --git a/Source/WebKitLegacy/mac/WebView/WebView.mm b/Source/WebKitLegacy/mac/WebView/WebView.mm >index 4b661278470..552637db994 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebView.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebView.mm >@@ -2957,6 +2957,7 @@ static bool needsSelfRetainWhileLoadingQuirk() > settings.setVisualViewportEnabled([preferences visualViewportEnabled]); > settings.setVisualViewportAPIEnabled([preferences visualViewportAPIEnabled]); > settings.setCSSOMViewScrollingAPIEnabled([preferences CSSOMViewScrollingAPIEnabled]); >+ settings.setCSSOMViewSmoothScrollingEnabled([preferences CSSOMViewSmoothScrollingEnabled]); > settings.setMediaContentTypesRequiringHardwareSupport([preferences mediaContentTypesRequiringHardwareSupport]); > > switch ([preferences storageBlockingPolicy]) { >diff --git a/Source/WebKitLegacy/win/ChangeLog b/Source/WebKitLegacy/win/ChangeLog >index 6f70827f3da..1ae6b718110 100644 >--- a/Source/WebKitLegacy/win/ChangeLog >+++ b/Source/WebKitLegacy/win/ChangeLog >@@ -1,3 +1,20 @@ >+2018-11-07 Frederic Wang <fwang@igalia.com> >+ >+ Add support for ScrollOptions' ScrollBehavior and CSS scroll-behavior properties >+ https://bugs.webkit.org/show_bug.cgi?id=188043 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Interfaces/IWebPreferencesPrivate.idl: Handle smooth scrolling option. >+ * WebPreferenceKeysPrivate.h: Ditto. >+ * WebPreferences.cpp: Ditto. >+ (WebPreferences::initializeDefaultSettings): >+ (WebPreferences::CSSOMViewSmoothScrollingEnabled): >+ (WebPreferences::setCSSOMViewSmoothScrollingEnabled): >+ * WebPreferences.h: Ditto. >+ * WebView.cpp: Ditto. >+ (WebView::notifyPreferencesChanged): >+ > 2018-12-24 Fujii Hironori <Hironori.Fujii@sony.com> > > Remove "using namespace std;" >diff --git a/Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl b/Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl >index 19882cdd0f0..4def57bce90 100644 >--- a/Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl >+++ b/Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl >@@ -223,6 +223,8 @@ interface IWebPreferencesPrivate6 : IWebPreferencesPrivate5 > HRESULT setVisualViewportAPIEnabled([in] BOOL enabled); > HRESULT CSSOMViewScrollingAPIEnabled([out, retval] BOOL*); > HRESULT setCSSOMViewScrollingAPIEnabled([in] BOOL enabled); >+ HRESULT CSSOMViewSmoothScrollingEnabled([out, retval] BOOL*); >+ HRESULT setCSSOMViewSmoothScrollingEnabled([in] BOOL enabled); > HRESULT fetchAPIKeepAliveEnabled([out, retval] BOOL* enabled); > HRESULT setFetchAPIKeepAliveEnabled([in] BOOL enabled); > HRESULT spatialNavigationEnabled([out, retval] BOOL *enabled); >diff --git a/Source/WebKitLegacy/win/WebPreferenceKeysPrivate.h b/Source/WebKitLegacy/win/WebPreferenceKeysPrivate.h >index 940d5cf55d1..ae6ef274ecb 100644 >--- a/Source/WebKitLegacy/win/WebPreferenceKeysPrivate.h >+++ b/Source/WebKitLegacy/win/WebPreferenceKeysPrivate.h >@@ -205,4 +205,5 @@ > #define WebKitServerTimingEnabledPreferenceKey "WebKitServerTimingEnabled" > > #define WebKitCSSOMViewScrollingAPIEnabledPreferenceKey "WebKitCSSOMViewScrollingAPIEnabled" >+#define WebKitCSSOMViewSmoothScrollingEnabledPreferenceKey "WebKitCSSOMViewSmoothScrollingEnabled" > >diff --git a/Source/WebKitLegacy/win/WebPreferences.cpp b/Source/WebKitLegacy/win/WebPreferences.cpp >index 59be0c443f4..b57613bb19c 100644 >--- a/Source/WebKitLegacy/win/WebPreferences.cpp >+++ b/Source/WebKitLegacy/win/WebPreferences.cpp >@@ -328,6 +328,8 @@ void WebPreferences::initializeDefaultSettings() > > CFDictionaryAddValue(defaults, CFSTR(WebKitCSSOMViewScrollingAPIEnabledPreferenceKey), kCFBooleanFalse); > >+ CFDictionaryAddValue(defaults, CFSTR(WebKitCSSOMViewSmoothScrollingEnabledPreferenceKey), kCFBooleanFalse); >+ > defaultSettings = defaults; > } > >@@ -2198,6 +2200,20 @@ HRESULT WebPreferences::setCSSOMViewScrollingAPIEnabled(BOOL enabled) > return S_OK; > } > >+HRESULT WebPreferences::CSSOMViewSmoothScrollingEnabled(_Out_ BOOL* enabled) >+{ >+ if (!enabled) >+ return E_POINTER; >+ *enabled = boolValueForKey(WebKitCSSOMViewSmoothScrollingEnabledPreferenceKey); >+ return S_OK; >+} >+ >+HRESULT WebPreferences::setCSSOMViewSmoothScrollingEnabled(BOOL enabled) >+{ >+ setBoolValue(WebKitCSSOMViewSmoothScrollingEnabledPreferenceKey, enabled); >+ return S_OK; >+} >+ > HRESULT WebPreferences::setApplicationId(BSTR applicationId) > { > m_applicationId = String(applicationId).createCFString(); >diff --git a/Source/WebKitLegacy/win/WebPreferences.h b/Source/WebKitLegacy/win/WebPreferences.h >index 2906b36b188..2402d82dc81 100644 >--- a/Source/WebKitLegacy/win/WebPreferences.h >+++ b/Source/WebKitLegacy/win/WebPreferences.h >@@ -271,6 +271,8 @@ public: > virtual HRESULT STDMETHODCALLTYPE setVisualViewportAPIEnabled(BOOL); > virtual HRESULT STDMETHODCALLTYPE CSSOMViewScrollingAPIEnabled(_Out_ BOOL*); > virtual HRESULT STDMETHODCALLTYPE setCSSOMViewScrollingAPIEnabled(BOOL); >+ virtual HRESULT STDMETHODCALLTYPE CSSOMViewSmoothScrollingEnabled(_Out_ BOOL*); >+ virtual HRESULT STDMETHODCALLTYPE setCSSOMViewSmoothScrollingEnabled(BOOL); > virtual HRESULT STDMETHODCALLTYPE fetchAPIKeepAliveEnabled(_Out_ BOOL*); > virtual HRESULT STDMETHODCALLTYPE setFetchAPIKeepAliveEnabled(BOOL); > virtual HRESULT STDMETHODCALLTYPE spatialNavigationEnabled(_Out_ BOOL*); >diff --git a/Source/WebKitLegacy/win/WebView.cpp b/Source/WebKitLegacy/win/WebView.cpp >index 08a7b2c58df..c5fdb843b44 100644 >--- a/Source/WebKitLegacy/win/WebView.cpp >+++ b/Source/WebKitLegacy/win/WebView.cpp >@@ -5282,6 +5282,11 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification) > return hr; > settings.setCSSOMViewScrollingAPIEnabled(!!enabled); > >+ hr = prefsPrivate->CSSOMViewSmoothScrollingEnabled(&enabled); >+ if (FAILED(hr)) >+ return hr; >+ settings.setCSSOMViewSmoothScrollingEnabled(!!enabled); >+ > hr = preferences->privateBrowsingEnabled(&enabled); > if (FAILED(hr)) > return hr; >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 48d642a731d..623be273940 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,14 @@ >+2018-11-06 Frederic Wang <fwang@igalia.com> >+ >+ Add support for ScrollOptions' ScrollBehavior and CSS scroll-behavior properties >+ https://bugs.webkit.org/show_bug.cgi?id=188043 >+ >+ * DumpRenderTree/TestOptions.cpp: >+ (TestOptions::TestOptions): Parse CSSOMViewSmoothScrollingEnabled. >+ * DumpRenderTree/TestOptions.h: Add CSSOMViewSmoothScrollingEnabled, disabled by default. >+ * DumpRenderTree/mac/DumpRenderTree.mm: >+ (setWebPreferencesForTestOptions): Set CSSOMViewSmoothScrollingEnabled from the test options. >+ > 2019-01-03 Ross Kirsling <ross.kirsling@sony.com> > > test262-runner misbehaves when test file YAML has a trailing space >diff --git a/Tools/DumpRenderTree/TestOptions.cpp b/Tools/DumpRenderTree/TestOptions.cpp >index 82d87e13ac8..3d4a9fd4509 100644 >--- a/Tools/DumpRenderTree/TestOptions.cpp >+++ b/Tools/DumpRenderTree/TestOptions.cpp >@@ -107,6 +107,8 @@ TestOptions::TestOptions(const std::string& pathOrURL, const std::string& absolu > jscOptions = value; > else if (key == "experimental:WebGPUEnabled") > enableWebGPU = parseBooleanTestHeaderValue(value); >+ else if (key == "experimental:CSSOMViewSmoothScrollingEnabled") >+ enableCSSOMViewSmoothScrolling = parseBooleanTestHeaderValue(value); > pairStart = pairEnd + 1; > } > } >diff --git a/Tools/DumpRenderTree/TestOptions.h b/Tools/DumpRenderTree/TestOptions.h >index a44ea1faac9..122bd2632c2 100644 >--- a/Tools/DumpRenderTree/TestOptions.h >+++ b/Tools/DumpRenderTree/TestOptions.h >@@ -44,6 +44,7 @@ struct TestOptions { > bool enableColorFilter { false }; > bool enableSelectionAcrossShadowBoundaries { true }; > bool enableWebGPU { false }; >+ bool enableCSSOMViewSmoothScrolling { false }; > std::string jscOptions; > > TestOptions(const std::string& pathOrURL, const std::string& absolutePath); >diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm >index d491997d325..e0bfc0e003b 100644 >--- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm >+++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm >@@ -1010,6 +1010,7 @@ static void setWebPreferencesForTestOptions(const TestOptions& options) > preferences.colorFilterEnabled = options.enableColorFilter; > preferences.selectionAcrossShadowBoundariesEnabled = options.enableSelectionAcrossShadowBoundaries; > preferences.webGPUEnabled = options.enableWebGPU; >+ preferences.CSSOMViewSmoothScrollingEnabled = options.enableCSSOMViewSmoothScrolling; > } > > // Called once on DumpRenderTree startup. >-- >2.20.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188043
:
346381
|
346513
|
346627
|
348010
|
348493
|
348494
|
348500
|
348903
|
348904
|
349043
|
349393
|
349536
|
349668
|
349879
|
350255
|
350271
|
350286
|
350288
|
350309
|
350409
|
350566
|
350567
|
350568
|
350571
|
350572
|
350579
|
350610
|
350615
|
350617
|
350620
|
350621
|
353958
|
353960
|
354071
|
354079
|
354082
|
354086
|
354319
|
354320
|
356043
|
356151
|
358313
|
363090
|
363093
|
368453
|
368454
|
368455
|
368459
|
368460
|
372999
|
377582
|
377813
|
378193
|
382485
|
382550
|
382561
|
384462
|
384514
|
384517
|
384623
|
384720
|
384789
|
384800
|
440977