Title: [163516] trunk/Source
Revision
163516
Author
[email protected]
Date
2014-02-05 22:55:20 -0800 (Wed, 05 Feb 2014)

Log Message

Transfer the non-fast-scrollable region to the UI process for iOS
https://bugs.webkit.org/show_bug.cgi?id=128293

Reviewed by Benjamin Poulain.

Source/WebCore:

Two main changes to support sending the non-fast scrollable region
to the UI process for iOS:

1. Add ScrollingCoordinator::frameViewNonFastScrollableRegionChanged(),
which is called when we've updated the touch event region (this can happen
independenly of layout). When called we just scheduled a scrolling tree
commit with the new region.

2. Avoid thinking that we have a new root node with every remote scrolling
transaction. This was a side-effect of reconstructing the scrolling state
tree in the UI process, and caused us to try to grab a nonFastScrollableRegion
from a node which never had one set.

* WebCore.exp.in:
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged):
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::computeNonFastScrollableRegion):
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::frameViewNonFastScrollableRegionChanged):
* page/scrolling/ScrollingStateTree.h:
(WebCore::ScrollingStateTree::setHasNewRootStateNode):
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::commitNewTreeState):
(WebCore::ScrollingTree::isPointInNonFastScrollableRegion):
* page/scrolling/ScrollingTree.h:

Source/WebKit2:

Two main changes to support sending the non-fast scrollable region
to the UI process for iOS:

1. Add ScrollingCoordinator::frameViewNonFastScrollableRegionChanged(),
which is called when we've updated the touch event region (this can happen
independenly of layout). When called we just scheduled a scrolling tree
commit with the new region.

2. Avoid thinking that we have a new root node with every remote scrolling
transaction. This was a side-effect of reconstructing the scrolling state
tree in the UI process, and caused us to try to grab a nonFastScrollableRegion
from a node which never had one set.

Now that we have the non-fast scrollable region in the UI process, we can
use it to avoid sending sync messages to the web process.

* Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
(ArgumentCoder<ScrollingStateScrollingNode>::encode): Encode hasNewRootNode.
(ArgumentCoder<ScrollingStateScrollingNode>::decode): Decode hasNewRootNode and set it on
the state tree.
(WebKit::RemoteScrollingCoordinatorTransaction::encode): Encode the nonFastScrollableRegion
now that we can encode Regions.
(WebKit::RemoteScrollingCoordinatorTransaction::decode): Decode the nonFastScrollableRegion
now that we can decode Regions.
* UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::isPointInNonFastScrollableRegion):
* UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleTouchEvent): If we're not in the non-fast scrollable region,
don't both sending touch events to the web process.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (163515 => 163516)


--- trunk/Source/WebCore/ChangeLog	2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebCore/ChangeLog	2014-02-06 06:55:20 UTC (rev 163516)
@@ -1,3 +1,38 @@
+2014-02-05  Simon Fraser  <[email protected]>
+
+        Transfer the non-fast-scrollable region to the UI process for iOS
+        https://bugs.webkit.org/show_bug.cgi?id=128293
+
+        Reviewed by Benjamin Poulain.
+
+        Two main changes to support sending the non-fast scrollable region
+        to the UI process for iOS:
+        
+        1. Add ScrollingCoordinator::frameViewNonFastScrollableRegionChanged(),
+        which is called when we've updated the touch event region (this can happen
+        independenly of layout). When called we just scheduled a scrolling tree
+        commit with the new region.
+        
+        2. Avoid thinking that we have a new root node with every remote scrolling
+        transaction. This was a side-effect of reconstructing the scrolling state
+        tree in the UI process, and caused us to try to grab a nonFastScrollableRegion
+        from a node which never had one set.
+
+        * WebCore.exp.in:
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged):
+        * page/scrolling/AsyncScrollingCoordinator.h:
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::ScrollingCoordinator::computeNonFastScrollableRegion):
+        * page/scrolling/ScrollingCoordinator.h:
+        (WebCore::ScrollingCoordinator::frameViewNonFastScrollableRegionChanged):
+        * page/scrolling/ScrollingStateTree.h:
+        (WebCore::ScrollingStateTree::setHasNewRootStateNode):
+        * page/scrolling/ScrollingTree.cpp:
+        (WebCore::ScrollingTree::commitNewTreeState):
+        (WebCore::ScrollingTree::isPointInNonFastScrollableRegion):
+        * page/scrolling/ScrollingTree.h:
+
 2014-02-05  Benjamin Poulain  <[email protected]>
 
         [iOS] Synchronize the WKContentView and UIScrollView updates with the tiles being commited

