Diff
Modified: trunk/Source/WebKit2/ChangeLog (186081 => 186082)
--- trunk/Source/WebKit2/ChangeLog 2015-06-29 19:52:21 UTC (rev 186081)
+++ trunk/Source/WebKit2/ChangeLog 2015-06-29 19:56:03 UTC (rev 186082)
@@ -1,5 +1,38 @@
2015-06-29 Chris Dumez <[email protected]>
+ [WK2][iOS] Swipe gesture snapshot stays up for 3 seconds when swiping back after top-hit navigation
+ https://bugs.webkit.org/show_bug.cgi?id=146415
+ <rdar://problem/21595801>
+
+ Reviewed by Tim Horton.
+
+ Swipe gesture snapshot previously stayed up for 3 seconds when swiping
+ back after a top-hit navigation. This is because we do not restore the
+ scroll position in this case and the ViewGestureController was waiting
+ for the scroll position to be restored before taking down the snapshot.
+
+ This patch adds a fail-safe mechanism so that the WebProcess can let
+ the UIProcess know (via a CouldNotRestorePageState IPC) that the page
+ state (including scroll position) could not be restored so that it can
+ let the ViewGestureController it should not wait for the scroll
+ position to be restored.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _couldNotRestorePageState]):
+ * UIProcess/API/Cocoa/WKWebViewInternal.h:
+ * UIProcess/PageClient.h:
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/ios/PageClientImplIOS.h:
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::couldNotRestorePageState):
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ (WebKit::WebPageProxy::couldNotRestorePageState):
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::restorePageState):
+
+2015-06-29 Chris Dumez <[email protected]>
+
[WK2][iOS] Add WKWebView private API to save a back/forward snapshot
https://bugs.webkit.org/show_bug.cgi?id=146398
<rdar://problem/21584231>
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (186081 => 186082)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-06-29 19:52:21 UTC (rev 186081)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-06-29 19:56:03 UTC (rev 186082)
@@ -1029,6 +1029,16 @@
}
}
+- (void)_couldNotRestorePageState
+{
+ // The gestureController may be waiting for the scroll position to be restored
+ // in order to remove the swipe snapshot. Since the scroll position could not be
+ // restored, tell the gestureController it was restored so that it no longer waits
+ // for it.
+ if (_gestureController)
+ _gestureController->didRestoreScrollPosition();
+}
+
- (void)_restorePageStateToExposedRect:(WebCore::FloatRect)exposedRect scale:(double)scale
{
if (_dynamicViewportUpdateMode != DynamicViewportUpdateMode::NotResizing)
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (186081 => 186082)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h 2015-06-29 19:52:21 UTC (rev 186081)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h 2015-06-29 19:56:03 UTC (rev 186082)
@@ -75,6 +75,7 @@
- (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction;
- (void)_dynamicViewportUpdateChangedTargetToScale:(double)newScale position:(CGPoint)newScrollPosition nextValidLayerTreeTransactionID:(uint64_t)nextValidLayerTreeTransactionID;
+- (void)_couldNotRestorePageState;
- (void)_restorePageStateToExposedRect:(WebCore::FloatRect)exposedRect scale:(double)scale;
- (void)_restorePageStateToUnobscuredCenter:(WebCore::FloatPoint)center scale:(double)scale;
Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (186081 => 186082)
--- trunk/Source/WebKit2/UIProcess/PageClient.h 2015-06-29 19:52:21 UTC (rev 186081)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h 2015-06-29 19:56:03 UTC (rev 186082)
@@ -264,6 +264,7 @@
virtual void didCommitLayerTree(const RemoteLayerTreeTransaction&) = 0;
virtual void dynamicViewportUpdateChangedTarget(double newScale, const WebCore::FloatPoint& newScrollPosition, uint64_t transactionID) = 0;
+ virtual void couldNotRestorePageState() = 0;
virtual void restorePageState(const WebCore::FloatRect&, double) = 0;
virtual void restorePageCenterAndScale(const WebCore::FloatPoint&, double) = 0;
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (186081 => 186082)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2015-06-29 19:52:21 UTC (rev 186081)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2015-06-29 19:56:03 UTC (rev 186082)
@@ -1396,6 +1396,7 @@
float textAutosizingWidth();
void dynamicViewportUpdateChangedTarget(double newTargetScale, const WebCore::FloatPoint& newScrollPosition, uint64_t dynamicViewportSizeUpdateID);
+ void couldNotRestorePageState();
void restorePageState(const WebCore::FloatRect&, double scale);
void restorePageCenterAndScale(const WebCore::FloatPoint&, double scale);
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (186081 => 186082)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2015-06-29 19:52:21 UTC (rev 186081)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2015-06-29 19:56:03 UTC (rev 186082)
@@ -359,6 +359,7 @@
#if PLATFORM(IOS)
DynamicViewportUpdateChangedTarget(double newTargetScale, WebCore::FloatPoint newScrollPosition, uint64_t dynamicViewportSizeUpdateID)
+ CouldNotRestorePageState()
RestorePageState(WebCore::FloatRect exposedRect, double scale)
RestorePageCenterAndScale(WebCore::FloatPoint unobscuredCenter, double scale)
DidGetTapHighlightGeometries(uint64_t requestID, WebCore::Color color, Vector<WebCore::FloatQuad> geometries, WebCore::IntSize topLeftRadius, WebCore::IntSize topRightRadius, WebCore::IntSize bottomLeftRadius, WebCore::IntSize bottomRightRadius)
Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (186081 => 186082)
--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h 2015-06-29 19:52:21 UTC (rev 186081)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h 2015-06-29 19:56:03 UTC (rev 186082)
@@ -118,6 +118,7 @@
virtual void didCommitLayerTree(const RemoteLayerTreeTransaction&) override;
virtual void dynamicViewportUpdateChangedTarget(double newScale, const WebCore::FloatPoint& newScrollPosition, uint64_t transactionID) override;
+ virtual void couldNotRestorePageState() override;
virtual void restorePageState(const WebCore::FloatRect&, double) override;
virtual void restorePageCenterAndScale(const WebCore::FloatPoint&, double) override;
Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (186081 => 186082)
--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm 2015-06-29 19:52:21 UTC (rev 186081)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm 2015-06-29 19:56:03 UTC (rev 186082)
@@ -519,6 +519,11 @@
[m_webView _dynamicViewportUpdateChangedTargetToScale:newScale position:newScrollPosition nextValidLayerTreeTransactionID:nextValidLayerTreeTransactionID];
}
+void PageClientImpl::couldNotRestorePageState()
+{
+ [m_webView _couldNotRestorePageState];
+}
+
void PageClientImpl::restorePageState(const WebCore::FloatRect& exposedRect, double scale)
{
[m_webView _restorePageStateToExposedRect:exposedRect scale:scale];
Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (186081 => 186082)
--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm 2015-06-29 19:52:21 UTC (rev 186081)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm 2015-06-29 19:56:03 UTC (rev 186082)
@@ -768,6 +768,11 @@
}
}
+void WebPageProxy::couldNotRestorePageState()
+{
+ m_pageClient.couldNotRestorePageState();
+}
+
void WebPageProxy::restorePageState(const WebCore::FloatRect& exposedRect, double scale)
{
m_pageClient.restorePageState(exposedRect, scale);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (186081 => 186082)
--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2015-06-29 19:52:21 UTC (rev 186081)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2015-06-29 19:56:03 UTC (rev 186082)
@@ -297,8 +297,10 @@
{
// When a HistoryItem is cleared, its scale factor and scroll point are set to zero. We should not try to restore the other
// parameters in those conditions.
- if (!historyItem.pageScaleFactor())
+ if (!historyItem.pageScaleFactor()) {
+ send(Messages::WebPageProxy::CouldNotRestorePageState());
return;
+ }
// We can restore the exposed rect and scale, but we cannot touch the scroll position since the obscured insets
// may be changing in the UIProcess. The UIProcess can update the position from the information we send and will then