[Cocoa] First scroll gesture in pinned, non-rubber-banding WKWebView may fail to...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Aug 2018 19:51:22 +0000 (19:51 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Aug 2018 19:51:22 +0000 (19:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188894
<rdar://problem/43651434>

Reviewed by Tim Horton.

* WebProcess/WebPage/EventDispatcher.cpp:
(WebKit::EventDispatcher::wheelEvent): Set the rubber-band state on the ScrollingTree
  synchronously rather than dispatching doing that to the scrolling thread. This is safe to
  do because ScrollingTree synchrnoizes access to the rubber-band state with an internal
  mutex.

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

Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/EventDispatcher.cpp

index 371fa02..05f372a 100644 (file)
@@ -1,3 +1,17 @@
+2018-08-23  Dan Bernstein  <mitz@apple.com>
+
+        [Cocoa] First scroll gesture in pinned, non-rubber-banding WKWebView may fail to initiate back/forward swipe
+        https://bugs.webkit.org/show_bug.cgi?id=188894
+        <rdar://problem/43651434>
+
+        Reviewed by Tim Horton.
+
+        * WebProcess/WebPage/EventDispatcher.cpp:
+        (WebKit::EventDispatcher::wheelEvent): Set the rubber-band state on the ScrollingTree
+          synchronously rather than dispatching doing that to the scrolling thread. This is safe to
+          do because ScrollingTree synchrnoizes access to the rubber-band state with an internal
+          mutex.
+
 2018-08-23  Youenn Fablet  <youenn@apple.com>
 
         self.isSecureContext undefined in Service Worker
index a10957d..76c4826 100644 (file)
@@ -119,11 +119,8 @@ void EventDispatcher::wheelEvent(uint64_t pageID, const WebWheelEvent& wheelEven
         // WebCore should always know the current state and know when it changes so the
         // scrolling tree can be notified.
         // We only need to do this at the beginning of the gesture.
-        if (platformWheelEvent.phase() == PlatformWheelEventPhaseBegan) {
-            ScrollingThread::dispatch([scrollingTree, canRubberBandAtLeft, canRubberBandAtRight, canRubberBandAtTop, canRubberBandAtBottom] {
-                scrollingTree->setCanRubberBandState(canRubberBandAtLeft, canRubberBandAtRight, canRubberBandAtTop, canRubberBandAtBottom);
-            });
-        }
+        if (platformWheelEvent.phase() == PlatformWheelEventPhaseBegan)
+            scrollingTree->setCanRubberBandState(canRubberBandAtLeft, canRubberBandAtRight, canRubberBandAtTop, canRubberBandAtBottom);
 
         ScrollingTree::EventResult result = scrollingTree->tryToHandleWheelEvent(platformWheelEvent);