WebKit briefly shows wrong webpage after swiping back (gigaom.com, or any site on...
[WebKit-https.git] / Source / WebKit2 / UIProcess / mac / ViewGestureControllerMac.mm
index b5945ee8cdc5a32203d4a16bbe06de7c64977d80..fc4305146142107367f344df058583d9a3ac3717 100644 (file)
@@ -661,7 +661,12 @@ void ViewGestureController::endSwipeGesture(WebBackForwardListItem* targetItem,
     m_webPageProxy.navigationGestureDidEnd(true, *targetItem);
     m_webPageProxy.goToBackForwardItem(targetItem);
 
+    // FIXME: Like on iOS, we should ensure that even if one of the timeouts fires,
+    // we never show the old page content, instead showing white (or the snapshot background color).
     m_swipeWatchdogTimer.startOneShot(swipeSnapshotRemovalWatchdogDuration.count());
+
+    if (ViewSnapshot* snapshot = targetItem->snapshot())
+        m_backgroundColorForCurrentSnapshot = snapshot->backgroundColor();
 }
 
 void ViewGestureController::didHitRenderTreeSizeThreshold()
@@ -778,6 +783,8 @@ void ViewGestureController::removeSwipeSnapshot()
     m_activeGestureType = ViewGestureType::None;
 
     m_webPageProxy.navigationGestureSnapshotWasRemoved();
+
+    m_backgroundColorForCurrentSnapshot = Color();
 }
 
 void ViewGestureController::endActiveGesture()