Modified: trunk/Source/WebCore/WebCore.exp.in (163515 => 163516)


--- trunk/Source/WebCore/WebCore.exp.in	2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-02-06 06:55:20 UTC (rev 163516)
@@ -1129,6 +1129,8 @@
 __ZN7WebCore6Editor7commandERKN3WTF6StringE
 __ZN7WebCore6Editor7outdentEv
 __ZN7WebCore6JSNode6s_infoE
+__ZN7WebCore6Region21updateBoundsFromShapeEv
+__ZNK7WebCore6Region5Shape7isValidEv
 __ZN7WebCore6Region5uniteERKS0_
 __ZN7WebCore6Region8subtractERKS0_
 __ZN7WebCore6Region9intersectERKS0_
@@ -2993,6 +2995,7 @@
 __ZN7WebCore13ScrollingTree18commitNewTreeStateEN3WTF10PassOwnPtrINS_18ScrollingStateTreeEEE
 __ZN7WebCore13ScrollingTree21setCanRubberBandStateEbbbb
 __ZN7WebCore13ScrollingTree31willWheelEventStartSwipeGestureERKNS_18PlatformWheelEventE
+__ZN7WebCore13ScrollingTree32isPointInNonFastScrollableRegionENS_8IntPointE
 __ZN7WebCore13ScrollingTree35shouldHandleWheelEventSynchronouslyERKNS_18PlatformWheelEventE
 __ZN7WebCore13ScrollingTree37setScrollingPerformanceLoggingEnabledEb
 __ZN7WebCore13ScrollingTree42scrollPositionChangedViaDelegatedScrollingEyRKNS_8IntPointE
@@ -3026,6 +3029,7 @@
 __ZN7WebCore25AsyncScrollingCoordinator29updateViewportConstrainedNodeEyRKNS_19ViewportConstraintsEPNS_13GraphicsLayerE
 __ZN7WebCore25AsyncScrollingCoordinator30setSynchronousScrollingReasonsEj
 __ZN7WebCore25AsyncScrollingCoordinator37scrollableAreaScrollbarLayerDidChangeEPNS_14ScrollableAreaENS_20ScrollbarOrientationE
+__ZN7WebCore25AsyncScrollingCoordinator39frameViewNonFastScrollableRegionChangedEPNS_9FrameViewE
 __ZN7WebCore25AsyncScrollingCoordinator43recomputeWheelEventHandlerCountForFrameViewEPNS_9FrameViewE
 __ZN7WebCore25AsyncScrollingCoordinator44scheduleUpdateScrollPositionAfterAsyncScrollEyRKNS_10FloatPointEbNS_31SetOrSyncScrollingLayerPositionE
 __ZN7WebCore25AsyncScrollingCoordinatorC2EPNS_4PageE
@@ -3041,6 +3045,7 @@
 __ZN7WebCore27ScrollingStateScrollingNode20setTotalContentsSizeERKNS_7IntSizeE
 __ZN7WebCore27ScrollingStateScrollingNode24setCounterScrollingLayerERKNS_19LayerRepresentationE
 __ZN7WebCore27ScrollingStateScrollingNode25setWheelEventHandlerCountEj
+__ZN7WebCore27ScrollingStateScrollingNode26setNonFastScrollableRegionERKNS_6RegionE
 __ZN7WebCore27ScrollingStateScrollingNode27setScrollableAreaParametersERKNS_24ScrollableAreaParametersE
 __ZN7WebCore27ScrollingStateScrollingNode30setSynchronousScrollingReasonsEj
 __ZN7WebCore27ScrollingStateScrollingNode33setScrollBehaviorForFixedElementsENS_30ScrollBehaviorForFixedElementsE

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (163515 => 163516)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2014-02-06 06:55:20 UTC (rev 163516)
@@ -105,6 +105,15 @@
     node->setScrollableAreaParameters(scrollParameters);
 }
 
