Title: [113096] trunk/Source/WebCore
Revision
113096
Author
[email protected]
Date
2012-04-03 15:26:21 -0700 (Tue, 03 Apr 2012)

Log Message

Search result page scrolls up before the correct page opens from google search
https://bugs.webkit.org/show_bug.cgi?id=81280
<rdar://problem/10973263>

Reviewed by Sam Weinig.

Make the requested scroll position part of the ScrollingTreeState so any changes being made
are in sync with other important changes such as the scroll layer or contents size.

* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::frameViewRootLayerDidChange):
Use coordinatesScrollingForFrameView instead of checking if the frame is the main frame.

(WebCore::ScrollingCoordinator::requestScrollPositionUpdate):
Call ScrollingTreeState::setRequestedScrollPosition.

(WebCore::ScrollingCoordinator::setScrollLayer):
Reset the requested scroll position.

* page/scrolling/ScrollingTreeState.cpp:
(WebCore::ScrollingTreeState::setRequestedScrollPosition):
Keep track of the scroll position.

* page/scrolling/mac/ScrollingTreeNodeMac.mm:
(WebCore::ScrollingTreeNodeMac::update):
Update the scroll position if it's changed.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113095 => 113096)


--- trunk/Source/WebCore/ChangeLog	2012-04-03 22:02:58 UTC (rev 113095)
+++ trunk/Source/WebCore/ChangeLog	2012-04-03 22:26:21 UTC (rev 113096)
@@ -1,3 +1,32 @@
+2012-03-15  Anders Carlsson  <[email protected]>
+
+        Search result page scrolls up before the correct page opens from google search
+        https://bugs.webkit.org/show_bug.cgi?id=81280
+        <rdar://problem/10973263>
+
+        Reviewed by Sam Weinig.
+
+        Make the requested scroll position part of the ScrollingTreeState so any changes being made
+        are in sync with other important changes such as the scroll layer or contents size.
+
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::ScrollingCoordinator::frameViewRootLayerDidChange):
+        Use coordinatesScrollingForFrameView instead of checking if the frame is the main frame.
+
+        (WebCore::ScrollingCoordinator::requestScrollPositionUpdate):
+        Call ScrollingTreeState::setRequestedScrollPosition.
+
+        (WebCore::ScrollingCoordinator::setScrollLayer):
+        Reset the requested scroll position.
+
+        * page/scrolling/ScrollingTreeState.cpp:
+        (WebCore::ScrollingTreeState::setRequestedScrollPosition):
+        Keep track of the scroll position.
+
+        * page/scrolling/mac/ScrollingTreeNodeMac.mm:
+        (WebCore::ScrollingTreeNodeMac::update):
+        Update the scroll position if it's changed.
+
 2012-04-03  W. James MacLean  <[email protected]>
 
         [chromium] Switch touchpad fling curve physics to absolute (not scaled) curve.

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (113095 => 113096)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2012-04-03 22:02:58 UTC (rev 113095)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2012-04-03 22:26:21 UTC (rev 113096)
@@ -216,7 +216,7 @@
     ASSERT(isMainThread());
     ASSERT(m_page);
 
-    if (frameView->frame() != m_page->mainFrame())
+    if (!coordinatesScrollingForFrameView(frameView))
         return;
 
     frameViewLayoutUpdated(frameView);
@@ -238,7 +238,14 @@
     // since FrameView expects scroll position updates to happen synchronously.
     updateMainFrameScrollPosition(scrollPosition);
 
-    ScrollingThread::dispatch(bind(&ScrollingTree::setMainFrameScrollPosition, m_scrollingTree.get(), scrollPosition));
+    if (frameView->frame()->document()->inPageCache()) {
+        // If this frame view's document is being put into the page cache, we don't want to update our
+        // main frame scroll position.
+        return true;
+    }
+
+    m_scrollingTreeState->setRequestedScrollPosition(scrollPosition);
+    scheduleTreeStateCommit();
     return true;
 #else
     UNUSED_PARAM(scrollPosition);

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeState.cpp (113095 => 113096)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeState.cpp	2012-04-03 22:02:58 UTC (rev 113095)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeState.cpp	2012-04-03 22:26:21 UTC (rev 113096)
@@ -131,6 +131,12 @@
     m_changedProperties |= HasEnabledVerticalScrollbar;
 }
 
+void ScrollingTreeState::setRequestedScrollPosition(const IntPoint& requestedScrollPosition)
+{
+    m_requestedScrollPosition = requestedScrollPosition;
+    m_changedProperties |= RequestedScrollPosition;
+}
+
 PassOwnPtr<ScrollingTreeState> ScrollingTreeState::commit()
 {
     OwnPtr<ScrollingTreeState> treeState = adoptPtr(new ScrollingTreeState(*this));

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeState.h (113095 => 113096)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeState.h	2012-04-03 22:02:58 UTC (rev 113095)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeState.h	2012-04-03 22:26:21 UTC (rev 113096)
@@ -60,6 +60,7 @@
         HasEnabledHorizontalScrollbar = 1 << 7,
         HasEnabledVerticalScrollbar = 1 << 8,
         ScrollLayer = 1 << 9,
+        RequestedScrollPosition = 1 << 10,
     };
 
     bool hasChangedProperties() const { return m_changedProperties; }
@@ -95,6 +96,9 @@
     PlatformLayer* platformScrollLayer() const;
     void setScrollLayer(const GraphicsLayer*);
 
+    const IntPoint& requestedScrollPosition() const { return m_requestedScrollPosition; }
+    void setRequestedScrollPosition(const IntPoint&);
+
     // Copies the current tree state and clears the changed properties mask in the original.
     PassOwnPtr<ScrollingTreeState> commit();
 
@@ -118,6 +122,8 @@
     bool m_hasEnabledHorizontalScrollbar;
     bool m_hasEnabledVerticalScrollbar;
 
+    IntPoint m_requestedScrollPosition;
+
 #if PLATFORM(MAC)
     RetainPtr<PlatformLayer> m_platformScrollLayer;
 #endif

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm (113095 => 113096)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm	2012-04-03 22:02:58 UTC (rev 113095)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm	2012-04-03 22:26:21 UTC (rev 113096)
@@ -58,6 +58,9 @@
     if (state->changedProperties() & ScrollingTreeState::ScrollLayer)
         m_scrollLayer = state->platformScrollLayer();
 
+    if (state->changedProperties() & ScrollingTreeState::RequestedScrollPosition)
+        setScrollPosition(state->requestedScrollPosition());
+
     if (state->changedProperties() & (ScrollingTreeState::ScrollLayer | ScrollingTreeState::ContentsSize | ScrollingTreeState::ViewportRect))
         updateMainFramePinState(scrollPosition());
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to