Title: [240571] branches/safari-607-branch/Source/WebKit
Revision
240571
Author
[email protected]
Date
2019-01-28 01:41:11 -0800 (Mon, 28 Jan 2019)

Log Message

Cherry-pick r240493. rdar://problem/47586905

    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.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240493 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-607-branch/Source/WebKit/ChangeLog (240570 => 240571)


--- branches/safari-607-branch/Source/WebKit/ChangeLog	2019-01-28 09:41:08 UTC (rev 240570)
+++ branches/safari-607-branch/Source/WebKit/ChangeLog	2019-01-28 09:41:11 UTC (rev 240571)
@@ -1,5 +1,88 @@
 2019-01-28  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r240493. rdar://problem/47586905
+
+    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.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240493 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-28  Babak Shafiei  <[email protected]>
+
         Cherry-pick r240490. rdar://problem/47586864
 
     WKWebView.goBack should reload if there is a safe browsing warning

Modified: branches/safari-607-branch/Source/WebKit/UIProcess/Cocoa/ViewGestureController.cpp (240570 => 240571)


--- branches/safari-607-branch/Source/WebKit/UIProcess/Cocoa/ViewGestureController.cpp	2019-01-28 09:41:08 UTC (rev 240570)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/Cocoa/ViewGestureController.cpp	2019-01-28 09:41:11 UTC (rev 240571)
@@ -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: branches/safari-607-branch/Source/WebKit/UIProcess/Cocoa/ViewGestureController.h (240570 => 240571)


--- branches/safari-607-branch/Source/WebKit/UIProcess/Cocoa/ViewGestureController.h	2019-01-28 09:41:08 UTC (rev 240570)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/Cocoa/ViewGestureController.h	2019-01-28 09:41:11 UTC (rev 240571)
@@ -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: branches/safari-607-branch/Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm (240570 => 240571)


--- branches/safari-607-branch/Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm	2019-01-28 09:41:08 UTC (rev 240570)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm	2019-01-28 09:41:11 UTC (rev 240571)
@@ -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);
 
@@ -747,8 +747,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,
@@ -833,6 +837,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: branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.cpp (240570 => 240571)


--- branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.cpp	2019-01-28 09:41:08 UTC (rev 240570)
+++ branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.cpp	2019-01-28 09:41:11 UTC (rev 240571)
@@ -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: branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.h (240570 => 240571)


--- branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.h	2019-01-28 09:41:08 UTC (rev 240570)
+++ branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.h	2019-01-28 09:41:11 UTC (rev 240571)
@@ -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);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to