Index: third_party/WebKit/Source/core/input/EventHandler.cpp |
diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp |
index 4f3ef35f25ce5701b9605ad659d2ba9dad8bca00..4705bf13a909107f836400cd18b92620af7d1458 100644 |
--- a/third_party/WebKit/Source/core/input/EventHandler.cpp |
+++ b/third_party/WebKit/Source/core/input/EventHandler.cpp |
@@ -87,7 +87,6 @@ |
#include "core/style/ComputedStyle.h" |
#include "core/style/CursorData.h" |
#include "core/svg/SVGDocumentExtensions.h" |
-#include "platform/PlatformGestureEvent.h" |
#include "platform/PlatformTouchEvent.h" |
#include "platform/PlatformWheelEvent.h" |
#include "platform/RuntimeEnabledFeatures.h" |
@@ -1336,7 +1335,7 @@ WebInputEventResult EventHandler::handleWheelEvent( |
} |
WebInputEventResult EventHandler::handleGestureEvent( |
- const PlatformGestureEvent& gestureEvent) { |
+ const WebGestureEvent& gestureEvent) { |
// Propagation to inner frames is handled below this function. |
ASSERT(m_frame == m_frame->localFrameRoot()); |
@@ -1371,7 +1370,7 @@ WebInputEventResult EventHandler::handleGestureEvent( |
// Update mouseout/leave/over/enter events before jumping directly to the |
// inner most frame. |
- if (targetedEvent.event().type() == PlatformEvent::GestureTap) |
+ if (targetedEvent.event().type == WebInputEvent::GestureTap) |
updateGestureTargetNodeForMouseEvent(targetedEvent); |
// Route to the correct frame. |
@@ -1389,7 +1388,7 @@ WebInputEventResult EventHandler::handleGestureEventInFrame( |
} |
WebInputEventResult EventHandler::handleGestureScrollEvent( |
- const PlatformGestureEvent& gestureEvent) { |
+ const WebGestureEvent& gestureEvent) { |
TRACE_EVENT0("input", "EventHandler::handleGestureScrollEvent"); |
if (!m_frame->host()) |
return WebInputEventResult::NotHandled; |
@@ -1398,10 +1397,9 @@ WebInputEventResult EventHandler::handleGestureScrollEvent( |
} |
WebInputEventResult EventHandler::handleGestureScrollEnd( |
- const PlatformGestureEvent& gestureEvent) { |
+ const WebGestureEvent& gestureEvent) { |
if (!m_frame->host()) |
return WebInputEventResult::NotHandled; |
- |
return m_scrollManager->handleGestureScrollEnd(gestureEvent); |
} |
@@ -1414,10 +1412,10 @@ bool EventHandler::isScrollbarHandlingGestures() const { |
} |
bool EventHandler::shouldApplyTouchAdjustment( |
- const PlatformGestureEvent& event) const { |
+ const WebGestureEvent& event) const { |
if (m_frame->settings() && !m_frame->settings()->touchAdjustmentEnabled()) |
return false; |
- return !event.area().isEmpty(); |
+ return !event.tapAreaInRootFrame().isEmpty(); |
} |
bool EventHandler::bestClickableNodeForHitTestResult( |
@@ -1622,13 +1620,14 @@ void EventHandler::updateGestureTargetNodeForMouseEvent( |
exitedFrameInDocument = nextExitedFrameInDocument; |
} |
- const PlatformGestureEvent& gestureEvent = targetedEvent.event(); |
- unsigned modifiers = gestureEvent.getModifiers(); |
+ const WebGestureEvent& gestureEvent = targetedEvent.event(); |
+ unsigned modifiers = gestureEvent.modifiers; |
PlatformMouseEvent fakeMouseMove( |
- gestureEvent.position(), gestureEvent.globalPosition(), |
- WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, |
+ gestureEvent, WebPointerProperties::Button::NoButton, |
+ PlatformEvent::MouseMoved, |
/* clickCount */ 0, static_cast<PlatformEvent::Modifiers>(modifiers), |
- PlatformMouseEvent::FromTouch, gestureEvent.timestamp(), |
+ PlatformMouseEvent::FromTouch, |
+ TimeTicks::FromSeconds(gestureEvent.timeStampSeconds), |
WebPointerProperties::PointerType::Mouse); |
// Update the mouseout/mouseleave event |
@@ -1654,7 +1653,7 @@ void EventHandler::updateGestureTargetNodeForMouseEvent( |
} |
GestureEventWithHitTestResults EventHandler::targetGestureEvent( |
- const PlatformGestureEvent& gestureEvent, |
+ const WebGestureEvent& gestureEvent, |
bool readOnly) { |
TRACE_EVENT0("input", "EventHandler::targetGestureEvent"); |
@@ -1663,12 +1662,12 @@ GestureEventWithHitTestResults EventHandler::targetGestureEvent( |
ASSERT(!gestureEvent.isScrollEvent()); |
HitTestRequest::HitTestRequestType hitType = |
- m_gestureManager->getHitTypeForGestureType(gestureEvent.type()); |
+ m_gestureManager->getHitTypeForGestureType(gestureEvent.type); |
TimeDelta activeInterval; |
bool shouldKeepActiveForMinInterval = false; |
if (readOnly) { |
hitType |= HitTestRequest::ReadOnly; |
- } else if (gestureEvent.type() == PlatformEvent::GestureTap) { |
+ } else if (gestureEvent.type == WebInputEvent::GestureTap) { |
// If the Tap is received very shortly after ShowPress, we want to |
// delay clearing of the active state so that it's visible to the user |
// for at least a couple of frames. |
@@ -1701,17 +1700,17 @@ GestureEventWithHitTestResults EventHandler::targetGestureEvent( |
} |
GestureEventWithHitTestResults EventHandler::hitTestResultForGestureEvent( |
- const PlatformGestureEvent& gestureEvent, |
+ const WebGestureEvent& gestureEvent, |
HitTestRequest::HitTestRequestType hitType) { |
// Perform the rect-based hit-test (or point-based if adjustment is disabled). |
// Note that we don't yet apply hover/active state here because we need to |
// resolve touch adjustment first so that we apply hover/active it to the |
// final adjusted node. |
- IntPoint hitTestPoint = |
- m_frame->view()->rootFrameToContents(gestureEvent.position()); |
+ IntPoint hitTestPoint = m_frame->view()->rootFrameToContents( |
+ flooredIntPoint(gestureEvent.positionInRootFrame())); |
LayoutSize padding; |
if (shouldApplyTouchAdjustment(gestureEvent)) { |
- padding = LayoutSize(gestureEvent.area()); |
+ padding = LayoutSize(gestureEvent.tapAreaInRootFrame()); |
if (!padding.isEmpty()) { |
padding.scale(1.f / 2); |
hitType |= HitTestRequest::ListBased; |
@@ -1722,7 +1721,7 @@ GestureEventWithHitTestResults EventHandler::hitTestResultForGestureEvent( |
// Adjust the location of the gesture to the most likely nearby node, as |
// appropriate for the type of event. |
- PlatformGestureEvent adjustedEvent = gestureEvent; |
+ WebGestureEvent adjustedEvent = gestureEvent; |
applyTouchAdjustment(&adjustedEvent, &hitTestResult); |
// Do a new hit-test at the (adjusted) gesture co-ordinates. This is necessary |
@@ -1736,8 +1735,8 @@ GestureEventWithHitTestResults EventHandler::hitTestResultForGestureEvent( |
if (!hitFrame) |
hitFrame = m_frame; |
hitTestResult = EventHandlingUtil::hitTestResultInFrame( |
- hitFrame, |
- hitFrame->view()->rootFrameToContents(adjustedEvent.position()), |
+ hitFrame, hitFrame->view()->rootFrameToContents( |
+ flooredIntPoint(adjustedEvent.positionInRootFrame())), |
(hitType | HitTestRequest::ReadOnly) & ~HitTestRequest::ListBased); |
} |
@@ -1749,25 +1748,25 @@ GestureEventWithHitTestResults EventHandler::hitTestResultForGestureEvent( |
return GestureEventWithHitTestResults(adjustedEvent, hitTestResult); |
} |
-void EventHandler::applyTouchAdjustment(PlatformGestureEvent* gestureEvent, |
+void EventHandler::applyTouchAdjustment(WebGestureEvent* gestureEvent, |
HitTestResult* hitTestResult) { |
if (!shouldApplyTouchAdjustment(*gestureEvent)) |
return; |
Node* adjustedNode = nullptr; |
- IntPoint adjustedPoint = gestureEvent->position(); |
+ IntPoint adjustedPoint = flooredIntPoint(gestureEvent->positionInRootFrame()); |
bool adjusted = false; |
- switch (gestureEvent->type()) { |
- case PlatformEvent::GestureTap: |
- case PlatformEvent::GestureTapUnconfirmed: |
- case PlatformEvent::GestureTapDown: |
- case PlatformEvent::GestureShowPress: |
+ switch (gestureEvent->type) { |
+ case WebInputEvent::GestureTap: |
+ case WebInputEvent::GestureTapUnconfirmed: |
+ case WebInputEvent::GestureTapDown: |
+ case WebInputEvent::GestureShowPress: |
adjusted = bestClickableNodeForHitTestResult(*hitTestResult, |
adjustedPoint, adjustedNode); |
majidvp
2016/12/15 17:40:45
UGH! The adjustedPoint here is actually an output
dtapuska
2016/12/15 21:29:38
Acknowledged.
|
break; |
- case PlatformEvent::GestureLongPress: |
- case PlatformEvent::GestureLongTap: |
- case PlatformEvent::GestureTwoFingerTap: |
+ case WebInputEvent::GestureLongPress: |
+ case WebInputEvent::GestureLongTap: |
+ case WebInputEvent::GestureTwoFingerTap: |
adjusted = bestContextMenuNodeForHitTestResult( |
*hitTestResult, adjustedPoint, adjustedNode); |
break; |
@@ -1782,7 +1781,8 @@ void EventHandler::applyTouchAdjustment(PlatformGestureEvent* gestureEvent, |
if (adjusted) { |
hitTestResult->resolveRectBasedTest( |
adjustedNode, m_frame->view()->rootFrameToContents(adjustedPoint)); |
- gestureEvent->applyTouchAdjustment(adjustedPoint); |
+ gestureEvent->applyTouchAdjustment( |
+ WebFloatPoint(adjustedPoint.x(), adjustedPoint.y())); |
} |
} |