+void AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged(FrameView*)
+{
+    if (!m_scrollingStateTree->rootStateNode())
+        return;
+
+    Region nonFastScrollableRegion = computeNonFastScrollableRegion(&m_page->mainFrame(), IntPoint());
+    setNonFastScrollableRegionForNode(nonFastScrollableRegion, m_scrollingStateTree->rootStateNode());
+}
+
 void AsyncScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView)
 {
     ASSERT(isMainThread());

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (163515 => 163516)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2014-02-06 06:55:20 UTC (rev 163516)
@@ -78,6 +78,7 @@
 
     virtual void frameViewLayoutUpdated(FrameView*) override;
     virtual void frameViewRootLayerDidChange(FrameView*) override;
+    virtual void frameViewNonFastScrollableRegionChanged(FrameView*) override;
 
     virtual bool requestScrollPositionUpdate(FrameView*, const IntPoint&) override;
 

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (163515 => 163516)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2014-02-06 06:55:20 UTC (rev 163516)
@@ -94,6 +94,24 @@
 
 Region ScrollingCoordinator::computeNonFastScrollableRegion(const Frame* frame, const IntPoint& frameLocation) const
 {
+#if PLATFORM(IOS)
+    // On iOS, we use nonFastScrollableRegion to represent the region covered by elements with touch event handlers.
+    ASSERT(frame->isMainFrame());
+    UNUSED_PARAM(frameLocation);
+
+    Document* document = frame->document();
+    if (!document)
+        return Region();
+
+    Vector<IntRect> touchRects;
+    document->getTouchRects(touchRects);
+    
+    Region touchRegion;
+    for (auto rect : touchRects)
+        touchRegion.unite(rect);
+
+    return touchRegion;
+#else
     Region nonFastScrollableRegion;
     FrameView* frameView = frame->view();
     if (!frameView)
@@ -126,6 +144,7 @@
         nonFastScrollableRegion.unite(computeNonFastScrollableRegion(subframe, offset));
 
     return nonFastScrollableRegion;
+#endif
 }
 
 unsigned ScrollingCoordinator::computeCurrentWheelEventHandlerCount()

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (163515 => 163516)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2014-02-06 06:55:20 UTC (rev 163516)
@@ -125,6 +125,9 @@
     // Should be called whenever the set of fixed objects changes.
     void frameViewFixedObjectsDidChange(FrameView*);
 
+    // Called whenever the non-fast scrollable region changes for reasons other than layout.
+    virtual void frameViewNonFastScrollableRegionChanged(FrameView*) { }
+
     // Should be called whenever the root layer for the given frame view changes.
     virtual void frameViewRootLayerDidChange(FrameView*);
 

Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h (163515 => 163516)


--- trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h	2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h	2014-02-06 06:55:20 UTC (rev 163516)
@@ -66,6 +66,7 @@
     bool hasChangedProperties() const { return m_hasChangedProperties; }
 
     bool hasNewRootStateNode() const { return m_hasNewRootStateNode; }
+    void setHasNewRootStateNode(bool hasNewRoot) { m_hasNewRootStateNode = hasNewRoot; }
     
     int nodeCount() const { return m_stateNodeMap.size(); }
 

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (163515 => 163516)


--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp	2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp	2014-02-06 06:55:20 UTC (rev 163516)
@@ -254,6 +254,13 @@
     m_mainFrameScrollPosition = position;
 }
 
