- Revision
- 240493
- Author
- [email protected]
- Date
- 2019-01-25 12:20:17 -0800 (Fri, 25 Jan 2019)
Log Message
REGRESSION (PSON): After swipe back, first few attempts to swipe forward not recognized as swipe gestures
https://bugs.webkit.org/show_bug.cgi?id=193818
<rdar://problem/47456584>
Reviewed by Tim Horton.
We don't hit the RenderTreeSizeThreshold milestone to remove the snapshot and allow interaction because we request it
from a wrong process (the one we are leaving behind).
* UIProcess/Cocoa/ViewGestureController.cpp:
(WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
Request the RenderTreeSizeThreshold notification when the load has started and we know the process to use.
(WebKit::ViewGestureController::SnapshotRemovalTracker::hasOutstandingEvent):
* UIProcess/Cocoa/ViewGestureController.h:
(WebKit::ViewGestureController::SnapshotRemovalTracker::renderTreeSizeThreshold const):
(WebKit::ViewGestureController::SnapshotRemovalTracker::setRenderTreeSizeThreshold):
* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::endSwipeGesture):
Don't request immediately, save the threshold to SnapshotRemovalTracker.
(WebKit::ViewGestureController::requestRenderTreeSizeNotificationIfNeeded):
Do the request to the right process.
* WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
(WebKit::ViewGestureGeometryCollector::setRenderTreeSizeNotificationThreshold):
Ensure we send the notification even if we reached the threshold before it was requested.
(WebKit::ViewGestureGeometryCollector::sendDidHitRenderTreeSizeThresholdIfNeeded):
(WebKit::ViewGestureGeometryCollector::mainFrameDidLayout):
* WebProcess/WebPage/ViewGestureGeometryCollector.h:
(WebKit::ViewGestureGeometryCollector::setRenderTreeSizeNotificationThreshold): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (240492 => 240493)
--- trunk/Source/WebKit/ChangeLog 2019-01-25 19:56:56 UTC (rev 240492)
+++ trunk/Source/WebKit/ChangeLog 2019-01-25 20:20:17 UTC (rev 240493)
@@ -1,3 +1,42 @@
+2019-01-25 Antti Koivisto <[email protected]>
+
+ REGRESSION (PSON): After swipe back, first few attempts to swipe forward not recognized as swipe gestures
+ https://bugs.webkit.org/show_bug.cgi?id=193818
+ <rdar://problem/47456584>
+
+ Reviewed by Tim Horton.
+
+ We don't hit the RenderTreeSizeThreshold milestone to remove the snapshot and allow interaction because we request it
+ from a wrong process (the one we are leaving behind).
+
+ * UIProcess/Cocoa/ViewGestureController.cpp:
+ (WebKit::ViewGestureController::didStartProvisionalLoadForMainFrame):
+
+ Request the RenderTreeSizeThreshold notification when the load has started and we know the process to use.
+
+ (WebKit::ViewGestureController::SnapshotRemovalTracker::hasOutstandingEvent):
+ * UIProcess/Cocoa/ViewGestureController.h:
+ (WebKit::ViewGestureController::SnapshotRemovalTracker::renderTreeSizeThreshold const):
+ (WebKit::ViewGestureController::SnapshotRemovalTracker::setRenderTreeSizeThreshold):
+ * UIProcess/mac/ViewGestureControllerMac.mm:
+ (WebKit::ViewGestureController::endSwipeGesture):
+
+ Don't request immediately, save the threshold to SnapshotRemovalTracker.
+
+ (WebKit::ViewGestureController::requestRenderTreeSizeNotificationIfNeeded):
+
+ Do the request to the right process.
+
+ * WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
+ (WebKit::ViewGestureGeometryCollector::setRenderTreeSizeNotificationThreshold):
+
+ Ensure we send the notification even if we reached the threshold before it was requested.
+
+ (WebKit::ViewGestureGeometryCollector::sendDidHitRenderTreeSizeThresholdIfNeeded):
+ (WebKit::ViewGestureGeometryCollector::mainFrameDidLayout):
+ * WebProcess/WebPage/ViewGestureGeometryCollector.h:
+ (WebKit::ViewGestureGeometryCollector::setRenderTreeSizeNotificationThreshold): Deleted.
+
2019-01-25 Wenson Hsieh <[email protected]>
[iOS] Rename some WebKit-internal functions and variables that reference "data interaction"
Modified: trunk/Source/WebKit/UIProcess/Cocoa/ViewGestureController.cpp (240492 => 240493)
--- trunk/Source/WebKit/UIProcess/Cocoa/ViewGestureController.cpp 2019-01-25 19:56:56 UTC (rev 240492)
+++ trunk/Source/WebKit/UIProcess/Cocoa/ViewGestureController.cpp 2019-01-25 20:20:17 UTC (rev 240493)
@@ -148,6 +148,9 @@
void ViewGestureController::didStartProvisionalLoadForMainFrame()
{
m_snapshotRemovalTracker.resume();
+#if PLATFORM(MAC)
+ requestRenderTreeSizeNotificationIfNeeded();
+#endif
if (auto provisionalLoadCallback = WTFMove(m_provisionalLoadCallback))
provisionalLoadCallback();
@@ -199,6 +202,9 @@
void ViewGestureController::didSameDocumentNavigationForMainFrame(SameDocumentNavigationType type)
{
m_snapshotRemovalTracker.resume();
+#if PLATFORM(MAC)
+ requestRenderTreeSizeNotificationIfNeeded();
+#endif
bool cancelledOutstandingEvent = false;
@@ -325,6 +331,11 @@
return stopWaitingForEvent(event, "wait for event cancelled: ");
}
+bool ViewGestureController::SnapshotRemovalTracker::hasOutstandingEvent(Event event)
+{
+ return m_outstandingEvents & event;
+}
+
void ViewGestureController::SnapshotRemovalTracker::fireRemovalCallbackIfPossible()
{
if (m_outstandingEvents) {
Modified: trunk/Source/WebKit/UIProcess/Cocoa/ViewGestureController.h (240492 => 240493)
--- trunk/Source/WebKit/UIProcess/Cocoa/ViewGestureController.h 2019-01-25 19:56:56 UTC (rev 240492)
+++ trunk/Source/WebKit/UIProcess/Cocoa/ViewGestureController.h 2019-01-25 20:20:17 UTC (rev 240493)
@@ -61,6 +61,7 @@
class ViewSnapshot;
class WebBackForwardListItem;
class WebPageProxy;
+class WebProcessProxy;
class ViewGestureController : private IPC::MessageReceiver {
WTF_MAKE_NONCOPYABLE(ViewGestureController);
@@ -179,9 +180,13 @@
bool eventOccurred(Events);
bool cancelOutstandingEvent(Events);
+ bool hasOutstandingEvent(Event);
void startWatchdog(Seconds);
+ uint64_t renderTreeSizeThreshold() const { return m_renderTreeSizeThreshold; }
+ void setRenderTreeSizeThreshold(uint64_t threshold) { m_renderTreeSizeThreshold = threshold; }
+
private:
static String eventsDescription(Events);
void log(const String&) const;
@@ -196,6 +201,8 @@
WTF::Function<void()> m_removalCallback;
MonotonicTime m_startTime;
+ uint64_t m_renderTreeSizeThreshold { 0 };
+
RunLoop::Timer<SnapshotRemovalTracker> m_watchdogTimer;
bool m_paused { true };
@@ -224,6 +231,8 @@
void forceRepaintIfNeeded();
+ void requestRenderTreeSizeNotificationIfNeeded();
+
class PendingSwipeTracker {
public:
PendingSwipeTracker(WebPageProxy&, ViewGestureController&);
Modified: trunk/Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm (240492 => 240493)
--- trunk/Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm 2019-01-25 19:56:56 UTC (rev 240492)
+++ trunk/Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm 2019-01-25 20:20:17 UTC (rev 240493)
@@ -33,6 +33,7 @@
#import "FrameLoadState.h"
#import "Logging.h"
#import "NativeWebWheelEvent.h"
+#import "ProvisionalPageProxy.h"
#import "ViewGestureControllerMessages.h"
#import "ViewGestureGeometryCollectorMessages.h"
#import "ViewSnapshotStore.h"
@@ -737,9 +738,8 @@
uint64_t renderTreeSize = 0;
if (ViewSnapshot* snapshot = targetItem->snapshot())
renderTreeSize = snapshot->renderTreeSize();
+ auto renderTreeSizeThreshold = renderTreeSize * swipeSnapshotRemovalRenderTreeSizeTargetFraction;
- m_webPageProxy.process().send(Messages::ViewGestureGeometryCollector::SetRenderTreeSizeNotificationThreshold(renderTreeSize * swipeSnapshotRemovalRenderTreeSizeTargetFraction), m_webPageProxy.pageID());
-
m_webPageProxy.navigationGestureDidEnd(true, *targetItem);
m_webPageProxy.goToBackForwardItem(*targetItem);
@@ -754,8 +754,12 @@
| SnapshotRemovalTracker::MainFrameLoad
| SnapshotRemovalTracker::SubresourceLoads
| SnapshotRemovalTracker::ScrollPositionRestoration;
- if (renderTreeSize)
+
+ if (renderTreeSizeThreshold) {
desiredEvents |= SnapshotRemovalTracker::RenderTreeSizeThreshold;
+ m_snapshotRemovalTracker.setRenderTreeSizeThreshold(renderTreeSizeThreshold);
+ }
+
m_snapshotRemovalTracker.start(desiredEvents, [this] { this->forceRepaintIfNeeded(); });
// FIXME: Like on iOS, we should ensure that even if one of the timeouts fires,
@@ -840,6 +844,17 @@
return false;
}
+void ViewGestureController::requestRenderTreeSizeNotificationIfNeeded()
+{
+ if (!m_snapshotRemovalTracker.hasOutstandingEvent(SnapshotRemovalTracker::RenderTreeSizeThreshold))
+ return;
+
+ auto& process = m_webPageProxy.provisionalPageProxy() ? m_webPageProxy.provisionalPageProxy()->process() : m_webPageProxy.process();
+ auto threshold = m_snapshotRemovalTracker.renderTreeSizeThreshold();
+
+ process.send(Messages::ViewGestureGeometryCollector::SetRenderTreeSizeNotificationThreshold(threshold), m_webPageProxy.pageID());
+}
+
} // namespace WebKit
#endif // PLATFORM(MAC)
Modified: trunk/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.cpp (240492 => 240493)
--- trunk/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.cpp 2019-01-25 19:56:56 UTC (rev 240492)
+++ trunk/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.cpp 2019-01-25 20:20:17 UTC (rev 240493)
@@ -253,6 +253,20 @@
bool frameHandlesMagnificationGesture = m_webPage.mainWebFrame()->handlesPageScaleGesture();
m_webPage.send(Messages::ViewGestureController::DidCollectGeometryForMagnificationGesture(visibleContentRect, frameHandlesMagnificationGesture));
}
+
+void ViewGestureGeometryCollector::setRenderTreeSizeNotificationThreshold(uint64_t size)
+{
+ m_renderTreeSizeNotificationThreshold = size;
+ sendDidHitRenderTreeSizeThresholdIfNeeded();
+}
+
+void ViewGestureGeometryCollector::sendDidHitRenderTreeSizeThresholdIfNeeded()
+{
+ if (m_renderTreeSizeNotificationThreshold && m_webPage.renderTreeSize() >= m_renderTreeSizeNotificationThreshold) {
+ m_webPage.send(Messages::ViewGestureController::DidHitRenderTreeSizeThreshold());
+ m_renderTreeSizeNotificationThreshold = 0;
+ }
+}
#endif
void ViewGestureGeometryCollector::mainFrameDidLayout()
@@ -261,10 +275,7 @@
m_cachedTextLegibilityScales.reset();
#endif
#if PLATFORM(MAC)
- if (m_renderTreeSizeNotificationThreshold && m_webPage.renderTreeSize() >= m_renderTreeSizeNotificationThreshold) {
- m_webPage.send(Messages::ViewGestureController::DidHitRenderTreeSizeThreshold());
- m_renderTreeSizeNotificationThreshold = 0;
- }
+ sendDidHitRenderTreeSizeThresholdIfNeeded();
#endif
}
Modified: trunk/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.h (240492 => 240493)
--- trunk/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.h 2019-01-25 19:56:56 UTC (rev 240492)
+++ trunk/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.h 2019-01-25 20:20:17 UTC (rev 240493)
@@ -55,9 +55,8 @@
#if PLATFORM(MAC)
void collectGeometryForMagnificationGesture();
- void setRenderTreeSizeNotificationThreshold(uint64_t size) { m_renderTreeSizeNotificationThreshold = size; }
-
- void renderTreeSizeNotificationTimerFired();
+ void setRenderTreeSizeNotificationThreshold(uint64_t);
+ void sendDidHitRenderTreeSizeThresholdIfNeeded();
#endif
void dispatchDidCollectGeometryForSmartMagnificationGesture(WebCore::FloatPoint origin, WebCore::FloatRect targetRect, WebCore::FloatRect visibleContentRect, bool fitEntireRect, double viewportMinimumScale, double viewportMaximumScale);