Chromium Code Reviews| Index: Source/core/page/EventHandler.cpp |
| diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp |
| index c6a95286d46fbb6b5997fb4a96e026649f9672a7..7fd46517728a2b3a06fa86b0bc37a1ce8e155dab 100644 |
| --- a/Source/core/page/EventHandler.cpp |
| +++ b/Source/core/page/EventHandler.cpp |
| @@ -355,6 +355,7 @@ void EventHandler::clear() |
| m_mouseDownMayStartDrag = false; |
| m_lastShowPressTimestamp = 0; |
| m_lastDeferredTapElement = 0; |
| + m_elementHandlingGestureSequence = 0; |
| } |
| void EventHandler::nodeWillBeRemoved(Node& nodeToBeRemoved) |
| @@ -2304,9 +2305,21 @@ bool EventHandler::handleGestureEvent(const PlatformGestureEvent& gestureEvent) |
| hitType |= HitTestRequest::Active | HitTestRequest::ReadOnly; |
| if ((!scrollbar && !eventTarget) || !(hitType & HitTestRequest::ReadOnly)) { |
| - IntPoint hitTestPoint = m_frame->view()->windowToContents(adjustedPoint); |
| + IntPoint hitTestPoint; |
| + // FIXME: Track element across iframes when out of process iframes have more structure. |
| + if (m_elementHandlingGestureSequence && gestureEvent.type() != PlatformEvent::GestureTapDown) { |
| + Element* gestureElement = m_elementHandlingGestureSequence.get(); |
|
Rick Byers
2014/02/21 03:46:54
I don't think this handles all the cases (or even
|
| + hitTestPoint.setX((gestureElement->offsetLeft() + gestureElement->offsetWidth()) / 2); |
| + hitTestPoint.setY((gestureElement->offsetTop() + gestureElement->offsetHeight()) / 2); |
| + } else { |
| + hitTestPoint = m_frame->view()->windowToContents(adjustedPoint); |
| + } |
| + |
| HitTestResult result = hitTestResultAtPoint(hitTestPoint, hitType | HitTestRequest::AllowFrameScrollbars); |
| + if (gestureEvent.type() == PlatformEvent::GestureTapDown) |
| + m_elementHandlingGestureSequence = result.innerElement(); |
|
Rick Byers
2014/02/21 03:46:54
you probably don't want to hold on to this indefin
|
| + |
| if (shouldKeepActiveForMinInterval) { |
| m_lastDeferredTapElement = result.innerElement(); |
| m_activeIntervalTimer.startOneShot(minimumActiveInterval - activeInterval); |
| @@ -2322,6 +2335,8 @@ bool EventHandler::handleGestureEvent(const PlatformGestureEvent& gestureEvent) |
| } |
| if (scrollbar) { |
| + // If finger was on scrollbar, it will be locked by the scroll handling code. |
| + m_elementHandlingGestureSequence = 0; |
| bool eventSwallowed = scrollbar->gestureEvent(gestureEvent); |
| if (gestureEvent.type() == PlatformEvent::GestureTapDown && eventSwallowed) { |
| m_scrollbarHandlingScrollGesture = scrollbar; |