+bool ScrollingTree::isPointInNonFastScrollableRegion(IntPoint p)
+{
+    MutexLocker lock(m_mutex);
+    
+    return m_nonFastScrollableRegion.contains(p);
+}
+
 bool ScrollingTree::isRubberBandInProgress()
 {
     MutexLocker lock(m_mutex);    

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (163515 => 163516)


--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h	2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h	2014-02-06 06:55:20 UTC (rev 163516)
@@ -76,6 +76,8 @@
     virtual void scrollingTreeNodeDidScroll(ScrollingNodeID, const FloatPoint& scrollPosition, SetOrSyncScrollingLayerPosition = SyncScrollingLayerPosition) = 0;
     FloatPoint mainFrameScrollPosition();
 
+    bool isPointInNonFastScrollableRegion(IntPoint);
+    
 #if PLATFORM(MAC) && !PLATFORM(IOS)
     virtual void handleWheelEventPhase(PlatformWheelEventPhase) = 0;
 #endif

Modified: trunk/Source/WebKit2/ChangeLog (163515 => 163516)


--- trunk/Source/WebKit2/ChangeLog	2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/ChangeLog	2014-02-06 06:55:20 UTC (rev 163516)
@@ -1,3 +1,41 @@
+2014-02-05  Simon Fraser  <[email protected]>
+
+        Transfer the non-fast-scrollable region to the UI process for iOS
+        https://bugs.webkit.org/show_bug.cgi?id=128293
+
+        Reviewed by Benjamin Poulain.
+
+        Two main changes to support sending the non-fast scrollable region
+        to the UI process for iOS:
+        
+        1. Add ScrollingCoordinator::frameViewNonFastScrollableRegionChanged(),
+        which is called when we've updated the touch event region (this can happen
+        independenly of layout). When called we just scheduled a scrolling tree
+        commit with the new region.
+        
+        2. Avoid thinking that we have a new root node with every remote scrolling
+        transaction. This was a side-effect of reconstructing the scrolling state
+        tree in the UI process, and caused us to try to grab a nonFastScrollableRegion
+        from a node which never had one set.
+        
+        Now that we have the non-fast scrollable region in the UI process, we can
+        use it to avoid sending sync messages to the web process.
+        
+        * Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
+        (ArgumentCoder<ScrollingStateScrollingNode>::encode): Encode hasNewRootNode.
+        (ArgumentCoder<ScrollingStateScrollingNode>::decode): Decode hasNewRootNode and set it on
+        the state tree.
+        (WebKit::RemoteScrollingCoordinatorTransaction::encode): Encode the nonFastScrollableRegion
+        now that we can encode Regions.
+        (WebKit::RemoteScrollingCoordinatorTransaction::decode): Decode the nonFastScrollableRegion
+        now that we can decode Regions.
+        * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
+        (WebKit::RemoteScrollingCoordinatorProxy::isPointInNonFastScrollableRegion):
+        * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::handleTouchEvent): If we're not in the non-fast scrollable region,
+        don't both sending touch events to the web process.
+
 2014-02-05  Benjamin Poulain  <[email protected]>
 
         [iOS] Synchronize the WKContentView and UIScrollView updates with the tiles being commited

Modified: trunk/Source/WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp (163515 => 163516)


--- trunk/Source/WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp	2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp	2014-02-06 06:55:20 UTC (rev 163516)
@@ -113,7 +113,7 @@
     SCROLLING_NODE_ENCODE(ScrollPosition, scrollPosition)
     SCROLLING_NODE_ENCODE(ScrollOrigin, scrollOrigin)
     SCROLLING_NODE_ENCODE(FrameScaleFactor, frameScaleFactor)
-//    SCROLLING_NODE_ENCODE(NonFastScrollableRegion, nonFastScrollableRegion) // FIXME: no encoder support for Region
+    SCROLLING_NODE_ENCODE(NonFastScrollableRegion, nonFastScrollableRegion)
     SCROLLING_NODE_ENCODE(WheelEventHandlerCount, wheelEventHandlerCount)
     SCROLLING_NODE_ENCODE(ReasonsForSynchronousScrolling, synchronousScrollingReasons)
     SCROLLING_NODE_ENCODE(ScrollableAreaParams, scrollableAreaParameters)
@@ -149,7 +149,7 @@
     SCROLLING_NODE_DECODE(ScrollPosition, FloatPoint, setScrollPosition);
     SCROLLING_NODE_DECODE(ScrollOrigin, IntPoint, setScrollOrigin);
     SCROLLING_NODE_DECODE(FrameScaleFactor, float, setFrameScaleFactor);
