| Index: Source/web/WebViewImpl.cpp
|
| diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
|
| index 9aa8460eca54bde59d3122c7b2205fa1d39ed686..18d6939011cee586b8b011d77289778ce0b4768a 100644
|
| --- a/Source/web/WebViewImpl.cpp
|
| +++ b/Source/web/WebViewImpl.cpp
|
| @@ -72,6 +72,7 @@
|
| #include "core/page/DragData.h"
|
| #include "core/page/DragSession.h"
|
| #include "core/page/EventHandler.h"
|
| +#include "core/page/EventWithHitTestResults.h"
|
| #include "core/page/FocusController.h"
|
| #include "core/page/FrameTree.h"
|
| #include "core/page/InjectedStyleSheets.h"
|
| @@ -671,49 +672,15 @@
|
|
|
| PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event);
|
|
|
| - // Special handling for double tap and scroll events as we don't want to
|
| - // hit test for them.
|
| - switch (event.type) {
|
| - case WebInputEvent::GestureDoubleTap:
|
| - if (m_webSettings->doubleTapToZoomEnabled() && minimumPageScaleFactor() != maximumPageScaleFactor()) {
|
| - m_client->cancelScheduledContentIntents();
|
| - animateDoubleTapZoom(platformEvent.position());
|
| - }
|
| - // GestureDoubleTap is currently only used by Android for zooming. For WebCore,
|
| - // GestureTap with tap count = 2 is used instead. So we drop GestureDoubleTap here.
|
| - eventSwallowed = true;
|
| - m_client->didHandleGestureEvent(event, eventCancelled);
|
| - return eventSwallowed;
|
| - case WebInputEvent::GestureScrollBegin:
|
| - case WebInputEvent::GesturePinchBegin:
|
| - m_client->cancelScheduledContentIntents();
|
| - case WebInputEvent::GestureScrollEnd:
|
| - case WebInputEvent::GestureScrollUpdate:
|
| - case WebInputEvent::GestureScrollUpdateWithoutPropagation:
|
| - case WebInputEvent::GesturePinchEnd:
|
| - case WebInputEvent::GesturePinchUpdate:
|
| - case WebInputEvent::GestureFlingStart:
|
| - // Scrolling-related gesture events invoke EventHandler recursively for each frame down
|
| - // the chain, doing a single-frame hit-test per frame. This matches handleWheelEvent.
|
| - // Perhaps we could simplify things by rewriting scroll handling to work inner frame
|
| - // out, and then unify with other gesture events.
|
| - eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureScrollEvent(platformEvent);
|
| - m_client->didHandleGestureEvent(event, eventCancelled);
|
| - return eventSwallowed;
|
| - default:
|
| - break;
|
| - }
|
| -
|
| - // Hit test across all frames and do touch adjustment as necessary for the event type.
|
| - GestureEventWithHitTestResults targetedEvent =
|
| - m_page->deprecatedLocalMainFrame()->eventHandler().targetGestureEvent(platformEvent);
|
| + // FIXME: Remove redundant hit tests by pushing the call to EventHandler::targetGestureEvent
|
| + // up to this point and pass GestureEventWithHitTestResults around.
|
|
|
| // Handle link highlighting outside the main switch to avoid getting lost in the
|
| // complicated set of cases handled below.
|
| switch (event.type) {
|
| case WebInputEvent::GestureShowPress:
|
| // Queue a highlight animation, then hand off to regular handler.
|
| - enableTapHighlightAtPoint(targetedEvent);
|
| + enableTapHighlightAtPoint(platformEvent);
|
| break;
|
| case WebInputEvent::GestureTapCancel:
|
| case WebInputEvent::GestureTap:
|
| @@ -728,8 +695,7 @@
|
| switch (event.type) {
|
| case WebInputEvent::GestureTap: {
|
| m_client->cancelScheduledContentIntents();
|
| - // FIXME: Use targeted event here and save another hit test.
|
| - if (detectContentOnTouch(targetedEvent.event().position())) {
|
| + if (detectContentOnTouch(platformEvent.position())) {
|
| eventSwallowed = true;
|
| break;
|
| }
|
| @@ -765,7 +731,7 @@
|
| }
|
| }
|
|
|
| - eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureEvent(targetedEvent);
|
| + eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureEvent(platformEvent);
|
|
|
| if (m_selectPopup && m_selectPopup == selectPopup) {
|
| // That tap triggered a select popup which is the same as the one that
|
| @@ -786,17 +752,38 @@
|
| m_client->cancelScheduledContentIntents();
|
| m_page->contextMenuController().clearContextMenu();
|
| m_contextMenuAllowed = true;
|
| - eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureEvent(targetedEvent);
|
| + eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureEvent(platformEvent);
|
| m_contextMenuAllowed = false;
|
|
|
| break;
|
| }
|
| - case WebInputEvent::GestureShowPress:
|
| + case WebInputEvent::GestureShowPress: {
|
| + m_client->cancelScheduledContentIntents();
|
| + eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureEvent(platformEvent);
|
| + break;
|
| + }
|
| + case WebInputEvent::GestureDoubleTap:
|
| + if (m_webSettings->doubleTapToZoomEnabled() && minimumPageScaleFactor() != maximumPageScaleFactor()) {
|
| + m_client->cancelScheduledContentIntents();
|
| + animateDoubleTapZoom(platformEvent.position());
|
| + }
|
| + // GestureDoubleTap is currently only used by Android for zooming. For WebCore,
|
| + // GestureTap with tap count = 2 is used instead. So we drop GestureDoubleTap here.
|
| + eventSwallowed = true;
|
| + break;
|
| + case WebInputEvent::GestureScrollBegin:
|
| + case WebInputEvent::GesturePinchBegin:
|
| m_client->cancelScheduledContentIntents();
|
| case WebInputEvent::GestureTapDown:
|
| + case WebInputEvent::GestureScrollEnd:
|
| + case WebInputEvent::GestureScrollUpdate:
|
| + case WebInputEvent::GestureScrollUpdateWithoutPropagation:
|
| case WebInputEvent::GestureTapCancel:
|
| - case WebInputEvent::GestureTapUnconfirmed: {
|
| - eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureEvent(targetedEvent);
|
| + case WebInputEvent::GestureTapUnconfirmed:
|
| + case WebInputEvent::GesturePinchEnd:
|
| + case WebInputEvent::GesturePinchUpdate:
|
| + case WebInputEvent::GestureFlingStart: {
|
| + eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureEvent(platformEvent);
|
| break;
|
| }
|
| default:
|
| @@ -1219,14 +1206,17 @@
|
| || (cursor == CURSOR_AUTO && frame->eventHandler().useHandCursor(node, node->isLink()));
|
| }
|
|
|
| -Node* WebViewImpl::bestTapNode(const GestureEventWithHitTestResults& targetedTapEvent)
|
| +Node* WebViewImpl::bestTapNode(const PlatformGestureEvent& tapEvent)
|
| {
|
| TRACE_EVENT0("input", "WebViewImpl::bestTapNode");
|
|
|
| if (!m_page || !m_page->mainFrame())
|
| return 0;
|
|
|
| - Node* bestTouchNode = targetedTapEvent.hitTestResult().innerNode();
|
| + // FIXME: Rely on earlier hit test instead of hit testing again.
|
| + GestureEventWithHitTestResults targetedEvent =
|
| + m_page->deprecatedLocalMainFrame()->eventHandler().targetGestureEvent(tapEvent, true);
|
| + Node* bestTouchNode = targetedEvent.hitTestResult().innerNode();
|
|
|
| // We might hit something like an image map that has no renderer on it
|
| // Walk up the tree until we have a node with an attached renderer
|
| @@ -1254,9 +1244,9 @@
|
| return bestTouchNode;
|
| }
|
|
|
| -void WebViewImpl::enableTapHighlightAtPoint(const GestureEventWithHitTestResults& targetedTapEvent)
|
| -{
|
| - Node* touchNode = bestTapNode(targetedTapEvent);
|
| +void WebViewImpl::enableTapHighlightAtPoint(const PlatformGestureEvent& tapEvent)
|
| +{
|
| + Node* touchNode = bestTapNode(tapEvent);
|
|
|
| WillBeHeapVector<RawPtrWillBeMember<Node> > highlightNodes;
|
| highlightNodes.append(touchNode);
|
|
|