Title: [169916] tags/Safari-538.40/Source/WebCore

Diff

Modified: tags/Safari-538.40/Source/WebCore/ChangeLog (169915 => 169916)


--- tags/Safari-538.40/Source/WebCore/ChangeLog	2014-06-12 22:36:22 UTC (rev 169915)
+++ tags/Safari-538.40/Source/WebCore/ChangeLog	2014-06-12 22:41:43 UTC (rev 169916)
@@ -1,3 +1,30 @@
+2014-06-12  Babak Shafiei  <[email protected]>
+
+        Merge r169913.
+
+    2014-06-12  Simon Fraser  <[email protected]>
+
+            [iOS WK2] Fix crash on back/foward swipe
+            https://bugs.webkit.org/show_bug.cgi?id=133826
+            <rdar://problem/17032752>
+
+            Reviewed by Tim Horton.
+
+            AsyncScrollingCoordinator::frameViewForScrollingNode() would crash with a null root
+            state node, because HistoryController::restoreScrollPositionAndViewState() tried
+            to restore scroll position (via restoreViewState()) before hooking up the scrolling
+            coordinator.
+        
+            Fix by doing the scrollingCoordinator->frameViewRootLayerDidChange() before
+            calling restoreViewState().
+        
+            Also add a defensive null-check on the root state node in updateScrollPositionAfterAsyncScrollTimerFired().
+
+            * loader/HistoryController.cpp:
+            (WebCore::HistoryController::restoreScrollPositionAndViewState):
+            * page/scrolling/AsyncScrollingCoordinator.cpp:
+            (WebCore::AsyncScrollingCoordinator::frameViewForScrollingNode):
+
 2014-06-12  Sergio Villar Senin  <[email protected]>
 
         [GTK] Unsupported browser in www.icloud.com

Modified: tags/Safari-538.40/Source/WebCore/loader/HistoryController.cpp (169915 => 169916)


--- tags/Safari-538.40/Source/WebCore/loader/HistoryController.cpp	2014-06-12 22:36:22 UTC (rev 169915)
+++ tags/Safari-538.40/Source/WebCore/loader/HistoryController.cpp	2014-06-12 22:41:43 UTC (rev 169916)
@@ -124,33 +124,35 @@
     // so there *is* no scroll or view state to restore!
     if (!m_currentItem)
         return;
-    
-    // FIXME: It would be great to work out a way to put this code in WebCore instead of calling
-    // through to the client. It's currently used only for the PDF view on Mac.
-    m_frame.loader().client().restoreViewState();
 
+    FrameView* view = m_frame.view();
+
     // FIXME: There is some scrolling related work that needs to happen whenever a page goes into the
     // page cache and similar work that needs to occur when it comes out. This is where we do the work
     // that needs to happen when we exit, and the work that needs to happen when we enter is in
     // Document::setIsInPageCache(bool). It would be nice if there was more symmetry in these spots.
     // https://bugs.webkit.org/show_bug.cgi?id=98698
-    if (FrameView* view = m_frame.view()) {
+    if (view) {
         Page* page = m_frame.page();
         if (page && m_frame.isMainFrame()) {
             if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
                 scrollingCoordinator->frameViewRootLayerDidChange(view);
         }
+    }
 
+    // FIXME: It would be great to work out a way to put this code in WebCore instead of calling
+    // through to the client.
+    m_frame.loader().client().restoreViewState();
+
 #if !PLATFORM(IOS)
-        // Don't restore scroll point on iOS as FrameLoaderClient::restoreViewState() does that.
-        if (!view->wasScrolledByUser()) {
-            if (page && m_frame.isMainFrame() && m_currentItem->pageScaleFactor())
-                page->setPageScaleFactor(m_currentItem->pageScaleFactor(), m_currentItem->scrollPoint());
-            else
-                view->setScrollPosition(m_currentItem->scrollPoint());
-        }
+    // Don't restore scroll point on iOS as FrameLoaderClient::restoreViewState() does that.
+    if (view && !view->wasScrolledByUser()) {
+        if (page && m_frame.isMainFrame() && m_currentItem->pageScaleFactor())
+            page->setPageScaleFactor(m_currentItem->pageScaleFactor(), m_currentItem->scrollPoint());
+        else
+            view->setScrollPosition(m_currentItem->scrollPoint());
+    }
 #endif
-    }
 }
 
 void HistoryController::updateBackForwardListForFragmentScroll()

Modified: tags/Safari-538.40/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (169915 => 169916)


--- tags/Safari-538.40/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2014-06-12 22:36:22 UTC (rev 169915)
+++ tags/Safari-538.40/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2014-06-12 22:41:43 UTC (rev 169916)
@@ -197,6 +197,9 @@
 
 FrameView* AsyncScrollingCoordinator::frameViewForScrollingNode(ScrollingNodeID scrollingNodeID) const
 {
+    if (!m_scrollingStateTree->rootStateNode())
+        return nullptr;
+    
     if (scrollingNodeID == m_scrollingStateTree->rootStateNode()->scrollingNodeID())
         return m_page->mainFrame().view();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to