-//    SCROLLING_NODE_DECODE(NonFastScrollableRegion, Region, setNonFastScrollableRegion); // FIXME: no decoder support for Region.
+    SCROLLING_NODE_DECODE(NonFastScrollableRegion, Region, setNonFastScrollableRegion);
     SCROLLING_NODE_DECODE(WheelEventHandlerCount, int, setWheelEventHandlerCount);
     SCROLLING_NODE_DECODE(ReasonsForSynchronousScrolling, SynchronousScrollingReasons, setSynchronousScrollingReasons);
     SCROLLING_NODE_DECODE(ScrollableAreaParams, ScrollableAreaParameters, setScrollableAreaParameters);
@@ -236,6 +236,9 @@
 {
     int numNodes = m_scrollingStateTree ? m_scrollingStateTree->nodeCount() : 0;
     encoder << numNodes;
+    
+    bool hasNewRootNode = m_scrollingStateTree ? m_scrollingStateTree->hasNewRootStateNode() : false;
+    encoder << hasNewRootNode;
 
     if (m_scrollingStateTree) {
         if (const ScrollingStateNode* rootNode = m_scrollingStateTree->rootStateNode())
@@ -257,6 +260,10 @@
     if (!decoder.decode(numNodes))
         return false;
 
+    bool hasNewRootNode;
+    if (!decoder.decode(hasNewRootNode))
+        return false;
+    
     m_scrollingStateTree = ScrollingStateTree::create();
     
     for (int i = 0; i < numNodes; ++i) {
@@ -293,6 +300,8 @@
         }
     }
 
+    m_scrollingStateTree->setHasNewRootStateNode(hasNewRootNode);
+
     // Removed nodes
     Vector<ScrollingNodeID> removedNodes;
     if (!decoder.decode(removedNodes))

Modified: trunk/Source/WebKit2/Shared/ios/NativeWebTouchEventIOS.mm (163515 => 163516)


--- trunk/Source/WebKit2/Shared/ios/NativeWebTouchEventIOS.mm	2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/Shared/ios/NativeWebTouchEventIOS.mm	2014-02-06 06:55:20 UTC (rev 163516)
@@ -41,11 +41,11 @@
     case UIWebTouchEventTouchBegin:
         return WebEvent::TouchStart;
     case UIWebTouchEventTouchChange:
-        return WebEvent::TouchStart;
+        return WebEvent::TouchMove;
     case UIWebTouchEventTouchEnd:
-        return WebEvent::TouchStart;
+        return WebEvent::TouchEnd;
     case UIWebTouchEventTouchCancel:
-        return WebEvent::TouchStart;
+        return WebEvent::TouchCancel;
     }
 }
 

Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp (163515 => 163516)


--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp	2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp	2014-02-06 06:55:20 UTC (rev 163516)
@@ -129,6 +129,11 @@
     return result == ScrollingTree::DidHandleEvent; // FIXME: handle other values.
 }
 
