Title: [170063] trunk/Source/WebCore
Revision
170063
Author
[email protected]
Date
2014-06-17 12:00:42 -0700 (Tue, 17 Jun 2014)

Log Message

Avoid synchronous layout in window.scrollTo(0,0) when already at (0,0)
<https://webkit.org/b/133893>

Going from 0,0 to 0,0 is a no-op since there is no way a layout will
affect the current scroll position.

We don't send scroll events when moving to the previous position,
so this change is not observable.

Reviewed by Anders Carlsson.

* page/DOMWindow.cpp:
(WebCore::DOMWindow::scrollTo):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (170062 => 170063)


--- trunk/Source/WebCore/ChangeLog	2014-06-17 18:02:08 UTC (rev 170062)
+++ trunk/Source/WebCore/ChangeLog	2014-06-17 19:00:42 UTC (rev 170063)
@@ -1,3 +1,19 @@
+2014-06-17  Andreas Kling  <[email protected]>
+
+        Avoid synchronous layout in window.scrollTo(0,0) when already at (0,0)
+        <https://webkit.org/b/133893>
+
+        Going from 0,0 to 0,0 is a no-op since there is no way a layout will
+        affect the current scroll position.
+
+        We don't send scroll events when moving to the previous position,
+        so this change is not observable.
+
+        Reviewed by Anders Carlsson.
+
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::scrollTo):
+
 2014-06-17  Alex Christensen  <[email protected]>
 
         Fix css jit register usage on armv7.

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (170062 => 170063)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2014-06-17 18:02:08 UTC (rev 170062)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2014-06-17 19:00:42 UTC (rev 170063)
@@ -1479,12 +1479,15 @@
     if (!isCurrentlyDisplayedInFrame())
         return;
 
-    document()->updateLayoutIgnorePendingStylesheets();
-
     RefPtr<FrameView> view = m_frame->view();
     if (!view)
         return;
 
+    if (!x && !y && view->contentsScrollPosition() == IntPoint(0, 0))
+        return;
+
+    document()->updateLayoutIgnorePendingStylesheets();
+
     IntPoint layoutPos(view->mapFromCSSToLayoutUnits(x), view->mapFromCSSToLayoutUnits(y));
     view->setContentsScrollPosition(layoutPos);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to