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

Side by Side Diff: third_party/WebKit/Source/core/input/TouchEventManager.cpp

Issue 2701553002: Touchmoves should not be suppressed if the touchstart is consumed (Closed)
Patch Set: remove comments Created 3 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/events/pointerevents/pointer-event-in-slop-region.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/input/TouchEventManager.h" 5 #include "core/input/TouchEventManager.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/events/TouchEvent.h" 8 #include "core/events/TouchEvent.h"
9 #include "core/frame/Deprecation.h" 9 #include "core/frame/Deprecation.h"
10 #include "core/frame/EventHandlerRegistry.h" 10 #include "core/frame/EventHandlerRegistry.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 WebInputEventResult TouchEventManager::dispatchTouchEvents( 120 WebInputEventResult TouchEventManager::dispatchTouchEvents(
121 const WebTouchEvent& event, 121 const WebTouchEvent& event,
122 const HeapVector<TouchInfo>& touchInfos, 122 const HeapVector<TouchInfo>& touchInfos,
123 bool allTouchesReleased) { 123 bool allTouchesReleased) {
124 // Build up the lists to use for the |touches|, |targetTouches| and 124 // Build up the lists to use for the |touches|, |targetTouches| and
125 // |changedTouches| attributes in the JS event. See 125 // |changedTouches| attributes in the JS event. See
126 // http://www.w3.org/TR/touch-events/#touchevent-interface for how these 126 // http://www.w3.org/TR/touch-events/#touchevent-interface for how these
127 // lists fit together. 127 // lists fit together.
128 128
129 // Suppress all the touch moves in the slop region.
130 if (IsTouchSequenceStart(event))
131 m_suppressingTouchmovesWithinSlop = true;
132
133 if (event.type() == WebInputEvent::TouchEnd || 129 if (event.type() == WebInputEvent::TouchEnd ||
134 event.type() == WebInputEvent::TouchCancel || event.touchesLength > 1) { 130 event.type() == WebInputEvent::TouchCancel || event.touchesLength > 1) {
135 m_suppressingTouchmovesWithinSlop = false; 131 m_suppressingTouchmovesWithinSlop = false;
136 } 132 }
137 133
138 if (m_suppressingTouchmovesWithinSlop && 134 if (m_suppressingTouchmovesWithinSlop &&
139 event.type() == WebInputEvent::TouchMove) { 135 event.type() == WebInputEvent::TouchMove) {
140 if (!event.movedBeyondSlopRegion) 136 if (!event.movedBeyondSlopRegion)
141 return WebInputEventResult::HandledSuppressed; 137 return WebInputEventResult::HandledSuppressed;
142 m_suppressingTouchmovesWithinSlop = false; 138 m_suppressingTouchmovesWithinSlop = false;
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 ? HandledTouches 281 ? HandledTouches
286 : UnhandledTouches); 282 : UnhandledTouches);
287 } 283 }
288 } 284 }
289 eventResult = EventHandlingUtil::mergeEventResult( 285 eventResult = EventHandlingUtil::mergeEventResult(
290 eventResult, 286 eventResult,
291 EventHandlingUtil::toWebInputEventResult(domDispatchResult)); 287 EventHandlingUtil::toWebInputEventResult(domDispatchResult));
292 } 288 }
293 } 289 }
294 290
291 // Do not suppress any touchmoves if the touchstart is consumed.
292 if (IsTouchSequenceStart(event) &&
293 eventResult == WebInputEventResult::NotHandled) {
294 m_suppressingTouchmovesWithinSlop = true;
295 }
296
295 return eventResult; 297 return eventResult;
296 } 298 }
297 299
298 void TouchEventManager::updateTargetAndRegionMapsForTouchStarts( 300 void TouchEventManager::updateTargetAndRegionMapsForTouchStarts(
299 HeapVector<TouchInfo>& touchInfos) { 301 HeapVector<TouchInfo>& touchInfos) {
300 for (auto& touchInfo : touchInfos) { 302 for (auto& touchInfo : touchInfos) {
301 // Touch events implicitly capture to the touched node, and don't change 303 // Touch events implicitly capture to the touched node, and don't change
302 // active/hover states themselves (Gesture events do). So we only need 304 // active/hover states themselves (Gesture events do). So we only need
303 // to hit-test on touchstart and when the target could be different than 305 // to hit-test on touchstart and when the target could be different than
304 // the corresponding pointer event target. 306 // the corresponding pointer event target.
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 } 514 }
513 515
514 return dispatchTouchEvents(event, touchInfos, allTouchesReleased); 516 return dispatchTouchEvents(event, touchInfos, allTouchesReleased);
515 } 517 }
516 518
517 bool TouchEventManager::isAnyTouchActive() const { 519 bool TouchEventManager::isAnyTouchActive() const {
518 return m_touchPressed; 520 return m_touchPressed;
519 } 521 }
520 522
521 } // namespace blink 523 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/events/pointerevents/pointer-event-in-slop-region.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698