+bool RemoteScrollingCoordinatorProxy::isPointInNonFastScrollableRegion(const WebCore::IntPoint& p) const
+{
+    return m_scrollingTree->isPointInNonFastScrollableRegion(p);
+}
+
 void RemoteScrollingCoordinatorProxy::scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID nodeID, const IntPoint& offset)
 {
     m_scrollingTree->scrollPositionChangedViaDelegatedScrolling(nodeID, offset);

Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h (163515 => 163516)


--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h	2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h	2014-02-06 06:55:20 UTC (rev 163516)
@@ -54,6 +54,8 @@
     // Inform the web process that the scroll position changed (called from the scrolling tree)
     void scrollPositionChanged(WebCore::ScrollingNodeID, const WebCore::FloatPoint& newScrollPosition);
 
+    bool isPointInNonFastScrollableRegion(const WebCore::IntPoint&) const;
+
     // Called externally when native views move around.
     void scrollPositionChangedViaDelegatedScrolling(WebCore::ScrollingNodeID, const WebCore::IntPoint&);
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (163515 => 163516)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-02-06 06:55:20 UTC (rev 163516)
@@ -291,9 +291,6 @@
     , m_syncNavigationActionPolicyAction(PolicyUse)
     , m_syncNavigationActionPolicyDownloadID(0)
     , m_processingMouseMoveEvent(false)
-#if ENABLE(TOUCH_EVENTS)
-    , m_needTouchEvents(false)
-#endif
     , m_pageID(pageID)
     , m_session(session)
     , m_isPageSuspended(false)
@@ -1376,6 +1373,16 @@
 #endif // ENABLE(NETSCAPE_PLUGIN_API)
 
 #if ENABLE(TOUCH_EVENTS)
+static bool anyTouchIsInNonFastScrollableRegion(RemoteScrollingCoordinatorProxy& scrollingCoordinator, const WebTouchEvent& event)
+{
+    for (auto touchPoint : event.touchPoints()) {
+        if (scrollingCoordinator.isPointInNonFastScrollableRegion(touchPoint.location()))
+            return true;
+    }
+
+    return false;
+}
+
 void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent& event)
 {
     if (!isValid())
@@ -1384,7 +1391,11 @@
     // If the page is suspended, which should be the case during panning, pinching
     // and animation on the page itself (kinetic scrolling, tap to zoom) etc, then
     // we do not send any of the events to the page even if is has listeners.
-    if (m_needTouchEvents && !m_isPageSuspended) {
+    if (!m_isPageSuspended) {
+        // FIXME: we should only do this check for the start of a touch gesture.
+        if (!anyTouchIsInNonFastScrollableRegion(*m_scrollingCoordinatorProxy, event))
+            return;
+
         m_touchEventQueue.append(event);
         m_process->responsivenessTimer()->start();
         if (m_shouldSendEventsSynchronously) {
@@ -2881,13 +2892,6 @@
 }
 #endif
 
-#if ENABLE(TOUCH_EVENTS)
-void WebPageProxy::needTouchEvents(bool needTouchEvents)
-{
-    m_needTouchEvents = needTouchEvents;
-}
-#endif
-
 #if ENABLE(INPUT_TYPE_COLOR)
 void WebPageProxy::showColorPicker(const WebCore::Color& initialColor, const IntRect& elementRect)
 {
@@ -3879,7 +3883,6 @@
     m_processingMouseMoveEvent = false;
 
 #if ENABLE(TOUCH_EVENTS)
-    m_needTouchEvents = false;
     m_touchEventQueue.clear();
 #endif
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (163515 => 163516)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-02-06 06:55:20 UTC (rev 163516)
@@ -1318,7 +1318,6 @@
     OwnPtr<NativeWebMouseEvent> m_currentlyProcessedMouseDownEvent;
 
 #if ENABLE(TOUCH_EVENTS)
-    bool m_needTouchEvents;
     Deque<QueuedTouchEvents> m_touchEventQueue;
 #endif
 #if ENABLE(INPUT_TYPE_COLOR)

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (163515 => 163516)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2014-02-06 06:55:20 UTC (rev 163516)
@@ -94,10 +94,6 @@
     DidChangeContentSize(WebCore::IntSize newSize)
 #endif
 
-#if ENABLE(TOUCH_EVENTS)
-    NeedTouchEvents(bool needTouchEvents)
-#endif
-
 #if ENABLE(INPUT_TYPE_COLOR)
     ShowColorPicker(WebCore::Color initialColor, WebCore::IntRect elementRect);
     SetColorPickerColor(WebCore::Color color);

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (163515 => 163516)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2014-02-06 06:55:20 UTC (rev 163516)
@@ -821,13 +821,6 @@
 }
 #endif
 
-#if ENABLE(TOUCH_EVENTS)
-void WebChromeClient::needTouchEvents(bool needTouchEvents)
-{
-    m_page->send(Messages::WebPageProxy::NeedTouchEvents(needTouchEvents));
-}
-#endif
-
 #if ENABLE(FULLSCREEN_API)
 bool WebChromeClient::supportsFullScreenForElement(const WebCore::Element*, bool withKeyboard)
 {

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (163515 => 163516)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2014-02-06 06:55:20 UTC (rev 163516)
@@ -230,7 +230,7 @@
 #endif
 
 #if ENABLE(TOUCH_EVENTS)
-    virtual void needTouchEvents(bool) override;
+    virtual void needTouchEvents(bool) override { }
 #endif
 
 #if PLATFORM(IOS)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to