Title: [163645] trunk/Source/WebKit2
- Revision
- 163645
- Author
- benja...@webkit.org
- Date
- 2014-02-07 14:01:38 -0800 (Fri, 07 Feb 2014)
Log Message
[WK2] Fitler touch events only based on touch start
https://bugs.webkit.org/show_bug.cgi?id=128354
Patch by Benjamin Poulain <bpoul...@apple.com> on 2014-02-07
Reviewed by Simon Fraser.
Touch Events track their target, we should not test the touch regions
again after a touch sequence starts.
This patch adds a boolean flag to know if we are sending events to the WebProcess
(m_isTrackingTouchEvents). The flag is updated every time a touch sequence starts.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::shouldStartTrackingTouchEvents):
(WebKit::WebPageProxy::handleTouchEvent):
* UIProcess/WebPageProxy.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (163644 => 163645)
--- trunk/Source/WebKit2/ChangeLog 2014-02-07 21:42:30 UTC (rev 163644)
+++ trunk/Source/WebKit2/ChangeLog 2014-02-07 22:01:38 UTC (rev 163645)
@@ -1,3 +1,22 @@
+2014-02-07 Benjamin Poulain <bpoul...@apple.com>
+
+ [WK2] Fitler touch events only based on touch start
+ https://bugs.webkit.org/show_bug.cgi?id=128354
+
+ Reviewed by Simon Fraser.
+
+ Touch Events track their target, we should not test the touch regions
+ again after a touch sequence starts.
+
+ This patch adds a boolean flag to know if we are sending events to the WebProcess
+ (m_isTrackingTouchEvents). The flag is updated every time a touch sequence starts.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::WebPageProxy):
+ (WebKit::WebPageProxy::shouldStartTrackingTouchEvents):
+ (WebKit::WebPageProxy::handleTouchEvent):
+ * UIProcess/WebPageProxy.h:
+
2014-02-07 Anders Carlsson <ander...@apple.com>
Simplify WebPreferences creation inside WebPageGroup
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (163644 => 163645)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2014-02-07 21:42:30 UTC (rev 163644)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2014-02-07 22:01:38 UTC (rev 163645)
@@ -297,6 +297,9 @@
, m_syncNavigationActionPolicyAction(PolicyUse)
, m_syncNavigationActionPolicyDownloadID(0)
, m_processingMouseMoveEvent(false)
+#if ENABLE(TOUCH_EVENTS)
+ , m_isTrackingTouchEvents(false)
+#endif
, m_pageID(pageID)
, m_session(session)
, m_isPageSuspended(false)
@@ -1382,34 +1385,35 @@
#endif // ENABLE(NETSCAPE_PLUGIN_API)
#if ENABLE(TOUCH_EVENTS)
+
+bool WebPageProxy::shouldStartTrackingTouchEvents(const WebTouchEvent& touchStartEvent) const
+{
#if ENABLE(ASYNC_SCROLLING)
-static bool anyTouchIsInNonFastScrollableRegion(RemoteScrollingCoordinatorProxy& scrollingCoordinator, const WebTouchEvent& event)
-{
- for (auto touchPoint : event.touchPoints()) {
- if (scrollingCoordinator.isPointInNonFastScrollableRegion(touchPoint.location()))
+ for (auto touchPoint : touchStartEvent.touchPoints()) {
+ if (m_scrollingCoordinatorProxy->isPointInNonFastScrollableRegion(touchPoint.location()))
return true;
}
return false;
+#endif // ENABLE(ASYNC_SCROLLING)
+ return true;
}
-#endif // ENABLE(ASYNC_SCROLLING)
void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent& event)
{
if (!isValid())
return;
+ if (event.type() == WebEvent::TouchStart)
+ m_isTrackingTouchEvents = shouldStartTrackingTouchEvents(event);
+
+ if (!m_isTrackingTouchEvents)
+ return;
+
// 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_isPageSuspended) {
-
-#if ENABLE(ASYNC_SCROLLING)
- // FIXME: we should only do this check for the start of a touch gesture.
- if (!anyTouchIsInNonFastScrollableRegion(*m_scrollingCoordinatorProxy, event))
- return;
-#endif
-
m_touchEventQueue.append(event);
m_process->responsivenessTimer()->start();
if (m_shouldSendEventsSynchronously) {
@@ -1429,6 +1433,9 @@
lastEvent.deferredTouchEvents.append(event);
}
}
+
+ if (event.type() == WebEvent::TouchEnd || event.type() == WebEvent::TouchCancel)
+ m_isTrackingTouchEvents = false;
}
#endif // ENABLE(TOUCH_EVENTS)
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (163644 => 163645)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2014-02-07 21:42:30 UTC (rev 163644)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2014-02-07 22:01:38 UTC (rev 163645)
@@ -1009,10 +1009,6 @@
void didChangeContentSize(const WebCore::IntSize&);
#endif
-#if ENABLE(TOUCH_EVENTS)
- void needTouchEvents(bool);
-#endif
-
#if ENABLE(INPUT_TYPE_COLOR)
void showColorPicker(const WebCore::Color& initialColor, const WebCore::IntRect&);
void didChooseColor(const WebCore::Color&);
@@ -1174,6 +1170,10 @@
void processNextQueuedWheelEvent();
void sendWheelEvent(const WebWheelEvent&);
+#if ENABLE(TOUCH_EVENTS)
+ bool shouldStartTrackingTouchEvents(const WebTouchEvent&) const;
+#endif
+
#if ENABLE(NETSCAPE_PLUGIN_API)
void findPlugin(const String& mimeType, uint32_t processType, const String& urlString, const String& frameURLString, const String& pageURLString, bool allowOnlyApplicationPlugins, uint64_t& pluginProcessToken, String& newMIMEType, uint32_t& pluginLoadPolicy, String& unavailabilityDescription);
#endif
@@ -1331,6 +1331,7 @@
OwnPtr<NativeWebMouseEvent> m_currentlyProcessedMouseDownEvent;
#if ENABLE(TOUCH_EVENTS)
+ bool m_isTrackingTouchEvents;
Deque<QueuedTouchEvents> m_touchEventQueue;
#endif
#if ENABLE(INPUT_TYPE_COLOR)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes