Changeset 255957 in webkit
- Timestamp:
- Feb 6, 2020 8:49:04 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 47 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r255956 r255957 1 2020-02-06 Cathie Chen <cathiechen@igalia.com> 2 3 Add support for scroll behavior relies on ScrollAnimation of the Web process 4 https://bugs.webkit.org/show_bug.cgi?id=204882 5 6 Reviewed by Frédéric Wang 7 8 Based on the patch by Frédéric Wang. 9 10 * platform/mac-wk1/TestExpectations: Skip these tests on WK1 as they don't work for now. 11 1 12 2020-02-06 Jason Lawrence <lawrence.j@apple.com> 2 13 -
trunk/LayoutTests/imported/w3c/ChangeLog
r255821 r255957 1 2020-02-06 Cathie Chen <cathiechen@igalia.com> 2 3 Add support for scroll behavior relies on ScrollAnimation of the Web process 4 https://bugs.webkit.org/show_bug.cgi?id=204882 5 6 Reviewed by Frédéric Wang 7 8 Based on the patch by Frédéric Wang. 9 10 Enable CSSOMViewSmoothScrollingEnabled on scroll behavior tests and update expectations. 11 12 * web-platform-tests/css/cssom-view/scroll-behavior-default-css-expected.txt: 13 * web-platform-tests/css/cssom-view/scroll-behavior-default-css.html: 14 * web-platform-tests/css/cssom-view/scroll-behavior-element-expected.txt: 15 * web-platform-tests/css/cssom-view/scroll-behavior-element.html: 16 * web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root-expected.txt: 17 * web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root.html: 18 * web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window-expected.txt: 19 * web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window.html: 20 * web-platform-tests/css/cssom-view/scroll-behavior-scrollintoview-nested-expected.txt: 21 * web-platform-tests/css/cssom-view/scroll-behavior-scrollintoview-nested.html: 22 * web-platform-tests/css/cssom-view/scroll-behavior-smooth-positions.html: 23 * web-platform-tests/css/cssom-view/scroll-behavior-subframe-root-expected.txt: 24 * web-platform-tests/css/cssom-view/scroll-behavior-subframe-root.html: 25 * web-platform-tests/css/cssom-view/scroll-behavior-subframe-window-expected.txt: 26 * web-platform-tests/css/cssom-view/scroll-behavior-subframe-window.html: 27 1 28 2020-02-05 Antoine Quint <graouts@apple.com> 2 29 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-default-css-expected.txt
r254890 r255957 1 1 2 2 PASS Instant scrolling of an element with default scroll-behavior 3 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 3 PASS Smooth scrolling of an element with default scroll-behavior 4 4 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-default-css.html
r254890 r255957 1 <!DOCTYPE html> 1 <!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSOMViewSmoothScrollingEnabled=true ] --> 2 2 <title>Testing default value of scroll-behavior</title> 3 3 <meta name="timeout" content="long"/> -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-element-expected.txt
r254890 r255957 3 3 PASS Element with auto scroll-behavior ; scroll() with auto behavior 4 4 PASS Element with auto scroll-behavior ; scroll() with instant behavior 5 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 6 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 7 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 5 PASS Element with auto scroll-behavior ; scroll() with smooth behavior 6 PASS Element with smooth scroll-behavior ; scroll() with default behavior 7 PASS Element with smooth scroll-behavior ; scroll() with auto behavior 8 8 PASS Element with smooth scroll-behavior ; scroll() with instant behavior 9 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 9 PASS Element with smooth scroll-behavior ; scroll() with smooth behavior 10 10 PASS Element with auto scroll-behavior ; scrollTo() with default behavior 11 11 PASS Element with auto scroll-behavior ; scrollTo() with auto behavior 12 12 PASS Element with auto scroll-behavior ; scrollTo() with instant behavior 13 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 14 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 15 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 13 PASS Element with auto scroll-behavior ; scrollTo() with smooth behavior 14 PASS Element with smooth scroll-behavior ; scrollTo() with default behavior 15 PASS Element with smooth scroll-behavior ; scrollTo() with auto behavior 16 16 PASS Element with smooth scroll-behavior ; scrollTo() with instant behavior 17 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 17 PASS Element with smooth scroll-behavior ; scrollTo() with smooth behavior 18 18 PASS Element with auto scroll-behavior ; scrollBy() with default behavior 19 19 PASS Element with auto scroll-behavior ; scrollBy() with auto behavior 20 20 PASS Element with auto scroll-behavior ; scrollBy() with instant behavior 21 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 22 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 23 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 21 PASS Element with auto scroll-behavior ; scrollBy() with smooth behavior 22 PASS Element with smooth scroll-behavior ; scrollBy() with default behavior 23 PASS Element with smooth scroll-behavior ; scrollBy() with auto behavior 24 24 PASS Element with smooth scroll-behavior ; scrollBy() with instant behavior 25 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 25 PASS Element with smooth scroll-behavior ; scrollBy() with smooth behavior 26 26 PASS Element with auto scroll-behavior ; scrollIntoView() with default behavior 27 27 PASS Element with auto scroll-behavior ; scrollIntoView() with auto behavior 28 28 PASS Element with auto scroll-behavior ; scrollIntoView() with instant behavior 29 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 30 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 31 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 29 PASS Element with auto scroll-behavior ; scrollIntoView() with smooth behavior 30 PASS Element with smooth scroll-behavior ; scrollIntoView() with default behavior 31 PASS Element with smooth scroll-behavior ; scrollIntoView() with auto behavior 32 32 PASS Element with smooth scroll-behavior ; scrollIntoView() with instant behavior 33 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 33 PASS Element with smooth scroll-behavior ; scrollIntoView() with smooth behavior 34 34 PASS Set scrollLeft to element with auto scroll-behavior 35 FAIL Set scrollLeft to element with smooth scroll-behavior assert_less_than: Shouldn't set scroll attribute immediately expected a number less than 500 but got 500 35 PASS Set scrollLeft to element with smooth scroll-behavior 36 36 PASS Set scrollTop to element with auto scroll-behavior 37 FAIL Set scrollTop to element with smooth scroll-behavior assert_less_than: Shouldn't set scroll attribute immediately expected a number less than 250 but got 250 37 PASS Set scrollTop to element with smooth scroll-behavior 38 38 PASS Aborting an ongoing smooth scrolling on an element with another smooth scrolling 39 39 PASS Aborting an ongoing smooth scrolling on an element with an instant scrolling -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-element.html
r254890 r255957 1 <!DOCTYPE html> 1 <!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSOMViewSmoothScrollingEnabled=true ] --> 2 2 <title>Testing scrollOptions' behavior for Element.scroll* and scroll-behavior on an element</title> 3 3 <meta name="timeout" content="long"/> -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root-expected.txt
r254890 r255957 4 4 PASS Main frame with auto scroll-behavior ; scroll() with auto behavior 5 5 PASS Main frame with auto scroll-behavior ; scroll() with instant behavior 6 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 7 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 8 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 6 PASS Main frame with auto scroll-behavior ; scroll() with smooth behavior 7 PASS Main frame with smooth scroll-behavior ; scroll() with default behavior 8 PASS Main frame with smooth scroll-behavior ; scroll() with auto behavior 9 9 PASS Main frame with smooth scroll-behavior ; scroll() with instant behavior 10 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 10 PASS Main frame with smooth scroll-behavior ; scroll() with smooth behavior 11 11 PASS Main frame with auto scroll-behavior ; scrollTo() with default behavior 12 12 PASS Main frame with auto scroll-behavior ; scrollTo() with auto behavior 13 13 PASS Main frame with auto scroll-behavior ; scrollTo() with instant behavior 14 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 15 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 16 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 14 PASS Main frame with auto scroll-behavior ; scrollTo() with smooth behavior 15 PASS Main frame with smooth scroll-behavior ; scrollTo() with default behavior 16 PASS Main frame with smooth scroll-behavior ; scrollTo() with auto behavior 17 17 PASS Main frame with smooth scroll-behavior ; scrollTo() with instant behavior 18 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 18 PASS Main frame with smooth scroll-behavior ; scrollTo() with smooth behavior 19 19 PASS Main frame with auto scroll-behavior ; scrollBy() with default behavior 20 20 PASS Main frame with auto scroll-behavior ; scrollBy() with auto behavior 21 21 PASS Main frame with auto scroll-behavior ; scrollBy() with instant behavior 22 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 23 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 24 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 22 PASS Main frame with auto scroll-behavior ; scrollBy() with smooth behavior 23 PASS Main frame with smooth scroll-behavior ; scrollBy() with default behavior 24 PASS Main frame with smooth scroll-behavior ; scrollBy() with auto behavior 25 25 PASS Main frame with smooth scroll-behavior ; scrollBy() with instant behavior 26 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 26 PASS Main frame with smooth scroll-behavior ; scrollBy() with smooth behavior 27 27 PASS Main frame with auto scroll-behavior ; scrollIntoView() with default behavior 28 28 PASS Main frame with auto scroll-behavior ; scrollIntoView() with auto behavior 29 29 PASS Main frame with auto scroll-behavior ; scrollIntoView() with instant behavior 30 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 31 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 32 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 30 PASS Main frame with auto scroll-behavior ; scrollIntoView() with smooth behavior 31 PASS Main frame with smooth scroll-behavior ; scrollIntoView() with default behavior 32 PASS Main frame with smooth scroll-behavior ; scrollIntoView() with auto behavior 33 33 PASS Main frame with smooth scroll-behavior ; scrollIntoView() with instant behavior 34 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 34 PASS Main frame with smooth scroll-behavior ; scrollIntoView() with smooth behavior 35 35 PASS Set scrollLeft to frame with auto scroll-behavior 36 FAIL Set scrollLeft to frame with smooth scroll-behavior assert_less_than: Shouldn't set scroll attribute immediately expected a number less than 2430 but got 2430 36 PASS Set scrollLeft to frame with smooth scroll-behavior 37 37 PASS Set scrollTop to frame with auto scroll-behavior 38 FAIL Set scrollTop to frame with smooth scroll-behavior assert_less_than: Shouldn't set scroll attribute immediately expected a number less than 2480 but got 2480 38 PASS Set scrollTop to frame with smooth scroll-behavior 39 39 PASS Aborting an ongoing smooth scrolling on the main frame with another smooth scrolling 40 40 PASS Aborting an ongoing smooth scrolling on the main frame with an instant scrolling -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root.html
r254890 r255957 1 <!DOCTYPE html> 1 <!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSOMViewSmoothScrollingEnabled=true ] --> 2 2 <title>Testing scrollOptions' behavior for Element.scroll* and scroll-behavior on the root of the main frame</title> 3 3 <meta name="timeout" content="long"/> -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window-expected.txt
r254890 r255957 4 4 PASS Main frame with auto scroll-behavior ; scroll() with auto behavior 5 5 PASS Main frame with auto scroll-behavior ; scroll() with instant behavior 6 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 7 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 8 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 6 PASS Main frame with auto scroll-behavior ; scroll() with smooth behavior 7 PASS Main frame with smooth scroll-behavior ; scroll() with default behavior 8 PASS Main frame with smooth scroll-behavior ; scroll() with auto behavior 9 9 PASS Main frame with smooth scroll-behavior ; scroll() with instant behavior 10 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 10 PASS Main frame with smooth scroll-behavior ; scroll() with smooth behavior 11 11 PASS Main frame with auto scroll-behavior ; scrollTo() with default behavior 12 12 PASS Main frame with auto scroll-behavior ; scrollTo() with auto behavior 13 13 PASS Main frame with auto scroll-behavior ; scrollTo() with instant behavior 14 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 15 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 16 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 14 PASS Main frame with auto scroll-behavior ; scrollTo() with smooth behavior 15 PASS Main frame with smooth scroll-behavior ; scrollTo() with default behavior 16 PASS Main frame with smooth scroll-behavior ; scrollTo() with auto behavior 17 17 PASS Main frame with smooth scroll-behavior ; scrollTo() with instant behavior 18 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 18 PASS Main frame with smooth scroll-behavior ; scrollTo() with smooth behavior 19 19 PASS Main frame with auto scroll-behavior ; scrollBy() with default behavior 20 20 PASS Main frame with auto scroll-behavior ; scrollBy() with auto behavior 21 21 PASS Main frame with auto scroll-behavior ; scrollBy() with instant behavior 22 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 23 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 24 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 22 PASS Main frame with auto scroll-behavior ; scrollBy() with smooth behavior 23 PASS Main frame with smooth scroll-behavior ; scrollBy() with default behavior 24 PASS Main frame with smooth scroll-behavior ; scrollBy() with auto behavior 25 25 PASS Main frame with smooth scroll-behavior ; scrollBy() with instant behavior 26 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 26 PASS Main frame with smooth scroll-behavior ; scrollBy() with smooth behavior 27 27 PASS Aborting an ongoing smooth scrolling on the main frame with another smooth scrolling 28 28 PASS Aborting an ongoing smooth scrolling on the main frame with an instant scrolling -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window.html
r254890 r255957 1 <!DOCTYPE html> 1 <!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSOMViewSmoothScrollingEnabled=true ] --> 2 2 <title>Testing scrollOptions' behavior for Element.scroll* on the window of the main frame</title> 3 3 <meta name="timeout" content="long"/> -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-scrollintoview-nested-expected.txt
r254890 r255957 1 1 2 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 2 PASS scrollIntoView with nested elements with different scroll-behavior 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-scrollintoview-nested.html
r254890 r255957 1 <!DOCTYPE html> 1 <!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSOMViewSmoothScrollingEnabled=true ] --> 2 2 <title>Testing scrollOptions' behavior with scrollIntoView for nested scrolling nodes</title> 3 3 <meta name="timeout" content="long"/> -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-smooth-positions.html
r254890 r255957 1 <!DOCTYPE html> 1 <!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSOMViewSmoothScrollingEnabled=true ] --> 2 2 <title>Testing scroll positions when scrolling an element with smooth behavior</title> 3 3 <meta name="timeout" content="long"/> -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-root-expected.txt
r254890 r255957 4 4 PASS Subframe with auto scroll-behavior ; scroll() with auto behavior 5 5 PASS Subframe with auto scroll-behavior ; scroll() with instant behavior 6 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 7 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 8 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 6 PASS Subframe with auto scroll-behavior ; scroll() with smooth behavior 7 PASS Subframe with smooth scroll-behavior ; scroll() with default behavior 8 PASS Subframe with smooth scroll-behavior ; scroll() with auto behavior 9 9 PASS Subframe with smooth scroll-behavior ; scroll() with instant behavior 10 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 10 PASS Subframe with smooth scroll-behavior ; scroll() with smooth behavior 11 11 PASS Subframe with auto scroll-behavior ; scrollTo() with default behavior 12 12 PASS Subframe with auto scroll-behavior ; scrollTo() with auto behavior 13 13 PASS Subframe with auto scroll-behavior ; scrollTo() with instant behavior 14 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 15 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 16 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 14 PASS Subframe with auto scroll-behavior ; scrollTo() with smooth behavior 15 PASS Subframe with smooth scroll-behavior ; scrollTo() with default behavior 16 PASS Subframe with smooth scroll-behavior ; scrollTo() with auto behavior 17 17 PASS Subframe with smooth scroll-behavior ; scrollTo() with instant behavior 18 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 18 PASS Subframe with smooth scroll-behavior ; scrollTo() with smooth behavior 19 19 PASS Subframe with auto scroll-behavior ; scrollBy() with default behavior 20 20 PASS Subframe with auto scroll-behavior ; scrollBy() with auto behavior 21 21 PASS Subframe with auto scroll-behavior ; scrollBy() with instant behavior 22 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 23 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 24 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 22 PASS Subframe with auto scroll-behavior ; scrollBy() with smooth behavior 23 PASS Subframe with smooth scroll-behavior ; scrollBy() with default behavior 24 PASS Subframe with smooth scroll-behavior ; scrollBy() with auto behavior 25 25 PASS Subframe with smooth scroll-behavior ; scrollBy() with instant behavior 26 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 26 PASS Subframe with smooth scroll-behavior ; scrollBy() with smooth behavior 27 27 PASS Subframe with auto scroll-behavior ; scrollIntoView() with default behavior 28 28 PASS Subframe with auto scroll-behavior ; scrollIntoView() with auto behavior 29 29 PASS Subframe with auto scroll-behavior ; scrollIntoView() with instant behavior 30 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 31 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 32 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 30 PASS Subframe with auto scroll-behavior ; scrollIntoView() with smooth behavior 31 PASS Subframe with smooth scroll-behavior ; scrollIntoView() with default behavior 32 PASS Subframe with smooth scroll-behavior ; scrollIntoView() with auto behavior 33 33 PASS Subframe with smooth scroll-behavior ; scrollIntoView() with instant behavior 34 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 34 PASS Subframe with smooth scroll-behavior ; scrollIntoView() with smooth behavior 35 35 PASS Subframe setting scrollLeft with auto scroll-behavior 36 FAIL Subframe setting scrollLeft with smooth scroll-behavior assert_less_than: Should not set scrollLeft immediately expected a number less than 500 but got 500 36 PASS Subframe setting scrollLeft with smooth scroll-behavior 37 37 PASS Subframe setting scrollTop with auto scroll-behavior 38 FAIL Subframe setting scrollTop with smooth scroll-behavior assert_less_than: Should not set scrollTop immediately expected a number less than 250 but got 250 38 PASS Subframe setting scrollTop with smooth scroll-behavior 39 39 PASS Aborting an ongoing smooth scrolling on a subframe with another smooth scrolling 40 40 PASS Aborting an ongoing smooth scrolling on a subframe with an instant scrolling -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-root.html
r254890 r255957 1 <!DOCTYPE html> 1 <!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSOMViewSmoothScrollingEnabled=true ] --> 2 2 <title>Testing scrollOptions' behavior for Element.scroll* and scroll-behavior on the root of a subframe</title> 3 3 <meta name="timeout" content="long"/> -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-window-expected.txt
r254890 r255957 4 4 PASS Main frame with auto scroll-behavior ; scroll() with auto behavior 5 5 PASS Main frame with auto scroll-behavior ; scroll() with instant behavior 6 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 7 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 8 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 6 PASS Main frame with auto scroll-behavior ; scroll() with smooth behavior 7 PASS Main frame with smooth scroll-behavior ; scroll() with default behavior 8 PASS Main frame with smooth scroll-behavior ; scroll() with auto behavior 9 9 PASS Main frame with smooth scroll-behavior ; scroll() with instant behavior 10 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 10 PASS Main frame with smooth scroll-behavior ; scroll() with smooth behavior 11 11 PASS Main frame with auto scroll-behavior ; scrollTo() with default behavior 12 12 PASS Main frame with auto scroll-behavior ; scrollTo() with auto behavior 13 13 PASS Main frame with auto scroll-behavior ; scrollTo() with instant behavior 14 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 15 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 16 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 14 PASS Main frame with auto scroll-behavior ; scrollTo() with smooth behavior 15 PASS Main frame with smooth scroll-behavior ; scrollTo() with default behavior 16 PASS Main frame with smooth scroll-behavior ; scrollTo() with auto behavior 17 17 PASS Main frame with smooth scroll-behavior ; scrollTo() with instant behavior 18 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 18 PASS Main frame with smooth scroll-behavior ; scrollTo() with smooth behavior 19 19 PASS Main frame with auto scroll-behavior ; scrollBy() with default behavior 20 20 PASS Main frame with auto scroll-behavior ; scrollBy() with auto behavior 21 21 PASS Main frame with auto scroll-behavior ; scrollBy() with instant behavior 22 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 23 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 24 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 22 PASS Main frame with auto scroll-behavior ; scrollBy() with smooth behavior 23 PASS Main frame with smooth scroll-behavior ; scrollBy() with default behavior 24 PASS Main frame with smooth scroll-behavior ; scrollBy() with auto behavior 25 25 PASS Main frame with smooth scroll-behavior ; scrollBy() with instant behavior 26 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 26 PASS Main frame with smooth scroll-behavior ; scrollBy() with smooth behavior 27 27 PASS Aborting an ongoing smooth scrolling on the main frame with another smooth scrolling 28 28 PASS Aborting an ongoing smooth scrolling on the main frame with an instant scrolling -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-window.html
r254890 r255957 1 <!DOCTYPE html> 1 <!DOCTYPE html><!-- webkit-test-runner [ experimental:CSSOMViewSmoothScrollingEnabled=true ] --> 2 2 <title>Testing scrollOptions' behavior for Element.scroll* and scroll-behavior on the root of a subframe</title> 3 3 <meta name="timeout" content="long"/> -
trunk/LayoutTests/platform/mac-wk1/TestExpectations
r255856 r255957 749 749 webkit.org/b/188070 imported/w3c/web-platform-tests/streams/piping/error-propagation-backward.html [ Pass Failure ] 750 750 751 # Tests for smooth scroll behavior do not all work and they are slow, so let's just skip them. 752 webkit.org/b/191357 imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root.html [ Skip ] 753 webkit.org/b/191357 imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window.html [ Skip ] 754 webkit.org/b/191357 imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-root.html [ Skip ] 755 webkit.org/b/191357 imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-window.html [ Skip ] 756 751 757 webkit.org/b/189908 imported/w3c/web-platform-tests/resource-timing/resource_timing.worker.html [ Failure ] 752 758 -
trunk/Source/WebCore/ChangeLog
r255953 r255957 1 2020-02-06 Cathie Chen <cathiechen@igalia.com> 2 3 Add support for scroll behavior relies on ScrollAnimation of the Web process 4 https://bugs.webkit.org/show_bug.cgi?id=204882 5 6 Reviewed by Frédéric Wang 7 8 Based on the patch by Frédéric Wang. 9 10 This patch introduces a programmatic smooth scrolling in WebKit from the CSSOM View 11 specification [1]. To use this effect, web developers can pass a behavior parameter (auto, 12 smooth, or instant) to Element.scroll, Element.scrollTo, Element.scrollBy, 13 Element.scrollIntoView, Window.scroll, Window.scrollTo or Window.scrollBy [2]. When behavior 14 is auto, the instant/smooth characteristic is actually taken from the value of a new CSS 15 scroll-behavior property [3]. Both the new CSS and DOM behavior are protected by a runtime 16 flag. 17 18 [1] https://drafts.csswg.org/cssom-view 19 [2] https://drafts.csswg.org/cssom-view/#dictdef-scrolloptions 20 [3] https://drafts.csswg.org/cssom-view/#propdef-scroll-behavior 21 22 Tests: imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-default-css.html 23 imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-element.html 24 imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root.html 25 imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window.html 26 imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-scrollintoview-nested.html 27 imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-smooth-positions.html 28 imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-root.html 29 imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-window.html 30 * Sources.txt: Build ScrollAnimationSmooth.cpp on all platforms. 31 * SourcesGTK.txt: Remove ScrollAnimationSmooth.cpp since it is built on all platforms now. 32 * dom/Element.cpp: 33 (WebCore::Element::scrollIntoView): Pass scroll behavior, if any. 34 (WebCore::Element::scrollBy): 35 (WebCore::Element::scrollTo): Handle the case when scroll behavior is smooth. 36 (WebCore::Element::setScrollLeft): Handle the case when scroll behavior is smooth. 37 (WebCore::Element::setScrollTop): Handle the case when scroll behavior is smooth. 38 * page/DOMWindow.cpp: 39 (WebCore::DOMWindow::scrollBy const): 40 (WebCore::DOMWindow::scrollTo const): Handle the case when scroll behavior is smooth. 41 The optimization of cancel (0, 0) scrolling is skipped if an animated scroll is in progress. 42 Otherwise, the previous scroll won't be stopped by a follow-up scroll. 43 * page/FrameView.cpp: 44 (WebCore::FrameView::setScrollPosition): 45 (WebCore::FrameView::scrollToOffsetWithAnimation): Start an animated scroll. 46 * page/FrameView.h: 47 * platform/ScrollAnimation.h: 48 (WebCore::ScrollAnimation::scroll): Function to animate scrolling to a specified position. 49 * platform/ScrollAnimationSmooth.cpp: Build this file on all platforms. Add a 50 smoothFactorForProgrammaticScroll parameter to slow down the smooth scrolling. 51 (WebCore::ScrollAnimationSmooth::scroll): 52 (WebCore::ScrollAnimationSmooth::updatePerAxisData): Scale the time parameters of the 53 animation so that it looks smoother. 54 * platform/ScrollAnimationSmooth.h: Declare the class on all platforms. 55 * platform/ScrollAnimator.cpp: 56 (WebCore::ScrollAnimator::ScrollAnimator): Initialize animation member for programmatic scrolling. 57 (WebCore::ScrollAnimator::scrollToOffset): Animate scrolling to the specified position. 58 (WebCore::ScrollAnimator::cancelAnimations): Copy logic from ScrollAnimationSmooth.cpp. 59 (WebCore::ScrollAnimator::serviceScrollAnimations): Ditto. 60 (WebCore::ScrollAnimator::willEndLiveResize): Ditto. 61 (WebCore::ScrollAnimator::didAddVerticalScrollbar): Ditto. 62 (WebCore::ScrollAnimator::didAddHorizontalScrollbar): Ditto. 63 * platform/ScrollAnimator.h: New animation member for smooth programmatic scrolling. 64 (WebCore::ScrollAnimator::ScrollAnimator::cancelAnimations): Deleted. 65 (WebCore::ScrollAnimator::ScrollAnimator::serviceScrollAnimations): Deleted. 66 (WebCore::ScrollAnimator::ScrollAnimator::willEndLiveResize): Deleted. 67 (WebCore::ScrollAnimator::ScrollAnimator::didAddVerticalScrollbar): Deleted. 68 (WebCore::ScrollAnimator::ScrollAnimator::didAddHorizontalScrollbar): Deleted. 69 * platform/ScrollTypes.h: Add ScrollBehaviorStatus to indicate the status of scrolling. 70 * platform/ScrollView.cpp: 71 (WebCore::ScrollView::setScrollPosition): Follow the CSSOM View spec: If a scroll is in 72 progress, we interrupt it and continue the scroll call (even when we are at the final position). 73 * platform/ScrollView.h: 74 * platform/ScrollableArea.cpp: 75 (WebCore::ScrollableArea::ScrollableArea): 76 (WebCore::ScrollableArea::scrollToOffsetWithAnimation): 77 * platform/ScrollableArea.h: 78 (WebCore::ScrollableArea::currentScrollBehaviorStatus const): Maintain currentScrollBehaviorStatus. 79 (WebCore::ScrollableArea::setScrollBehaviorStatus): 80 * platform/mac/ScrollAnimatorMac.mm: 81 (WebCore::ScrollAnimatorMac::cancelAnimations): Call parent member to handle programmatic scrolling. 82 * rendering/RenderBox.cpp: 83 (WebCore::RenderBox::setScrollLeft): Add flag to indicate animated or not. 84 (WebCore::RenderBox::setScrollTop): Ditto. 85 (WebCore::RenderBox::setScrollPosition): 86 * rendering/RenderBox.h: 87 * rendering/RenderLayer.cpp: 88 (WebCore::RenderLayer::scrollToXPosition): Ditto. 89 (WebCore::RenderLayer::scrollToYPosition): Ditto. 90 (WebCore::RenderLayer::scrollToPosition): 91 (WebCore::RenderLayer::scrollToOffset): Follow the CSSOM View spec: If a scroll is in 92 progress, we interrupt it and continue the scroll call (even when we are at the final 93 position). It's ScrollBehaviorType::Instant scroll. 94 (WebCore::RenderLayer::scrollToOffsetWithAnimation): Ditto. This is similar to scrollToOffset 95 but animates the scroll. It's ScrollBehaviorType::Smooth scroll. 96 (WebCore::RenderLayer::scrollTo): 97 (WebCore::RenderLayer::scrollRectToVisible): Again don't do an early return if scroll is in 98 progress. We call scrollToOffsetWithAnimation instead of scrollToOffset when appropriate. 99 Note that this function may not work well for several nested scroll boxes with at least one 100 element with smooth behavior. It will handled in bug Follow. 101 * rendering/RenderLayer.h: Add scroll behavior to ScrollTectToVisibleOptions. 102 * rendering/RenderListBox.cpp: 103 (WebCore::RenderListBox::setScrollLeft): Add animated flag. 104 (WebCore::RenderListBox::setScrollTop): Ditto. 105 * rendering/RenderListBox.h: 106 * rendering/RenderTextControlSingleLine.cpp: 107 (WebCore::RenderTextControlSingleLine::setScrollLeft): 108 (WebCore::RenderTextControlSingleLine::setScrollTop): 109 * rendering/RenderTextControlSingleLine.h: 110 * testing/Internals.cpp: 111 (WebCore::Internals::unconstrainedScrollTo): 112 1 113 2020-02-06 Antoine Quint <graouts@apple.com> 2 114 -
trunk/Source/WebCore/Sources.txt
r255785 r255957 1754 1754 platform/SSLKeyGenerator.cpp 1755 1755 platform/ScrollAnimator.cpp 1756 platform/ScrollAnimationSmooth.cpp 1756 1757 platform/ScrollTypes.cpp 1757 1758 platform/ScrollView.cpp -
trunk/Source/WebCore/SourcesGTK.txt
r254900 r255957 64 64 65 65 platform/ScrollAnimationKinetic.cpp 66 platform/ScrollAnimationSmooth.cpp67 66 platform/UserAgentQuirks.cpp 68 67 -
trunk/Source/WebCore/dom/Element.cpp
r255383 r255957 842 842 LayoutRect absoluteBounds = renderer()->absoluteAnchorRect(&insideFixed); 843 843 844 // FIXME(webkit.org/b/188043): Support ScrollBehavior.845 844 ScrollIntoViewOptions options; 846 845 if (arg) { … … 861 860 isHorizontal ? alignX : alignY, 862 861 isHorizontal ? alignY : alignX, 863 ShouldAllowCrossOriginScrolling::No 862 ShouldAllowCrossOriginScrolling::No, 863 options.behavior.valueOr(ScrollBehavior::Auto) 864 864 }; 865 865 renderer()->scrollRectToVisible(absoluteBounds, insideFixed, visibleOptions); … … 922 922 void Element::scrollBy(double x, double y) 923 923 { 924 scrollBy( { x, y });924 scrollBy(ScrollToOptions(x, y)); 925 925 } 926 926 … … 958 958 adjustForAbsoluteZoom(renderer->scrollTop(), *renderer) 959 959 ); 960 renderer->setScrollLeft(clampToInteger(scrollToOptions.left.value() * renderer->style().effectiveZoom()), ScrollType::Programmatic, clamping); 961 renderer->setScrollTop(clampToInteger(scrollToOptions.top.value() * renderer->style().effectiveZoom()), ScrollType::Programmatic, clamping); 960 IntPoint scrollPosition( 961 clampToInteger(scrollToOptions.left.value() * renderer->style().effectiveZoom()), 962 clampToInteger(scrollToOptions.top.value() * renderer->style().effectiveZoom()) 963 ); 964 bool animated = useSmoothScrolling(scrollToOptions.behavior.valueOr(ScrollBehavior::Auto), this); 965 renderer->setScrollPosition(scrollPosition, ScrollType::Programmatic, clamping, animated); 962 966 } 963 967 964 968 void Element::scrollTo(double x, double y) 965 969 { 966 scrollTo( { x, y });970 scrollTo(ScrollToOptions(x, y)); 967 971 } 968 972 … … 1298 1302 1299 1303 if (document().scrollingElement() == this) { 1300 if (auto* frame = documentFrameWithNonNullView()) 1301 frame->view()->setScrollPosition(IntPoint(static_cast<int>(newLeft * frame->pageZoomFactor() * frame->frameScaleFactor()), frame->view()->scrollY())); 1304 if (auto* frame = documentFrameWithNonNullView()) { 1305 // FIXME: Should we use document()->scrollingElement()? 1306 // See https://bugs.webkit.org/show_bug.cgi?id=205059 1307 bool animated = useSmoothScrolling(ScrollBehavior::Auto, document().documentElement()); 1308 IntPoint position(static_cast<int>(newLeft * frame->pageZoomFactor() * frame->frameScaleFactor()), frame->view()->scrollY()); 1309 frame->view()->setScrollPosition(position, ScrollClamping::Clamped, animated); 1310 } 1302 1311 return; 1303 1312 } 1304 1313 1305 1314 if (auto* renderer = renderBox()) { 1306 renderer->setScrollLeft(static_cast<int>(newLeft * renderer->style().effectiveZoom()), ScrollType::Programmatic); 1315 int clampedLeft = clampToInteger(newLeft * renderer->style().effectiveZoom()); 1316 bool animated = useSmoothScrolling(ScrollBehavior::Auto, this); 1317 renderer->setScrollLeft(clampedLeft, ScrollType::Programmatic, ScrollClamping::Clamped, animated); 1307 1318 if (auto* scrollableArea = renderer->layer()) 1308 1319 scrollableArea->setScrollShouldClearLatchedState(true); … … 1315 1326 1316 1327 if (document().scrollingElement() == this) { 1317 if (auto* frame = documentFrameWithNonNullView()) 1318 frame->view()->setScrollPosition(IntPoint(frame->view()->scrollX(), static_cast<int>(newTop * frame->pageZoomFactor() * frame->frameScaleFactor()))); 1328 if (auto* frame = documentFrameWithNonNullView()) { 1329 // FIXME: Should we use document()->scrollingElement()? 1330 // See https://bugs.webkit.org/show_bug.cgi?id=205059 1331 bool animated = useSmoothScrolling(ScrollBehavior::Auto, document().documentElement()); 1332 IntPoint position(frame->view()->scrollX(), static_cast<int>(newTop * frame->pageZoomFactor() * frame->frameScaleFactor())); 1333 frame->view()->setScrollPosition(position, ScrollClamping::Clamped, animated); 1334 } 1319 1335 return; 1320 1336 } 1321 1337 1322 1338 if (auto* renderer = renderBox()) { 1323 renderer->setScrollTop(static_cast<int>(newTop * renderer->style().effectiveZoom()), ScrollType::Programmatic); 1339 int clampedTop = clampToInteger(newTop * renderer->style().effectiveZoom()); 1340 bool animated = useSmoothScrolling(ScrollBehavior::Auto, this); 1341 renderer->setScrollTop(clampedTop, ScrollType::Programmatic, ScrollClamping::Clamped, animated); 1324 1342 if (auto* scrollableArea = renderer->layer()) 1325 1343 scrollableArea->setScrollShouldClearLatchedState(true); -
trunk/Source/WebCore/page/DOMWindow.cpp
r255668 r255957 1674 1674 void DOMWindow::scrollBy(double x, double y) const 1675 1675 { 1676 scrollBy( { x, y });1676 scrollBy(ScrollToOptions(x, y)); 1677 1677 } 1678 1678 … … 1700 1700 void DOMWindow::scrollTo(double x, double y, ScrollClamping clamping) const 1701 1701 { 1702 scrollTo( { x, y }, clamping);1702 scrollTo(ScrollToOptions(x, y), clamping); 1703 1703 } 1704 1704 … … 1716 1716 ); 1717 1717 1718 if (!scrollToOptions.left.value() && !scrollToOptions.top.value() && view->contentsScrollPosition() == IntPoint(0, 0)) 1718 // This is an optimization for the common case of scrolling to (0, 0) when the scroller is already at the origin. 1719 // If an animated scroll is in progress, this optimization is skipped to ensure that the animated scroll is really stopped. 1720 if (view->currentScrollBehaviorStatus() == ScrollBehaviorStatus::NotInAnimation && !scrollToOptions.left.value() && !scrollToOptions.top.value() && view->contentsScrollPosition() == IntPoint(0, 0)) 1719 1721 return; 1720 1722 … … 1722 1724 1723 1725 IntPoint layoutPos(view->mapFromCSSToLayoutUnits(scrollToOptions.left.value()), view->mapFromCSSToLayoutUnits(scrollToOptions.top.value())); 1726 1727 // FIXME: Should we use document()->scrollingElement()? 1728 // See https://bugs.webkit.org/show_bug.cgi?id=205059 1729 if (useSmoothScrolling(scrollToOptions.behavior.valueOr(ScrollBehavior::Auto), document()->documentElement())) { 1730 view->scrollToOffsetWithAnimation(layoutPos, ScrollType::Programmatic, clamping); 1731 return; 1732 } 1733 1724 1734 view->setContentsScrollPosition(layoutPos, clamping); 1725 1735 } -
trunk/Source/WebCore/page/FrameView.cpp
r255342 r255957 2280 2280 } 2281 2281 2282 void FrameView::setScrollPosition(const ScrollPosition& scrollPosition, ScrollClamping clamping )2282 void FrameView::setScrollPosition(const ScrollPosition& scrollPosition, ScrollClamping clamping, bool animated) 2283 2283 { 2284 2284 LOG_WITH_STREAM(Scrolling, stream << "FrameView::setScrollPosition " << scrollPosition << " , clearing anchor"); … … 2293 2293 if (page && page->isMonitoringWheelEvents()) 2294 2294 scrollAnimator().setWheelEventTestMonitor(page->wheelEventTestMonitor()); 2295 ScrollView::setScrollPosition(scrollPosition, clamping); 2295 if (animated) 2296 scrollToOffsetWithAnimation(scrollOffsetFromPosition(scrollPosition), currentScrollType(), clamping); 2297 else 2298 ScrollView::setScrollPosition(scrollPosition, clamping); 2296 2299 2297 2300 setCurrentScrollType(oldScrollType); … … 3652 3655 3653 3656 didChangeScrollOffset(); 3657 } 3658 3659 void FrameView::scrollToOffsetWithAnimation(const ScrollOffset& offset, ScrollType scrollType, ScrollClamping) 3660 { 3661 auto previousScrollType = currentScrollType(); 3662 setCurrentScrollType(scrollType); 3663 3664 if (currentScrollBehaviorStatus() == ScrollBehaviorStatus::InNonNativeAnimation) 3665 scrollAnimator().cancelAnimations(); 3666 if (offset != this->scrollOffset()) 3667 ScrollableArea::scrollToOffsetWithAnimation(offset); 3668 3669 setCurrentScrollType(previousScrollType); 3654 3670 } 3655 3671 -
trunk/Source/WebCore/page/FrameView.h
r255037 r255957 224 224 WEBCORE_EXPORT void setFixedVisibleContentRect(const IntRect&) final; 225 225 #endif 226 WEBCORE_EXPORT void setScrollPosition(const ScrollPosition&, ScrollClamping = ScrollClamping::Clamped ) final;226 WEBCORE_EXPORT void setScrollPosition(const ScrollPosition&, ScrollClamping = ScrollClamping::Clamped, bool animated = false) final; 227 227 void restoreScrollbar(); 228 228 void scheduleScrollToFocusedElement(SelectionRevealMode); … … 660 660 void renderLayerDidScroll(const RenderLayer&); 661 661 662 WEBCORE_EXPORT void scrollToOffsetWithAnimation(const ScrollOffset&, ScrollType = ScrollType::Programmatic, ScrollClamping = ScrollClamping::Clamped); 663 662 664 protected: 663 665 bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) final; -
trunk/Source/WebCore/page/ScrollBehavior.cpp
r254790 r255957 34 34 namespace WebCore { 35 35 36 bool useSmoothScrolling(ScrollBehavior behavior, Element &associatedElement)36 bool useSmoothScrolling(ScrollBehavior behavior, Element* associatedElement) 37 37 { 38 if (!associatedElement.document().settings().CSSOMViewSmoothScrollingEnabled() || !associatedElement.renderer()) 38 if (!associatedElement 39 || !associatedElement->renderer() 40 || !associatedElement->document().settings().CSSOMViewSmoothScrollingEnabled()) 39 41 return false; 40 42 … … 42 44 switch (behavior) { 43 45 case ScrollBehavior::Auto: 44 return associatedElement .renderer()->style().useSmoothScrolling();46 return associatedElement->renderer()->style().useSmoothScrolling(); 45 47 case ScrollBehavior::Instant: 46 48 return false; -
trunk/Source/WebCore/page/ScrollBehavior.h
r254790 r255957 36 36 }; 37 37 38 bool useSmoothScrolling(ScrollBehavior, Element &associatedElement);38 bool useSmoothScrolling(ScrollBehavior, Element* associatedElement); 39 39 40 40 } // namespace WebCore -
trunk/Source/WebCore/platform/ScrollAnimation.h
r254890 r255957 33 33 class FloatPoint; 34 34 class ScrollableArea; 35 enum class ScrollClamping : uint8_t; 35 36 36 37 class ScrollAnimation { … … 39 40 virtual ~ScrollAnimation() { }; 40 41 virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float /* step */, float /* multiplier */) { return true; }; 42 virtual void scroll(const FloatPoint&) { }; 41 43 virtual void stop() = 0; 42 44 virtual void updateVisibleLengths() { }; -
trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp
r254890 r255957 29 29 #include "ScrollAnimationSmooth.h" 30 30 31 #if ENABLE(SMOOTH_SCROLLING)32 33 31 #include "FloatPoint.h" 34 32 #include "ScrollableArea.h" … … 39 37 static const Seconds tickTime = 1_s / frameRate; 40 38 static const Seconds minimumTimerInterval { 1_ms }; 39 static const double smoothFactorForProgrammaticScroll = 5; 41 40 42 41 ScrollAnimationSmooth::ScrollAnimationSmooth(ScrollableArea& scrollableArea, const FloatPoint& position, WTF::Function<void (FloatPoint&&)>&& notifyPositionChangedFunction) … … 68 67 } 69 68 69 void ScrollAnimationSmooth::scroll(const FloatPoint& position) 70 { 71 ScrollGranularity granularity = ScrollByPage; 72 bool needToScroll = updatePerAxisData(m_horizontalData, granularity, position.x() - m_horizontalData.currentPosition, m_scrollableArea.minimumScrollPosition().x(), m_scrollableArea.maximumScrollPosition().x(), smoothFactorForProgrammaticScroll); 73 needToScroll |= 74 updatePerAxisData(m_verticalData, granularity, position.y() - m_verticalData.currentPosition, m_scrollableArea.minimumScrollPosition().y(), m_scrollableArea.maximumScrollPosition().y(), smoothFactorForProgrammaticScroll); 75 if (needToScroll && !animationTimerActive()) { 76 m_startTime = m_horizontalData.startTime; 77 animationTimerFired(); 78 } 79 }; 80 70 81 void ScrollAnimationSmooth::stop() 71 82 { 72 83 m_animationTimer.stop(); 84 m_scrollableArea.setScrollBehaviorStatus(ScrollBehaviorStatus::NotInAnimation); 73 85 } 74 86 … … 248 260 } 249 261 250 bool ScrollAnimationSmooth::updatePerAxisData(PerAxisData& data, ScrollGranularity granularity, float delta, float minScrollPosition, float maxScrollPosition )262 bool ScrollAnimationSmooth::updatePerAxisData(PerAxisData& data, ScrollGranularity granularity, float delta, float minScrollPosition, float maxScrollPosition, double smoothFactor) 251 263 { 252 264 if (!data.startTime || !delta || (delta < 0) != (data.desiredPosition - data.currentPosition < 0)) { … … 264 276 Curve coastTimeCurve; 265 277 getAnimationParametersForGranularity(granularity, animationTime, repeatMinimumSustainTime, attackTime, releaseTime, coastTimeCurve, maximumCoastTime); 278 279 animationTime *= smoothFactor; 280 repeatMinimumSustainTime *= smoothFactor; 281 attackTime *= smoothFactor; 282 releaseTime *= smoothFactor; 283 maximumCoastTime *= smoothFactor; 266 284 267 285 data.desiredPosition = newPosition; … … 393 411 if (continueAnimation) 394 412 startNextTimer(std::max(minimumTimerInterval, deltaToNextFrame)); 413 else 414 m_scrollableArea.setScrollBehaviorStatus(ScrollBehaviorStatus::NotInAnimation); 395 415 396 416 m_notifyPositionChangedFunction(FloatPoint(m_horizontalData.currentPosition, m_verticalData.currentPosition)); … … 408 428 409 429 } // namespace WebCore 410 411 #endif // ENABLE(SMOOTH_SCROLLING) -
trunk/Source/WebCore/platform/ScrollAnimationSmooth.h
r254890 r255957 28 28 #include "ScrollAnimation.h" 29 29 30 #if ENABLE(SMOOTH_SCROLLING)31 32 30 #include "Timer.h" 33 31 … … 36 34 class FloatPoint; 37 35 class ScrollableArea; 36 enum class ScrollClamping : uint8_t; 38 37 39 38 class ScrollAnimationSmooth final: public ScrollAnimation { … … 52 51 private: 53 52 bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier) override; 53 void scroll(const FloatPoint&) override; 54 54 void stop() override; 55 55 void updateVisibleLengths() override; … … 90 90 }; 91 91 92 bool updatePerAxisData(PerAxisData&, ScrollGranularity, float delta, float minScrollPosition, float maxScrollPosition );92 bool updatePerAxisData(PerAxisData&, ScrollGranularity, float delta, float minScrollPosition, float maxScrollPosition, double smoothFactor = 1); 93 93 bool animateScroll(PerAxisData&, MonotonicTime currentTime); 94 94 … … 109 109 } // namespace WebCore 110 110 111 #endif // ENABLE(SMOOTH_SCROLLING) -
trunk/Source/WebCore/platform/ScrollAnimator.cpp
r254890 r255957 36 36 #include "LayoutSize.h" 37 37 #include "PlatformWheelEvent.h" 38 #include "ScrollAnimationSmooth.h" 38 39 #include "ScrollableArea.h" 39 40 #include <algorithm> … … 53 54 , m_scrollController(*this) 54 55 #endif 56 , m_animationProgrammaticScroll(makeUnique<ScrollAnimationSmooth>(scrollableArea, m_currentPosition, [this](FloatPoint&& position) { 57 FloatSize delta = position - m_currentPosition; 58 m_currentPosition = WTFMove(position); 59 notifyPositionChanged(delta); 60 })) 55 61 { 56 62 } … … 74 80 notifyPositionChanged(newPosition - currentPosition); 75 81 return true; 82 } 83 84 void ScrollAnimator::scrollToOffset(const FloatPoint& offset) 85 { 86 m_animationProgrammaticScroll->setCurrentPosition(m_currentPosition); 87 auto newPosition = ScrollableArea::scrollPositionFromOffset(offset, toFloatSize(m_scrollableArea.scrollOrigin())); 88 m_animationProgrammaticScroll->scroll(newPosition); 89 m_scrollableArea.setScrollBehaviorStatus(ScrollBehaviorStatus::InNonNativeAnimation); 76 90 } 77 91 … … 246 260 #endif 247 261 262 void ScrollAnimator::cancelAnimations() 263 { 264 #if !USE(REQUEST_ANIMATION_FRAME_TIMER) 265 m_animationProgrammaticScroll->stop(); 266 #endif 267 } 268 269 void ScrollAnimator::serviceScrollAnimations() 270 { 271 #if !USE(REQUEST_ANIMATION_FRAME_TIMER) 272 m_animationProgrammaticScroll->serviceAnimation(); 273 #endif 274 } 275 276 void ScrollAnimator::willEndLiveResize() 277 { 278 m_animationProgrammaticScroll->updateVisibleLengths(); 279 } 280 281 void ScrollAnimator::didAddVerticalScrollbar(Scrollbar*) 282 { 283 m_animationProgrammaticScroll->updateVisibleLengths(); 284 } 285 286 void ScrollAnimator::didAddHorizontalScrollbar(Scrollbar*) 287 { 288 m_animationProgrammaticScroll->updateVisibleLengths(); 289 } 290 248 291 } // namespace WebCore -
trunk/Source/WebCore/platform/ScrollAnimator.h
r254890 r255957 47 47 class FloatPoint; 48 48 class PlatformTouchEvent; 49 class ScrollAnimation; 49 50 class ScrollableArea; 50 51 class Scrollbar; … … 69 70 virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier); 70 71 72 void scrollToOffset(const FloatPoint&); 71 73 virtual void scrollToOffsetWithoutAnimation(const FloatPoint&, ScrollClamping = ScrollClamping::Clamped); 72 74 … … 86 88 const FloatPoint& currentPosition() const { return m_currentPosition; } 87 89 88 virtual void cancelAnimations() { }89 virtual void serviceScrollAnimations() { }90 virtual void cancelAnimations(); 91 virtual void serviceScrollAnimations(); 90 92 91 93 virtual void contentAreaWillPaint() const { } … … 98 100 virtual void willStartLiveResize() { } 99 101 virtual void contentsResized() const { } 100 virtual void willEndLiveResize() { }102 virtual void willEndLiveResize(); 101 103 virtual void contentAreaDidShow() { } 102 104 virtual void contentAreaDidHide() { } … … 105 107 virtual bool scrollbarsCanBeActive() const { return true; } 106 108 107 virtual void didAddVerticalScrollbar(Scrollbar*) { }109 virtual void didAddVerticalScrollbar(Scrollbar*); 108 110 virtual void willRemoveVerticalScrollbar(Scrollbar*) { } 109 virtual void didAddHorizontalScrollbar(Scrollbar*) { }111 virtual void didAddHorizontalScrollbar(Scrollbar*); 110 112 virtual void willRemoveHorizontalScrollbar(Scrollbar*) { } 111 113 … … 152 154 #endif 153 155 FloatPoint m_currentPosition; 156 157 std::unique_ptr<ScrollAnimation> m_animationProgrammaticScroll; 154 158 }; 155 159 -
trunk/Source/WebCore/platform/ScrollTypes.h
r255037 r255957 54 54 }; 55 55 56 // FIXME: Add another status InNativeAnimation to indicate native scrolling is in progress. 57 // See: https://bugs.webkit.org/show_bug.cgi?id=204936 58 enum class ScrollBehaviorStatus : uint8_t { 59 NotInAnimation, 60 InNonNativeAnimation, 61 }; 62 56 63 inline ScrollDirection logicalToPhysical(ScrollLogicalDirection direction, bool isVertical, bool isFlipped) 57 64 { -
trunk/Source/WebCore/platform/ScrollView.cpp
r255226 r255957 514 514 } 515 515 516 void ScrollView::setScrollPosition(const ScrollPosition& scrollPosition, ScrollClamping clamping )516 void ScrollView::setScrollPosition(const ScrollPosition& scrollPosition, ScrollClamping clamping, bool/* animated*/) 517 517 { 518 518 LOG_WITH_STREAM(Scrolling, stream << "ScrollView::setScrollPosition " << scrollPosition); … … 528 528 ScrollPosition newScrollPosition = (!delegatesScrolling() && clamping == ScrollClamping::Clamped) ? adjustScrollPositionWithinRange(scrollPosition) : scrollPosition; 529 529 530 if ((!delegatesScrolling() || currentScrollType() == ScrollType::User) && newScrollPosition == this->scrollPosition()) 531 return; 532 533 if (requestScrollPositionUpdate(newScrollPosition, currentScrollType(), clamping)) 534 return; 535 536 updateScrollbars(newScrollPosition); 530 if ((!delegatesScrolling() || currentScrollType() == ScrollType::User) && currentScrollBehaviorStatus() == ScrollBehaviorStatus::NotInAnimation && newScrollPosition == this->scrollPosition()) 531 return; 532 533 if (currentScrollBehaviorStatus() == ScrollBehaviorStatus::InNonNativeAnimation) 534 scrollAnimator().cancelAnimations(); 535 536 if (!requestScrollPositionUpdate(newScrollPosition, currentScrollType(), clamping)) 537 updateScrollbars(newScrollPosition); 538 539 setScrollBehaviorStatus(ScrollBehaviorStatus::NotInAnimation); 537 540 } 538 541 -
trunk/Source/WebCore/platform/ScrollView.h
r255226 r255957 262 262 263 263 // Functions for scrolling the view. 264 virtual void setScrollPosition(const ScrollPosition&, ScrollClamping = ScrollClamping::Clamped); 264 virtual void setScrollPosition(const ScrollPosition&, ScrollClamping = ScrollClamping::Clamped, bool animated = false); 265 265 266 void scrollBy(const IntSize& s) { return setScrollPosition(scrollPosition() + s); } 266 267 -
trunk/Source/WebCore/platform/ScrollableArea.cpp
r255037 r255957 72 72 , m_currentScrollType(static_cast<unsigned>(ScrollType::User)) 73 73 , m_scrollShouldClearLatchedState(false) 74 , m_currentScrollBehaviorStatus(static_cast<unsigned>(ScrollBehaviorStatus::NotInAnimation)) 74 75 { 75 76 } … … 143 144 } 144 145 146 void ScrollableArea::scrollToOffsetWithAnimation(const FloatPoint& offset, ScrollClamping) 147 { 148 LOG_WITH_STREAM(Scrolling, stream << "ScrollableArea " << this << " scrollToOffsetWithAnimation " << offset); 149 scrollAnimator().scrollToOffset(offset); 150 } 151 145 152 void ScrollableArea::scrollToOffsetWithoutAnimation(const FloatPoint& offset, ScrollClamping clamping) 146 153 { -
trunk/Source/WebCore/platform/ScrollableArea.h
r255037 r255957 63 63 class ScrollableArea : public CanMakeWeakPtr<ScrollableArea> { 64 64 public: 65 ScrollBehaviorStatus currentScrollBehaviorStatus() { return static_cast<ScrollBehaviorStatus>(m_currentScrollBehaviorStatus); } 66 void setScrollBehaviorStatus(ScrollBehaviorStatus status) { m_currentScrollBehaviorStatus = static_cast<unsigned>(status); } 67 65 68 WEBCORE_EXPORT bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1); 69 WEBCORE_EXPORT void scrollToOffsetWithAnimation(const FloatPoint&, ScrollClamping = ScrollClamping::Clamped); 66 70 WEBCORE_EXPORT void scrollToOffsetWithoutAnimation(const FloatPoint&, ScrollClamping = ScrollClamping::Clamped); 67 71 void scrollToOffsetWithoutAnimation(ScrollbarOrientation, float offset); … … 405 409 unsigned m_currentScrollType : 1; // ScrollType 406 410 unsigned m_scrollShouldClearLatchedState : 1; 411 unsigned m_currentScrollBehaviorStatus : 1; 407 412 }; 408 413 -
trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
r254890 r255957 1157 1157 void ScrollAnimatorMac::cancelAnimations() 1158 1158 { 1159 ScrollAnimator::cancelAnimations(); 1159 1160 m_haveScrolledSincePageLoad = false; 1160 1161 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r254890 r255957 582 582 } 583 583 584 void RenderBox::setScrollLeft(int newLeft, ScrollType scrollType, ScrollClamping clamping )584 void RenderBox::setScrollLeft(int newLeft, ScrollType scrollType, ScrollClamping clamping, bool animated) 585 585 { 586 586 if (!hasOverflowClip() || !layer()) 587 587 return; 588 588 setupWheelEventMonitor(*layer()); 589 layer()->scrollToXPosition(newLeft, scrollType, clamping );590 } 591 592 void RenderBox::setScrollTop(int newTop, ScrollType scrollType, ScrollClamping clamping )589 layer()->scrollToXPosition(newLeft, scrollType, clamping, animated); 590 } 591 592 void RenderBox::setScrollTop(int newTop, ScrollType scrollType, ScrollClamping clamping, bool animated) 593 593 { 594 594 if (!hasOverflowClip() || !layer()) 595 595 return; 596 596 setupWheelEventMonitor(*layer()); 597 layer()->scrollToYPosition(newTop, scrollType, clamping); 597 layer()->scrollToYPosition(newTop, scrollType, clamping, animated); 598 } 599 600 void RenderBox::setScrollPosition(const ScrollPosition& position, ScrollType scrollType, ScrollClamping clamping, bool animated) 601 { 602 if (!hasOverflowClip() || !layer()) 603 return; 604 setupWheelEventMonitor(*layer()); 605 layer()->scrollToPosition(position, scrollType, clamping, animated); 598 606 } 599 607 -
trunk/Source/WebCore/rendering/RenderBox.h
r255413 r255957 248 248 virtual int scrollWidth() const; 249 249 virtual int scrollHeight() const; 250 virtual void setScrollLeft(int, ScrollType, ScrollClamping = ScrollClamping::Clamped); 251 virtual void setScrollTop(int, ScrollType, ScrollClamping = ScrollClamping::Clamped); 250 virtual void setScrollLeft(int, ScrollType, ScrollClamping = ScrollClamping::Clamped, bool animated = false); 251 virtual void setScrollTop(int, ScrollType, ScrollClamping = ScrollClamping::Clamped, bool animated = false); 252 void setScrollPosition(const ScrollPosition&, ScrollType, ScrollClamping = ScrollClamping::Clamped, bool animated = false); 252 253 253 254 LayoutUnit marginTop() const override { return m_marginBox.top(); } -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r255501 r255957 2580 2580 } 2581 2581 2582 void RenderLayer::scrollToXPosition(int x, ScrollType scrollType, ScrollClamping clamping )2582 void RenderLayer::scrollToXPosition(int x, ScrollType scrollType, ScrollClamping clamping, bool animated) 2583 2583 { 2584 2584 ScrollPosition position(x, m_scrollPosition.y()); 2585 scrollTo Offset(scrollOffsetFromPosition(position), scrollType, clamping);2586 } 2587 2588 void RenderLayer::scrollToYPosition(int y, ScrollType scrollType, ScrollClamping clamping )2585 scrollToPosition(position, scrollType, clamping, animated); 2586 } 2587 2588 void RenderLayer::scrollToYPosition(int y, ScrollType scrollType, ScrollClamping clamping, bool animated) 2589 2589 { 2590 2590 ScrollPosition position(m_scrollPosition.x(), y); 2591 scrollToOffset(scrollOffsetFromPosition(position), scrollType, clamping); 2591 scrollToPosition(position, scrollType, clamping, animated); 2592 } 2593 2594 void RenderLayer::scrollToPosition(const ScrollPosition& position, ScrollType scrollType, ScrollClamping clamping, bool animated) 2595 { 2596 if (animated) 2597 scrollToOffsetWithAnimation(scrollOffsetFromPosition(position), scrollType, clamping); 2598 else 2599 scrollToOffset(scrollOffsetFromPosition(position), scrollType, clamping); 2592 2600 } 2593 2601 … … 2608 2616 void RenderLayer::scrollToOffset(const ScrollOffset& scrollOffset, ScrollType scrollType, ScrollClamping clamping) 2609 2617 { 2618 if (currentScrollBehaviorStatus() == ScrollBehaviorStatus::InNonNativeAnimation) 2619 scrollAnimator().cancelAnimations(); 2620 2610 2621 ScrollOffset clampedScrollOffset = clamping == ScrollClamping::Clamped ? clampScrollOffset(scrollOffset) : scrollOffset; 2611 2622 if (clampedScrollOffset == this->scrollOffset()) … … 2617 2628 if (!requestScrollPositionUpdate(scrollPositionFromOffset(clampedScrollOffset), scrollType, clamping)) 2618 2629 scrollToOffsetWithoutAnimation(clampedScrollOffset, clamping); 2630 setScrollBehaviorStatus(ScrollBehaviorStatus::NotInAnimation); 2631 2632 setCurrentScrollType(previousScrollType); 2633 } 2634 2635 void RenderLayer::scrollToOffsetWithAnimation(const ScrollOffset& offset, ScrollType scrollType, ScrollClamping clamping) 2636 { 2637 auto previousScrollType = currentScrollType(); 2638 setCurrentScrollType(scrollType); 2639 2640 ScrollOffset newScrollOffset = clamping == ScrollClamping::Clamped ? clampScrollOffset(offset) : offset; 2641 if (currentScrollBehaviorStatus() == ScrollBehaviorStatus::InNonNativeAnimation) 2642 scrollAnimator().cancelAnimations(); 2643 if (newScrollOffset != this->scrollOffset()) 2644 ScrollableArea::scrollToOffsetWithAnimation(newScrollOffset); 2619 2645 2620 2646 setCurrentScrollType(previousScrollType); … … 2653 2679 } 2654 2680 2655 if (m_scrollPosition == newPosition ) {2681 if (m_scrollPosition == newPosition && currentScrollBehaviorStatus() == ScrollBehaviorStatus::NotInAnimation) { 2656 2682 // FIXME: Nothing guarantees we get a scrollTo() with an unchanged position at the end of a user gesture. 2657 2683 // The ScrollingCoordinator probably needs to message the main thread when a gesture ends. … … 2798 2824 2799 2825 ScrollOffset clampedScrollOffset = clampScrollOffset(scrollOffset() + toIntSize(roundedIntRect(revealRect).location())); 2800 if (clampedScrollOffset != scrollOffset() ) {2826 if (clampedScrollOffset != scrollOffset() || currentScrollBehaviorStatus() != ScrollBehaviorStatus::NotInAnimation) { 2801 2827 ScrollOffset oldScrollOffset = scrollOffset(); 2802 scrollToOffset(clampedScrollOffset); 2803 IntSize scrollOffsetDifference = scrollOffset() - oldScrollOffset; 2828 bool animated = useSmoothScrolling(options.behavior, box->element()); 2829 scrollToPosition(scrollPositionFromOffset(clampedScrollOffset), ScrollType::Programmatic, ScrollClamping::Clamped, animated); 2830 IntSize scrollOffsetDifference = clampedScrollOffset - oldScrollOffset; 2804 2831 localExposeRect.move(-scrollOffsetDifference); 2805 2832 newRect = LayoutRect(box->localToAbsoluteQuad(FloatQuad(FloatRect(localExposeRect)), UseTransforms).boundingBox()); … … 2821 2848 LayoutRect exposeRect = getRectToExpose(viewRect, absoluteRect, insideFixed, options.alignX, options.alignY); 2822 2849 2823 IntPoint scroll Offset(roundedIntPoint(exposeRect.location()));2850 IntPoint scrollPosition(roundedIntPoint(exposeRect.location())); 2824 2851 // Adjust offsets if they're outside of the allowable range. 2825 scrollOffset = scrollOffset.constrainedBetween(IntPoint(), IntPoint(frameView.contentsSize())); 2826 frameView.setScrollPosition(scrollOffset); 2852 scrollPosition = scrollPosition.constrainedBetween(IntPoint(), IntPoint(frameView.contentsSize())); 2853 // FIXME: Should we use contentDocument()->scrollingElement()? 2854 // See https://bugs.webkit.org/show_bug.cgi?id=205059 2855 bool animated = ownerElement->contentDocument() && useSmoothScrolling(options.behavior, ownerElement->contentDocument()->documentElement()); 2856 frameView.setScrollPosition(scrollPosition, ScrollClamping::Clamped, animated); 2827 2857 2828 2858 if (options.shouldAllowCrossOriginScrolling == ShouldAllowCrossOriginScrolling::Yes || frameView.safeToPropagateScrollToParent()) { … … 2863 2893 if (revealRect != viewRect) { 2864 2894 ScrollOffset clampedScrollPosition = roundedIntPoint(revealRect.location()).constrainedBetween(minScrollPosition, maxScrollPosition); 2865 frameView.setScrollPosition(clampedScrollPosition); 2895 // FIXME: Should we use document()->scrollingElement()? 2896 // See https://bugs.webkit.org/show_bug.cgi?id=205059 2897 bool animated = useSmoothScrolling(options.behavior, renderer().document().documentElement()); 2898 frameView.setScrollPosition(clampedScrollPosition, ScrollClamping::Clamped, animated); 2866 2899 } 2867 2900 -
trunk/Source/WebCore/rendering/RenderLayer.h
r255501 r255957 51 51 #include "RenderBox.h" 52 52 #include "RenderPtr.h" 53 #include "ScrollBehavior.h" 53 54 #include "ScrollableArea.h" 54 55 #include <memory> … … 135 136 const ScrollAlignment& alignY { ScrollAlignment::alignCenterIfNeeded }; 136 137 ShouldAllowCrossOriginScrolling shouldAllowCrossOriginScrolling { ShouldAllowCrossOriginScrolling::No }; 138 ScrollBehavior behavior { ScrollBehavior::Auto }; 137 139 }; 138 140 … … 443 445 444 446 WEBCORE_EXPORT void scrollToOffset(const ScrollOffset&, ScrollType = ScrollType::Programmatic, ScrollClamping = ScrollClamping::Clamped); 445 446 void scrollToXPosition(int x, ScrollType, ScrollClamping = ScrollClamping::Clamped); 447 void scrollToYPosition(int y, ScrollType, ScrollClamping = ScrollClamping::Clamped); 447 WEBCORE_EXPORT void scrollToOffsetWithAnimation(const ScrollOffset&, ScrollType = ScrollType::Programmatic, ScrollClamping = ScrollClamping::Clamped); 448 449 void scrollToXPosition(int x, ScrollType, ScrollClamping = ScrollClamping::Clamped, bool animated = false); 450 void scrollToYPosition(int y, ScrollType, ScrollClamping = ScrollClamping::Clamped, bool animated = false); 451 void scrollToPosition(const ScrollPosition&, ScrollType, ScrollClamping = ScrollClamping::Clamped, bool animated = false); 448 452 449 453 // These are only used by marquee. -
trunk/Source/WebCore/rendering/RenderListBox.cpp
r254890 r255957 744 744 } 745 745 746 void RenderListBox::setScrollLeft(int, ScrollType, ScrollClamping )746 void RenderListBox::setScrollLeft(int, ScrollType, ScrollClamping, bool) 747 747 { 748 748 } … … 761 761 } 762 762 763 void RenderListBox::setScrollTop(int newTop, ScrollType, ScrollClamping )763 void RenderListBox::setScrollTop(int newTop, ScrollType, ScrollClamping, bool) 764 764 { 765 765 // Determine an index and scroll to it. -
trunk/Source/WebCore/rendering/RenderListBox.h
r254890 r255957 107 107 int scrollWidth() const override; 108 108 int scrollHeight() const override; 109 void setScrollLeft(int, ScrollType, ScrollClamping ) override;110 void setScrollTop(int, ScrollType, ScrollClamping ) override;109 void setScrollLeft(int, ScrollType, ScrollClamping, bool) override; 110 void setScrollTop(int, ScrollType, ScrollClamping, bool) override; 111 111 112 112 bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override; -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
r254890 r255957 377 377 } 378 378 379 void RenderTextControlSingleLine::setScrollLeft(int newLeft, ScrollType, ScrollClamping )379 void RenderTextControlSingleLine::setScrollLeft(int newLeft, ScrollType, ScrollClamping, bool) 380 380 { 381 381 if (innerTextElement()) … … 383 383 } 384 384 385 void RenderTextControlSingleLine::setScrollTop(int newTop, ScrollType, ScrollClamping )385 void RenderTextControlSingleLine::setScrollTop(int newTop, ScrollType, ScrollClamping, bool) 386 386 { 387 387 if (innerTextElement()) -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h
r254890 r255957 58 58 int scrollWidth() const override; 59 59 int scrollHeight() const override; 60 void setScrollLeft(int, ScrollType, ScrollClamping ) override;61 void setScrollTop(int, ScrollType, ScrollClamping ) override;60 void setScrollLeft(int, ScrollType, ScrollClamping, bool) override; 61 void setScrollTop(int, ScrollType, ScrollClamping, bool) override; 62 62 bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint()) final; 63 63 bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = 0) final; -
trunk/Source/WebCore/testing/Internals.cpp
r255875 r255957 1776 1776 return Exception { InvalidAccessError }; 1777 1777 1778 element.scrollTo( { x, y }, ScrollClamping::Unclamped);1778 element.scrollTo(ScrollToOptions(x, y), ScrollClamping::Unclamped); 1779 1779 1780 1780 auto& frameView = *document->view();
Note: See TracChangeset
for help on using the changeset viewer.