Title: [234642] trunk/Source/WebCore
Revision
234642
Author
[email protected]
Date
2018-08-07 01:30:39 -0700 (Tue, 07 Aug 2018)

Log Message

Make DOMWindow::scrollBy rely on DOMWindow::scrollTo
https://bugs.webkit.org/show_bug.cgi?id=188343

Patch by Frederic Wang <[email protected]> on 2018-08-07
Reviewed by Darin Adler.

This patch makes DOMWindow::scrollBy rely on DOMWindow::scrollTo in order to perform actual
scrolling of the view. In particular, this reduces the number of code path to modify in order
to implement the ScrollBehavior option (bug 188043). The only change is an optimization when
scrolling to position (0, 0) but it is not observable.

No new tests, behavior unchanged and already tested.

* page/DOMWindow.cpp:
(WebCore::DOMWindow::scrollBy const): Add the current view position to the scrollBy offset in
order to obtain the scrollTo offset.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (234641 => 234642)


--- trunk/Source/WebCore/ChangeLog	2018-08-07 03:28:56 UTC (rev 234641)
+++ trunk/Source/WebCore/ChangeLog	2018-08-07 08:30:39 UTC (rev 234642)
@@ -1,3 +1,21 @@
+2018-08-07  Frederic Wang  <[email protected]>
+
+        Make DOMWindow::scrollBy rely on DOMWindow::scrollTo
+        https://bugs.webkit.org/show_bug.cgi?id=188343
+
+        Reviewed by Darin Adler.
+
+        This patch makes DOMWindow::scrollBy rely on DOMWindow::scrollTo in order to perform actual
+        scrolling of the view. In particular, this reduces the number of code path to modify in order
+        to implement the ScrollBehavior option (bug 188043). The only change is an optimization when
+        scrolling to position (0, 0) but it is not observable.
+
+        No new tests, behavior unchanged and already tested.
+
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::scrollBy const): Add the current view position to the scrollBy offset in
+        order to obtain the scrollTo offset.
+
 2018-08-04  Ryosuke Niwa  <[email protected]>
 
         Add CEReactions=NotNeeded for reactions only needed for customized builtins

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (234641 => 234642)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2018-08-07 03:28:56 UTC (rev 234641)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2018-08-07 08:30:39 UTC (rev 234642)
@@ -1591,8 +1591,9 @@
         return;
 
     ScrollToOptions scrollToOptions = normalizeNonFiniteCoordinatesOrFallBackTo(options, 0, 0);
-    IntSize scaledOffset(view->mapFromCSSToLayoutUnits(scrollToOptions.left.value()), view->mapFromCSSToLayoutUnits(scrollToOptions.top.value()));
-    view->setContentsScrollPosition(view->contentsScrollPosition() + scaledOffset);
+    scrollToOptions.left.value() += view->mapFromLayoutToCSSUnits(view->contentsScrollPosition().x());
+    scrollToOptions.top.value() += view->mapFromLayoutToCSSUnits(view->contentsScrollPosition().y());
+    scrollTo(scrollToOptions);
 }
 
 void DOMWindow::scrollTo(double x, double y, ScrollClamping clamping) const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to