Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1324)

Unified Diff: Source/core/page/EventHandler.cpp

Issue 130433009: Lock element at start of gesture sequence. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add test Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« Source/core/page/EventHandler.h ('K') | « Source/core/page/EventHandler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« Source/core/page/EventHandler.h ('K') | « Source/core/page/EventHandler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698