WebKit Bugzilla
Attachment 341709 Details for
Bug 186168
: Regression(r230876): Swipe navigation snapshot may get removed too early
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
WIP Patch
186168_swipe_snapshot_wip.patch (text/plain), 9.11 KB, created by
Chris Dumez
on 2018-05-31 17:00:54 PDT
(
hide
)
Description:
WIP Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2018-05-31 17:00:54 PDT
Size:
9.11 KB
patch
obsolete
>diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >index 6719b0056a6..d7bd8b0895e 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >@@ -2829,6 +2829,12 @@ - (void)_updateVisibleContentRects > } > } > >+- (void)_didStartProvisionalLoadForMainFrame >+{ >+ if (_gestureController) >+ _gestureController->didStartProvisionalLoadForMainFrame(); >+} >+ > - (void)_didFinishLoadForMainFrame > { > if (_gestureController) >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h >index 1be7ffb0958..9e139d0ec80 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h >@@ -105,6 +105,7 @@ struct PrintInfo; > > - (void)_scheduleVisibleContentRectUpdate; > >+- (void)_didStartProvisionalLoadForMainFrame; > - (void)_didFinishLoadForMainFrame; > - (void)_didFailLoadForMainFrame; > - (void)_didSameDocumentNavigationForMainFrame:(WebKit::SameDocumentNavigationType)navigationType; >diff --git a/Source/WebKit/UIProcess/Cocoa/ViewGestureController.cpp b/Source/WebKit/UIProcess/Cocoa/ViewGestureController.cpp >index 8c21c2466a2..2a4f427f552 100644 >--- a/Source/WebKit/UIProcess/Cocoa/ViewGestureController.cpp >+++ b/Source/WebKit/UIProcess/Cocoa/ViewGestureController.cpp >@@ -127,6 +127,12 @@ bool ViewGestureController::canSwipeInDirection(SwipeDirection direction) const > return !!backForwardList.forwardItem(); > } > >+void ViewGestureController::didStartProvisionalLoadForMainFrame() >+{ >+ if (auto provisionalLoadCallback = WTFMove(m_provisionalLoadCallback)) >+ provisionalLoadCallback(); >+} >+ > > void ViewGestureController::didFirstVisuallyNonEmptyLayoutForMainFrame() > { >@@ -155,6 +161,8 @@ void ViewGestureController::didRestoreScrollPosition() > > void ViewGestureController::didReachMainFrameLoadTerminalState() > { >+ m_provisionalLoadCallback = nullptr; >+ > if (!m_snapshotRemovalTracker.eventOccurred(SnapshotRemovalTracker::MainFrameLoad)) > return; > >diff --git a/Source/WebKit/UIProcess/Cocoa/ViewGestureController.h b/Source/WebKit/UIProcess/Cocoa/ViewGestureController.h >index a713a34f5f5..1a80494c681 100644 >--- a/Source/WebKit/UIProcess/Cocoa/ViewGestureController.h >+++ b/Source/WebKit/UIProcess/Cocoa/ViewGestureController.h >@@ -122,6 +122,7 @@ public: > > WebCore::Color backgroundColorForCurrentSnapshot() const { return m_backgroundColorForCurrentSnapshot; } > >+ void didStartProvisionalLoadForMainFrame(); > void didFinishLoadForMainFrame() { didReachMainFrameLoadTerminalState(); } > void didFailLoadForMainFrame() { didReachMainFrameLoadTerminalState(); } > void didFirstVisuallyNonEmptyLayoutForMainFrame(); >@@ -295,6 +296,7 @@ private: > uint64_t m_snapshotRemovalTargetRenderTreeSize { 0 }; > #endif > >+ WTF::Function<void()> m_provisionalLoadCallback; > SnapshotRemovalTracker m_snapshotRemovalTracker; > }; > >diff --git a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >index 6679a44bfe9..8cddc5413d5 100644 >--- a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >+++ b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >@@ -245,6 +245,7 @@ void PageClientImpl::decidePolicyForGeolocationPermissionRequest(WebFrameProxy& > > void PageClientImpl::didStartProvisionalLoadForMainFrame() > { >+ [m_webView _didStartProvisionalLoadForMainFrame]; > [m_webView _hidePasswordView]; > } > >diff --git a/Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm b/Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm >index 4b97e32a8c8..e324cc485f1 100644 >--- a/Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm >+++ b/Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm >@@ -296,27 +296,29 @@ void ViewGestureController::endSwipeGesture(WebBackForwardListItem* targetItem, > > m_webPageProxyForBackForwardListForCurrentSwipe->goToBackForwardItem(*targetItem); > >- if (auto drawingArea = m_webPageProxy.drawingArea()) { >- uint64_t pageID = m_webPageProxy.pageID(); >- GestureID gestureID = m_currentGestureID; >- drawingArea->dispatchAfterEnsuringDrawing([pageID, gestureID] (CallbackBase::Error error) { >- if (auto gestureController = controllerForGesture(pageID, gestureID)) >- gestureController->willCommitPostSwipeTransitionLayerTree(error == CallbackBase::Error::None); >+ m_provisionalLoadCallback = [this] { >+ if (auto drawingArea = m_webPageProxy.drawingArea()) { >+ uint64_t pageID = m_webPageProxy.pageID(); >+ GestureID gestureID = m_currentGestureID; >+ drawingArea->dispatchAfterEnsuringDrawing([pageID, gestureID] (CallbackBase::Error error) { >+ if (auto gestureController = controllerForGesture(pageID, gestureID)) >+ gestureController->willCommitPostSwipeTransitionLayerTree(error == CallbackBase::Error::None); >+ }); >+ drawingArea->hideContentUntilPendingUpdate(); >+ } else { >+ removeSwipeSnapshot(); >+ return; >+ } >+ >+ // FIXME: Should we wait for VisuallyNonEmptyLayout like we do on Mac? >+ m_snapshotRemovalTracker.start(SnapshotRemovalTracker::RenderTreeSizeThreshold >+ | SnapshotRemovalTracker::RepaintAfterNavigation >+ | SnapshotRemovalTracker::MainFrameLoad >+ | SnapshotRemovalTracker::SubresourceLoads >+ | SnapshotRemovalTracker::ScrollPositionRestoration, [this] { >+ this->removeSwipeSnapshot(); > }); >- drawingArea->hideContentUntilPendingUpdate(); >- } else { >- removeSwipeSnapshot(); >- return; >- } >- >- // FIXME: Should we wait for VisuallyNonEmptyLayout like we do on Mac? >- m_snapshotRemovalTracker.start(SnapshotRemovalTracker::RenderTreeSizeThreshold >- | SnapshotRemovalTracker::RepaintAfterNavigation >- | SnapshotRemovalTracker::MainFrameLoad >- | SnapshotRemovalTracker::SubresourceLoads >- | SnapshotRemovalTracker::ScrollPositionRestoration, [this] { >- this->removeSwipeSnapshot(); >- }); >+ }; > > if (ViewSnapshot* snapshot = targetItem->snapshot()) { > m_backgroundColorForCurrentSnapshot = snapshot->backgroundColor(); >diff --git a/Source/WebKit/UIProcess/mac/PageClientImplMac.h b/Source/WebKit/UIProcess/mac/PageClientImplMac.h >index ed923b8cb2c..7f8301b51a5 100644 >--- a/Source/WebKit/UIProcess/mac/PageClientImplMac.h >+++ b/Source/WebKit/UIProcess/mac/PageClientImplMac.h >@@ -205,6 +205,7 @@ private: > NSView *activeView() const; > NSWindow *activeWindow() const; > >+ void didStartProvisionalLoadForMainFrame() override; > void didFirstVisuallyNonEmptyLayoutForMainFrame() override; > void didFinishLoadForMainFrame() override; > void didFailLoadForMainFrame() override; >diff --git a/Source/WebKit/UIProcess/mac/PageClientImplMac.mm b/Source/WebKit/UIProcess/mac/PageClientImplMac.mm >index 1eb779ffe38..549d7a3d45a 100644 >--- a/Source/WebKit/UIProcess/mac/PageClientImplMac.mm >+++ b/Source/WebKit/UIProcess/mac/PageClientImplMac.mm >@@ -755,6 +755,12 @@ void PageClientImpl::didRemoveNavigationGestureSnapshot() > #endif > } > >+void PageClientImpl::didStartProvisionalLoadForMainFrame() >+{ >+ if (auto gestureController = m_impl->gestureController()) >+ gestureController->didStartProvisionalLoadForMainFrame(); >+} >+ > void PageClientImpl::didFirstVisuallyNonEmptyLayoutForMainFrame() > { > if (auto gestureController = m_impl->gestureController()) >diff --git a/Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm b/Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm >index e4c191c3d09..df9c5a8f72b 100644 >--- a/Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm >+++ b/Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm >@@ -743,13 +743,15 @@ void ViewGestureController::endSwipeGesture(WebBackForwardListItem* targetItem, > m_webPageProxy.navigationGestureDidEnd(true, *targetItem); > m_webPageProxy.goToBackForwardItem(*targetItem); > >- SnapshotRemovalTracker::Events desiredEvents = SnapshotRemovalTracker::VisuallyNonEmptyLayout >- | SnapshotRemovalTracker::MainFrameLoad >- | SnapshotRemovalTracker::SubresourceLoads >- | SnapshotRemovalTracker::ScrollPositionRestoration; >- if (renderTreeSize) >- desiredEvents |= SnapshotRemovalTracker::RenderTreeSizeThreshold; >- m_snapshotRemovalTracker.start(desiredEvents, [this] { this->forceRepaintIfNeeded(); }); >+ m_provisionalLoadCallback = [this, renderTreeSize] { >+ SnapshotRemovalTracker::Events desiredEvents = SnapshotRemovalTracker::VisuallyNonEmptyLayout >+ | SnapshotRemovalTracker::MainFrameLoad >+ | SnapshotRemovalTracker::SubresourceLoads >+ | SnapshotRemovalTracker::ScrollPositionRestoration; >+ if (renderTreeSize) >+ desiredEvents |= SnapshotRemovalTracker::RenderTreeSizeThreshold; >+ m_snapshotRemovalTracker.start(desiredEvents, [this] { this->forceRepaintIfNeeded(); }); >+ }; > > // FIXME: Like on iOS, we should ensure that even if one of the timeouts fires, > // we never show the old page content, instead showing the snapshot background color.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186168
:
341708
|
341709
|
341721
|
341767
|
341772
|
341774
|
341775