Changeset 254807 in webkit
- Timestamp:
- Jan 19, 2020 8:43:43 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 47 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r254803 r254807 1 2020-01-19 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-01-19 Diego Pino Garcia <dpino@igalia.com> 2 13 -
trunk/LayoutTests/imported/w3c/ChangeLog
r254790 r254807 1 2020-01-19 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-01-17 Cathie Chen <cathiechen@igalia.com> 2 29 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-default-css-expected.txt
r236274 r254807 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
r254129 r254807 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
r254129 r254807 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
r254129 r254807 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
r254129 r254807 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
r254129 r254807 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
r236274 r254807 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
r254129 r254807 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
r236274 r254807 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
r254129 r254807 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
r254129 r254807 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
r254129 r254807 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
r254129 r254807 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
r236274 r254807 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
r254129 r254807 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
r254697 r254807 750 750 webkit.org/b/188070 imported/w3c/web-platform-tests/streams/piping/error-propagation-backward.html [ Pass Failure ] 751 751 752 # Tests for smooth scroll behavior do not all work and they are slow, so let's just skip them. 753 webkit.org/b/191357 imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-root.html [ Skip ] 754 webkit.org/b/191357 imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-main-frame-window.html [ Skip ] 755 webkit.org/b/191357 imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-root.html [ Skip ] 756 webkit.org/b/191357 imported/w3c/web-platform-tests/css/cssom-view/scroll-behavior-subframe-window.html [ Skip ] 757 752 758 webkit.org/b/189908 imported/w3c/web-platform-tests/resource-timing/resource_timing.worker.html [ Failure ] 753 759 -
trunk/Source/WebCore/ChangeLog
r254806 r254807 1 2020-01-19 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 * page/scrolling/AsyncScrollingCoordinator.cpp: 48 (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate): 49 * platform/ScrollAnimation.h: 50 (WebCore::ScrollAnimation::scroll): Function to animate scrolling to a specified position. 51 * platform/ScrollAnimationSmooth.cpp: Build this file on all platforms. Add a 52 smoothFactorForProgrammaticScroll parameter to slow down the smooth scrolling. 53 (WebCore::ScrollAnimationSmooth::scroll): 54 (WebCore::ScrollAnimationSmooth::updatePerAxisData): Scale the time parameters of the 55 animation so that it looks smoother. 56 * platform/ScrollAnimationSmooth.h: Declare the class on all platforms. 57 * platform/ScrollAnimator.cpp: 58 (WebCore::ScrollAnimator::ScrollAnimator): Initialize animation member for programmatic scrolling. 59 (WebCore::ScrollAnimator::scrollToOffset): Animate scrolling to the specified position. 60 (WebCore::ScrollAnimator::cancelAnimations): Copy logic from ScrollAnimationSmooth.cpp. 61 (WebCore::ScrollAnimator::serviceScrollAnimations): Ditto. 62 (WebCore::ScrollAnimator::willEndLiveResize): Ditto. 63 (WebCore::ScrollAnimator::didAddVerticalScrollbar): Ditto. 64 (WebCore::ScrollAnimator::didAddHorizontalScrollbar): Ditto. 65 * platform/ScrollAnimator.h: New animation member for smooth programmatic scrolling. 66 (WebCore::ScrollAnimator::ScrollAnimator::cancelAnimations): Deleted. 67 (WebCore::ScrollAnimator::ScrollAnimator::serviceScrollAnimations): Deleted. 68 (WebCore::ScrollAnimator::ScrollAnimator::willEndLiveResize): Deleted. 69 (WebCore::ScrollAnimator::ScrollAnimator::didAddVerticalScrollbar): Deleted. 70 (WebCore::ScrollAnimator::ScrollAnimator::didAddHorizontalScrollbar): Deleted. 71 * platform/ScrollTypes.h: Add ScrollBehaviorStatus to indicate the status of scrolling. 72 * platform/ScrollView.cpp: 73 (WebCore::ScrollView::setScrollPosition): Follow the CSSOM View spec: If a scroll is in 74 progress, we interrupt it and continue the scroll call (even when we are at the final position). 75 * platform/ScrollView.h: 76 * platform/ScrollableArea.cpp: 77 (WebCore::ScrollableArea::scrollToOffsetWithAnimation): 78 (WebCore::ScrollableArea::setScrollOffsetFromInternals): 79 (WebCore::ScrollableArea::setScrollOffsetFromAnimation): To avoid iterate calling, 80 move the requestScrollPositionUpdate(position) checking out of setScrollOffsetFromAnimation(). 81 * platform/ScrollableArea.h: 82 (WebCore::ScrollableArea::currentScrollBehaviorStatus const): Maintain currentScrollBehaviorStatus. 83 (WebCore::ScrollableArea::setScrollBehaviorStatus): 84 * platform/generic/ScrollAnimatorGeneric.cpp: 85 (WebCore::ScrollAnimatorGeneric::updatePosition): 86 * platform/mac/ScrollAnimatorMac.mm: 87 (WebCore::ScrollAnimatorMac::cancelAnimations): Call parent member to handle programmatic scrolling. 88 * rendering/RenderBox.cpp: 89 (WebCore::RenderBox::setScrollLeft): Add flag to indicate animated or not. 90 (WebCore::RenderBox::setScrollTop): Ditto. 91 (WebCore::RenderBox::setScrollPosition): 92 * rendering/RenderBox.h: 93 * rendering/RenderLayer.cpp: 94 (WebCore::RenderLayer::scrollToXPosition): Ditto. 95 (WebCore::RenderLayer::scrollToYPosition): Ditto. 96 (WebCore::RenderLayer::scrollToPosition): 97 (WebCore::RenderLayer::scrollToOffset): Follow the CSSOM View spec: If a scroll is in 98 progress, we interrupt it and continue the scroll call (even when we are at the final 99 position). It's ScrollBehaviorType::Instant scroll. 100 (WebCore::RenderLayer::requestScrollPositionUpdate): 101 (WebCore::RenderLayer::scrollToOffsetWithAnimation): Ditto. This is similar to scrollToOffset 102 but animates the scroll. It's ScrollBehaviorType::Smooth scroll. 103 (WebCore::RenderLayer::scrollTo): 104 (WebCore::RenderLayer::scrollRectToVisible): Again don't do an early return if scroll is in 105 progress. We call scrollToOffsetWithAnimation instead of scrollToOffset when appropriate. 106 Note that this function may not work well for several nested scroll boxes with at least one 107 element with smooth behavior. It will handled in bug Follow. 108 * rendering/RenderLayer.h: Add scroll behavior to ScrollTectToVisibleOptions. 109 * rendering/RenderListBox.cpp: 110 (WebCore::RenderListBox::setScrollLeft): Add animated flag. 111 (WebCore::RenderListBox::setScrollTop): Ditto. 112 * rendering/RenderListBox.h: 113 * rendering/RenderTextControlSingleLine.cpp: 114 (WebCore::RenderTextControlSingleLine::setScrollLeft): 115 (WebCore::RenderTextControlSingleLine::setScrollTop): 116 * rendering/RenderTextControlSingleLine.h: 117 * testing/Internals.cpp: 118 (WebCore::Internals::unconstrainedScrollTo): 119 1 120 2020-01-19 Antti Koivisto <antti@apple.com> 2 121 -
trunk/Source/WebCore/Sources.txt
r254806 r254807 1764 1764 platform/SSLKeyGenerator.cpp 1765 1765 platform/ScrollAnimator.cpp 1766 platform/ScrollAnimationSmooth.cpp 1766 1767 platform/ScrollView.cpp 1767 1768 platform/ScrollableArea.cpp -
trunk/Source/WebCore/SourcesGTK.txt
r254064 r254807 64 64 65 65 platform/ScrollAnimationKinetic.cpp 66 platform/ScrollAnimationSmooth.cpp67 66 platform/UserAgentQuirks.cpp 68 67 -
trunk/Source/WebCore/dom/Element.cpp
r254700 r254807 841 841 LayoutRect absoluteBounds = renderer()->absoluteAnchorRect(&insideFixed); 842 842 843 // FIXME(webkit.org/b/188043): Support ScrollBehavior.844 843 ScrollIntoViewOptions options; 845 844 if (arg) { … … 860 859 isHorizontal ? alignX : alignY, 861 860 isHorizontal ? alignY : alignX, 862 ShouldAllowCrossOriginScrolling::No 861 ShouldAllowCrossOriginScrolling::No, 862 options.behavior.valueOr(ScrollBehavior::Auto) 863 863 }; 864 864 renderer()->scrollRectToVisible(absoluteBounds, insideFixed, visibleOptions); … … 921 921 void Element::scrollBy(double x, double y) 922 922 { 923 scrollBy( { x, y });923 scrollBy(ScrollToOptions(x, y)); 924 924 } 925 925 … … 957 957 adjustForAbsoluteZoom(renderer->scrollTop(), *renderer) 958 958 ); 959 renderer->setScrollLeft(clampToInteger(scrollToOptions.left.value() * renderer->style().effectiveZoom()), ScrollType::Programmatic, clamping); 960 renderer->setScrollTop(clampToInteger(scrollToOptions.top.value() * renderer->style().effectiveZoom()), ScrollType::Programmatic, clamping); 959 IntPoint scrollPosition( 960 clampToInteger(scrollToOptions.left.value() * renderer->style().effectiveZoom()), 961 clampToInteger(scrollToOptions.top.value() * renderer->style().effectiveZoom()) 962 ); 963 bool animated = useSmoothScrolling(scrollToOptions.behavior.valueOr(ScrollBehavior::Auto), *this); 964 renderer->setScrollPosition(scrollPosition, ScrollType::Programmatic, animated, clamping); 961 965 } 962 966 963 967 void Element::scrollTo(double x, double y) 964 968 { 965 scrollTo( { x, y });969 scrollTo(ScrollToOptions(x, y)); 966 970 } 967 971 … … 1297 1301 1298 1302 if (document().scrollingElement() == this) { 1299 if (auto* frame = documentFrameWithNonNullView()) 1300 frame->view()->setScrollPosition(IntPoint(static_cast<int>(newLeft * frame->pageZoomFactor() * frame->frameScaleFactor()), frame->view()->scrollY())); 1303 if (auto* frame = documentFrameWithNonNullView()) { 1304 // FIXME: Should we use document()->scrollingElement()? 1305 // See https://bugs.webkit.org/show_bug.cgi?id=205059 1306 bool animated = document().documentElement() && useSmoothScrolling(ScrollBehavior::Auto, *document().documentElement()); 1307 frame->view()->setScrollPosition(IntPoint(static_cast<int>(newLeft * frame->pageZoomFactor() * frame->frameScaleFactor()), frame->view()->scrollY()), animated); 1308 } 1301 1309 return; 1302 1310 } 1303 1311 1304 1312 if (auto* renderer = renderBox()) { 1305 renderer->setScrollLeft(static_cast<int>(newLeft * renderer->style().effectiveZoom()), ScrollType::Programmatic); 1313 int clampedLeft = clampToInteger(newLeft * renderer->style().effectiveZoom()); 1314 bool animated = useSmoothScrolling(ScrollBehavior::Auto, *this); 1315 renderer->setScrollLeft(clampedLeft, ScrollType::Programmatic, animated); 1306 1316 if (auto* scrollableArea = renderer->layer()) 1307 1317 scrollableArea->setScrollShouldClearLatchedState(true); … … 1314 1324 1315 1325 if (document().scrollingElement() == this) { 1316 if (auto* frame = documentFrameWithNonNullView()) 1317 frame->view()->setScrollPosition(IntPoint(frame->view()->scrollX(), static_cast<int>(newTop * frame->pageZoomFactor() * frame->frameScaleFactor()))); 1326 if (auto* frame = documentFrameWithNonNullView()) { 1327 // FIXME: Should we use document()->scrollingElement()? 1328 // See https://bugs.webkit.org/show_bug.cgi?id=205059 1329 bool animated = document().documentElement() && useSmoothScrolling(ScrollBehavior::Auto, *document().documentElement()); 1330 frame->view()->setScrollPosition(IntPoint(frame->view()->scrollX(), static_cast<int>(newTop * frame->pageZoomFactor() * frame->frameScaleFactor())), animated); 1331 } 1318 1332 return; 1319 1333 } 1320 1334 1321 1335 if (auto* renderer = renderBox()) { 1322 renderer->setScrollTop(static_cast<int>(newTop * renderer->style().effectiveZoom()), ScrollType::Programmatic); 1336 int clampedTop = clampToInteger(newTop * renderer->style().effectiveZoom()); 1337 bool animated = useSmoothScrolling(ScrollBehavior::Auto, *this); 1338 renderer->setScrollTop(clampedTop, ScrollType::Programmatic, animated); 1323 1339 if (auto* scrollableArea = renderer->layer()) 1324 1340 scrollableArea->setScrollShouldClearLatchedState(true); -
trunk/Source/WebCore/page/DOMWindow.cpp
r254753 r254807 1651 1651 void DOMWindow::scrollBy(double x, double y) const 1652 1652 { 1653 scrollBy( { x, y });1653 scrollBy(ScrollToOptions(x, y)); 1654 1654 } 1655 1655 … … 1673 1673 void DOMWindow::scrollTo(double x, double y, ScrollClamping clamping) const 1674 1674 { 1675 scrollTo( { x, y }, clamping);1676 } 1677 1678 void DOMWindow::scrollTo(const ScrollToOptions& options, ScrollClamping ) const1675 scrollTo(ScrollToOptions(x, y), clamping); 1676 } 1677 1678 void DOMWindow::scrollTo(const ScrollToOptions& options, ScrollClamping clamping) const 1679 1679 { 1680 1680 if (!isCurrentlyDisplayedInFrame()) … … 1689 1689 ); 1690 1690 1691 if (!scrollToOptions.left.value() && !scrollToOptions.top.value() && view->contentsScrollPosition() == IntPoint(0, 0)) 1691 // This is an optimization for the common case of scrolling to (0, 0) when the scroller is already at the origin. 1692 // If an animated scroll is in progress, this optimization is skipped to ensure that the animated scroll is really stopped. 1693 if (view->currentScrollBehaviorStatus() == ScrollBehaviorStatus::NotInAnimation && !scrollToOptions.left.value() && !scrollToOptions.top.value() && view->contentsScrollPosition() == IntPoint(0, 0)) 1692 1694 return; 1693 1695 … … 1695 1697 1696 1698 IntPoint layoutPos(view->mapFromCSSToLayoutUnits(scrollToOptions.left.value()), view->mapFromCSSToLayoutUnits(scrollToOptions.top.value())); 1699 1700 // FIXME: Should we use document()->scrollingElement()? 1701 // See https://bugs.webkit.org/show_bug.cgi?id=205059 1702 if (document()->documentElement() && useSmoothScrolling(scrollToOptions.behavior.valueOr(ScrollBehavior::Auto), *document()->documentElement())) { 1703 view->scrollToOffsetWithAnimation(layoutPos, ScrollType::Programmatic, clamping); 1704 return; 1705 } 1706 1697 1707 view->setContentsScrollPosition(layoutPos); 1698 1708 } -
trunk/Source/WebCore/page/FrameView.cpp
r254267 r254807 2280 2280 } 2281 2281 2282 void FrameView::setScrollPosition(const ScrollPosition& scrollPosition )2282 void FrameView::setScrollPosition(const ScrollPosition& scrollPosition, 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); 2295 if (animated) 2296 scrollToOffsetWithAnimation(scrollOffsetFromPosition(scrollPosition), currentScrollType()); 2297 else 2298 ScrollView::setScrollPosition(scrollPosition); 2296 2299 2297 2300 setCurrentScrollType(oldScrollType); … … 3657 3660 3658 3661 didChangeScrollOffset(); 3662 } 3663 3664 void FrameView::scrollToOffsetWithAnimation(const ScrollOffset& offset, ScrollType scrollType, ScrollClamping) 3665 { 3666 auto previousScrollType = currentScrollType(); 3667 setCurrentScrollType(scrollType); 3668 3669 if (currentScrollBehaviorStatus() == ScrollBehaviorStatus::InNonNativeAnimation) 3670 scrollAnimator().cancelAnimations(); 3671 if (offset != this->scrollOffset()) 3672 ScrollableArea::scrollToOffsetWithAnimation(offset); 3673 setCurrentScrollType(previousScrollType); 3659 3674 } 3660 3675 -
trunk/Source/WebCore/page/FrameView.h
r253673 r254807 224 224 WEBCORE_EXPORT void setFixedVisibleContentRect(const IntRect&) final; 225 225 #endif 226 WEBCORE_EXPORT void setScrollPosition(const ScrollPosition& ) final;226 WEBCORE_EXPORT void setScrollPosition(const ScrollPosition&, 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/platform/ScrollAnimation.h
r248762 r254807 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
r229209 r254807 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
r218615 r254807 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
r250946 r254807 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 auto previousScrollType = m_scrollableArea.currentScrollType(); 58 m_scrollableArea.setCurrentScrollType(ScrollType::Programmatic); 59 bool updated = m_scrollableArea.requestScrollPositionUpdate(roundedIntPoint(position)); 60 m_scrollableArea.setCurrentScrollType(previousScrollType); 61 if (updated) 62 return; 63 64 FloatSize delta = position - m_currentPosition; 65 m_currentPosition = WTFMove(position); 66 notifyPositionChanged(delta); 67 })) 55 68 { 56 69 } … … 74 87 notifyPositionChanged(newPosition - currentPosition); 75 88 return true; 89 } 90 91 void ScrollAnimator::scrollToOffset(const FloatPoint& offset) 92 { 93 m_animationProgrammaticScroll->setCurrentPosition(m_currentPosition); 94 auto newPosition = ScrollableArea::scrollPositionFromOffset(offset, toFloatSize(m_scrollableArea.scrollOrigin())); 95 m_animationProgrammaticScroll->scroll(newPosition); 96 m_scrollableArea.setScrollBehaviorStatus(ScrollBehaviorStatus::InNonNativeAnimation); 76 97 } 77 98 … … 246 267 #endif 247 268 269 void ScrollAnimator::cancelAnimations() 270 { 271 #if !USE(REQUEST_ANIMATION_FRAME_TIMER) 272 m_animationProgrammaticScroll->stop(); 273 #endif 274 } 275 276 void ScrollAnimator::serviceScrollAnimations() 277 { 278 #if !USE(REQUEST_ANIMATION_FRAME_TIMER) 279 m_animationProgrammaticScroll->serviceAnimation(); 280 #endif 281 } 282 283 void ScrollAnimator::willEndLiveResize() 284 { 285 m_animationProgrammaticScroll->updateVisibleLengths(); 286 } 287 288 void ScrollAnimator::didAddVerticalScrollbar(Scrollbar*) 289 { 290 m_animationProgrammaticScroll->updateVisibleLengths(); 291 } 292 293 void ScrollAnimator::didAddHorizontalScrollbar(Scrollbar*) 294 { 295 m_animationProgrammaticScroll->updateVisibleLengths(); 296 } 297 248 298 } // namespace WebCore -
trunk/Source/WebCore/platform/ScrollAnimator.h
r250946 r254807 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
r243701 r254807 55 55 }; 56 56 57 // FIXME: Add another status InNativeAnimation to indicate native scrolling is in progress. 58 // See: https://bugs.webkit.org/show_bug.cgi?id=204936 59 enum class ScrollBehaviorStatus : uint8_t { 60 NotInAnimation, 61 InNonNativeAnimation, 62 }; 63 57 64 inline ScrollDirection logicalToPhysical(ScrollLogicalDirection direction, bool isVertical, bool isFlipped) 58 65 { -
trunk/Source/WebCore/platform/ScrollView.cpp
r253689 r254807 519 519 } 520 520 521 void ScrollView::setScrollPosition(const ScrollPosition& scrollPosition )521 void ScrollView::setScrollPosition(const ScrollPosition& scrollPosition, bool/* animated*/) 522 522 { 523 523 LOG_WITH_STREAM(Scrolling, stream << "ScrollView::setScrollPosition " << scrollPosition); … … 533 533 ScrollPosition newScrollPosition = !delegatesScrolling() ? adjustScrollPositionWithinRange(scrollPosition) : scrollPosition; 534 534 535 if ((!delegatesScrolling() || currentScrollType() == ScrollType::User) && newScrollPosition == this->scrollPosition()) 536 return; 537 538 if (requestScrollPositionUpdate(newScrollPosition)) 539 return; 535 if ((!delegatesScrolling() || currentScrollType() == ScrollType::User) && currentScrollBehaviorStatus() == ScrollBehaviorStatus::NotInAnimation && newScrollPosition == this->scrollPosition()) 536 return; 537 538 if (currentScrollBehaviorStatus() == ScrollBehaviorStatus::InNonNativeAnimation) 539 scrollAnimator().cancelAnimations(); 540 541 if (requestScrollPositionUpdate(newScrollPosition)) { 542 setScrollBehaviorStatus(ScrollBehaviorStatus::NotInAnimation); 543 return; 544 } 540 545 541 546 updateScrollbars(newScrollPosition); 547 setScrollBehaviorStatus(ScrollBehaviorStatus::NotInAnimation); 542 548 } 543 549 … … 596 602 if (!managesScrollbars()) { 597 603 if (scrollOriginChanged()) { 598 ScrollableArea::scrollToOffsetWithoutAnimation(scrollOffsetFromPosition(desiredPosition)); 604 if (!requestScrollPositionUpdate(desiredPosition)) 605 ScrollableArea::scrollToOffsetWithoutAnimation(scrollOffsetFromPosition(desiredPosition)); 599 606 resetScrollOriginChanged(); 600 607 } -
trunk/Source/WebCore/platform/ScrollView.h
r254497 r254807 265 265 266 266 // Functions for scrolling the view. 267 virtual void setScrollPosition(const ScrollPosition& );267 virtual void setScrollPosition(const ScrollPosition&, bool animated = false); 268 268 void scrollBy(const IntSize& s) { return setScrollPosition(scrollPosition() + s); } 269 269 -
trunk/Source/WebCore/platform/ScrollableArea.cpp
r254087 r254807 143 143 } 144 144 145 void ScrollableArea::scrollToOffsetWithAnimation(const FloatPoint& offset, ScrollClamping) 146 { 147 LOG_WITH_STREAM(Scrolling, stream << "ScrollableArea " << this << " scrollToOffsetWithAnimation " << offset); 148 scrollAnimator().scrollToOffset(offset); 149 } 150 145 151 void ScrollableArea::scrollToOffsetWithoutAnimation(const FloatPoint& offset, ScrollClamping clamping) 146 152 { … … 222 228 void ScrollableArea::setScrollOffsetFromInternals(const ScrollOffset& offset) 223 229 { 230 if (requestScrollPositionUpdate(scrollPositionFromOffset(offset))) 231 return; 232 224 233 setScrollOffsetFromAnimation(offset); 225 234 } … … 227 236 void ScrollableArea::setScrollOffsetFromAnimation(const ScrollOffset& offset) 228 237 { 229 ScrollPosition position = scrollPositionFromOffset(offset); 230 if (requestScrollPositionUpdate(position)) 231 return; 232 233 scrollPositionChanged(position); 238 scrollPositionChanged(scrollPositionFromOffset(offset)); 234 239 } 235 240 -
trunk/Source/WebCore/platform/ScrollableArea.h
r254497 r254807 63 63 class ScrollableArea : public CanMakeWeakPtr<ScrollableArea> { 64 64 public: 65 ScrollBehaviorStatus currentScrollBehaviorStatus() { return m_currentScrollBehaviorStatus; } 66 void setScrollBehaviorStatus(ScrollBehaviorStatus status) { m_currentScrollBehaviorStatus = 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); … … 380 384 #endif 381 385 386 ScrollBehaviorStatus m_currentScrollBehaviorStatus { ScrollBehaviorStatus::NotInAnimation }; 387 382 388 // There are 8 possible combinations of writing mode and direction. Scroll origin will be non-zero in the x or y axis 383 389 // if there is any reversed direction or writing-mode. The combinations are: -
trunk/Source/WebCore/platform/generic/ScrollAnimatorGeneric.cpp
r248846 r254807 163 163 void ScrollAnimatorGeneric::updatePosition(FloatPoint&& position) 164 164 { 165 if (m_scrollableArea.requestScrollPositionUpdate(roundedIntPoint(position))) 166 return; 165 167 FloatSize delta = position - m_currentPosition; 166 168 m_currentPosition = WTFMove(position); -
trunk/Source/WebCore/platform/graphics/cg/PDFDocumentImage.cpp
r254778 r254807 49 49 #include <wtf/text/TextStream.h> 50 50 51 #if !PLATFORM(COCOA) 51 #if PLATFORM(COCOA) 52 #import <pal/spi/cg/CoreGraphicsSPI.h> 53 #else 52 54 #include "ImageSourceCG.h" 53 55 #endif -
trunk/Source/WebCore/platform/mac/ScrollAnimatorMac.mm
r254241 r254807 1157 1157 void ScrollAnimatorMac::cancelAnimations() 1158 1158 { 1159 ScrollAnimator::cancelAnimations(); 1159 1160 m_haveScrolledSincePageLoad = false; 1160 1161 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r253521 r254807 582 582 } 583 583 584 void RenderBox::setScrollLeft(int newLeft, ScrollType scrollType, ScrollClamping clamping)584 void RenderBox::setScrollLeft(int newLeft, ScrollType scrollType, bool animated, ScrollClamping clamping) 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, animated, clamping); 590 } 591 592 void RenderBox::setScrollTop(int newTop, ScrollType scrollType, bool animated, ScrollClamping clamping) 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, animated, clamping); 598 } 599 600 void RenderBox::setScrollPosition(const ScrollPosition& position, ScrollType scrollType, bool animated, ScrollClamping clamping) 601 { 602 if (!hasOverflowClip() || !layer()) 603 return; 604 setupWheelEventMonitor(*layer()); 605 layer()->scrollToPosition(position, scrollType, animated, clamping); 598 606 } 599 607 -
trunk/Source/WebCore/rendering/RenderBox.h
r252965 r254807 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, bool animated = false, ScrollClamping = ScrollClamping::Clamped); 251 virtual void setScrollTop(int, ScrollType, bool animated = false, ScrollClamping = ScrollClamping::Clamped); 252 void setScrollPosition(const ScrollPosition&, ScrollType, bool animated = false, ScrollClamping = ScrollClamping::Clamped); 252 253 253 254 LayoutUnit marginTop() const override { return m_marginBox.top(); } -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r254087 r254807 2580 2580 } 2581 2581 2582 void RenderLayer::scrollToXPosition(int x, ScrollType scrollType, ScrollClamping clamping)2582 void RenderLayer::scrollToXPosition(int x, ScrollType scrollType, bool animated, ScrollClamping clamping) 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, animated, clamping); 2586 } 2587 2588 void RenderLayer::scrollToYPosition(int y, ScrollType scrollType, bool animated, ScrollClamping clamping) 2589 2589 { 2590 2590 ScrollPosition position(m_scrollPosition.x(), y); 2591 scrollToOffset(scrollOffsetFromPosition(position), scrollType, clamping); 2591 scrollToPosition(position, scrollType, animated, clamping); 2592 } 2593 2594 void RenderLayer::scrollToPosition(const ScrollPosition& position, ScrollType scrollType, bool animated, ScrollClamping clamping) 2595 { 2596 if (animated) 2597 scrollToOffsetWithAnimation(scrollOffsetFromPosition(position), scrollType, clamping); 2598 else 2599 scrollToOffset(scrollOffsetFromPosition(position), scrollType, clamping); 2592 2600 } 2593 2601 … … 2599 2607 void RenderLayer::scrollToOffset(const ScrollOffset& scrollOffset, ScrollType scrollType, ScrollClamping clamping) 2600 2608 { 2609 if (currentScrollBehaviorStatus() == ScrollBehaviorStatus::InNonNativeAnimation) 2610 scrollAnimator().cancelAnimations(); 2611 2601 2612 ScrollOffset clampedScrollOffset = clamping == ScrollClamping::Clamped ? clampScrollOffset(scrollOffset) : scrollOffset; 2602 2613 if (clampedScrollOffset == this->scrollOffset()) … … 2608 2619 bool handled = false; 2609 2620 #if ENABLE(ASYNC_SCROLLING) 2610 if (ScrollingCoordinator* scrollingCoordinator = page().scrollingCoordinator()) 2611 handled = scrollingCoordinator->requestScrollPositionUpdate(*this, scrollPositionFromOffset(clampedScrollOffset)); 2621 handled = requestScrollPositionUpdate(scrollPositionFromOffset(clampedScrollOffset)); 2612 2622 #endif 2613 2623 2614 2624 if (!handled) 2615 2625 scrollToOffsetWithoutAnimation(clampedScrollOffset, clamping); 2616 2626 setScrollBehaviorStatus(ScrollBehaviorStatus::NotInAnimation); 2627 2628 setCurrentScrollType(previousScrollType); 2629 } 2630 2631 bool RenderLayer::requestScrollPositionUpdate(const ScrollPosition& position) 2632 { 2633 #if ENABLE(ASYNC_SCROLLING) 2634 if (ScrollingCoordinator* scrollingCoordinator = page().scrollingCoordinator()) 2635 return scrollingCoordinator->requestScrollPositionUpdate(*this, position); 2636 #endif 2637 return false; 2638 } 2639 2640 void RenderLayer::scrollToOffsetWithAnimation(const ScrollOffset& offset, ScrollType scrollType, ScrollClamping clamping) 2641 { 2642 auto previousScrollType = currentScrollType(); 2643 setCurrentScrollType(scrollType); 2644 2645 ScrollOffset newScrollOffset = clamping == ScrollClamping::Clamped ? clampScrollOffset(offset) : offset; 2646 if (currentScrollBehaviorStatus() == ScrollBehaviorStatus::InNonNativeAnimation) 2647 scrollAnimator().cancelAnimations(); 2648 if (newScrollOffset != this->scrollOffset()) 2649 ScrollableArea::scrollToOffsetWithAnimation(newScrollOffset); 2617 2650 setCurrentScrollType(previousScrollType); 2618 2651 } … … 2650 2683 } 2651 2684 2652 if (m_scrollPosition == newPosition ) {2685 if (m_scrollPosition == newPosition && currentScrollBehaviorStatus() == ScrollBehaviorStatus::NotInAnimation) { 2653 2686 // FIXME: Nothing guarantees we get a scrollTo() with an unchanged position at the end of a user gesture. 2654 2687 // The ScrollingCoordinator probably needs to message the main thread when a gesture ends. … … 2795 2828 2796 2829 ScrollOffset clampedScrollOffset = clampScrollOffset(scrollOffset() + toIntSize(roundedIntRect(revealRect).location())); 2797 if (c lampedScrollOffset != scrollOffset()) {2830 if (currentScrollBehaviorStatus() != ScrollBehaviorStatus::NotInAnimation || clampedScrollOffset != scrollOffset()) { 2798 2831 ScrollOffset oldScrollOffset = scrollOffset(); 2799 scrollToOffset(clampedScrollOffset); 2800 IntSize scrollOffsetDifference = scrollOffset() - oldScrollOffset; 2832 bool animated = (box->element() && useSmoothScrolling(options.behavior, *box->element())); 2833 scrollToPosition(scrollPositionFromOffset(clampedScrollOffset), ScrollType::Programmatic, animated); 2834 IntSize scrollOffsetDifference = clampedScrollOffset - oldScrollOffset; 2801 2835 localExposeRect.move(-scrollOffsetDifference); 2802 2836 newRect = LayoutRect(box->localToAbsoluteQuad(FloatQuad(FloatRect(localExposeRect)), UseTransforms).boundingBox()); … … 2818 2852 LayoutRect exposeRect = getRectToExpose(viewRect, absoluteRect, insideFixed, options.alignX, options.alignY); 2819 2853 2820 IntPoint scroll Offset(roundedIntPoint(exposeRect.location()));2854 IntPoint scrollPosition(roundedIntPoint(exposeRect.location())); 2821 2855 // Adjust offsets if they're outside of the allowable range. 2822 scrollOffset = scrollOffset.constrainedBetween(IntPoint(), IntPoint(frameView.contentsSize())); 2823 frameView.setScrollPosition(scrollOffset); 2856 scrollPosition = scrollPosition.constrainedBetween(IntPoint(), IntPoint(frameView.contentsSize())); 2857 // FIXME: Should we use contentDocument()->scrollingElement()? 2858 // See https://bugs.webkit.org/show_bug.cgi?id=205059 2859 bool animated = ownerElement->contentDocument() && ownerElement->contentDocument()->documentElement() && useSmoothScrolling(options.behavior, *ownerElement->contentDocument()->documentElement()); 2860 frameView.setScrollPosition(scrollPosition, animated); 2824 2861 2825 2862 if (options.shouldAllowCrossOriginScrolling == ShouldAllowCrossOriginScrolling::Yes || frameView.safeToPropagateScrollToParent()) { … … 2860 2897 if (revealRect != viewRect) { 2861 2898 ScrollOffset clampedScrollPosition = roundedIntPoint(revealRect.location()).constrainedBetween(minScrollPosition, maxScrollPosition); 2862 frameView.setScrollPosition(clampedScrollPosition); 2899 // FIXME: Should we use document()->scrollingElement()? 2900 // See https://bugs.webkit.org/show_bug.cgi?id=205059 2901 bool animated = renderer().document().documentElement() && useSmoothScrolling(options.behavior, *renderer().document().documentElement()); 2902 frameView.setScrollPosition(clampedScrollPosition, animated); 2863 2903 } 2864 2904 -
trunk/Source/WebCore/rendering/RenderLayer.h
r254087 r254807 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 … … 441 443 442 444 WEBCORE_EXPORT void scrollToOffset(const ScrollOffset&, ScrollType = ScrollType::Programmatic, ScrollClamping = ScrollClamping::Clamped); 443 444 void scrollToXPosition(int x, ScrollType, ScrollClamping = ScrollClamping::Clamped); 445 void scrollToYPosition(int y, ScrollType, ScrollClamping = ScrollClamping::Clamped); 445 WEBCORE_EXPORT void scrollToOffsetWithAnimation(const ScrollOffset&, ScrollType = ScrollType::Programmatic, ScrollClamping = ScrollClamping::Clamped); 446 447 bool requestScrollPositionUpdate(const ScrollPosition&) override; 448 449 void scrollToXPosition(int x, ScrollType, bool animated, ScrollClamping = ScrollClamping::Clamped); 450 void scrollToYPosition(int y, ScrollType, bool animated, ScrollClamping = ScrollClamping::Clamped); 451 void scrollToPosition(const ScrollPosition&, ScrollType, bool animated, ScrollClamping = ScrollClamping::Clamped); 446 452 447 453 // These are only used by marquee. -
trunk/Source/WebCore/rendering/RenderListBox.cpp
r253141 r254807 744 744 } 745 745 746 void RenderListBox::setScrollLeft(int, ScrollType, ScrollClamping)746 void RenderListBox::setScrollLeft(int, ScrollType, bool, ScrollClamping) 747 747 { 748 748 } … … 761 761 } 762 762 763 void RenderListBox::setScrollTop(int newTop, ScrollType, ScrollClamping)763 void RenderListBox::setScrollTop(int newTop, ScrollType, bool, ScrollClamping) 764 764 { 765 765 // Determine an index and scroll to it. -
trunk/Source/WebCore/rendering/RenderListBox.h
r246488 r254807 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, bool, ScrollClamping) override; 110 void setScrollTop(int, ScrollType, bool, ScrollClamping) override; 111 111 112 112 bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override; -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
r246490 r254807 377 377 } 378 378 379 void RenderTextControlSingleLine::setScrollLeft(int newLeft, ScrollType, ScrollClamping)379 void RenderTextControlSingleLine::setScrollLeft(int newLeft, ScrollType, bool, ScrollClamping) 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, bool, ScrollClamping) 386 386 { 387 387 if (innerTextElement()) -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h
r243701 r254807 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, bool, ScrollClamping) override; 61 void setScrollTop(int, ScrollType, bool, ScrollClamping) 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
r254514 r254807 1763 1763 return Exception { InvalidAccessError }; 1764 1764 1765 element.scrollTo( { x, y }, ScrollClamping::Unclamped);1765 element.scrollTo(ScrollToOptions(x, y), ScrollClamping::Unclamped); 1766 1766 return { }; 1767 1767 }
Note: See TracChangeset
for help on using the changeset viewer.