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

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: slop region 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. 129 // Suppress the touch moves in the slop region when
mustaq 2017/02/17 15:24:01 Lines 129-130 are meaningless now. Please delete.
lanwei 2017/02/21 18:10:04 Done.
130 if (IsTouchSequenceStart(event)) 130 // m_suppressingTouchmovesWithinSlop is true.
131 m_suppressingTouchmovesWithinSlop = true;
132
133 if (event.type() == WebInputEvent::TouchEnd || 131 if (event.type() == WebInputEvent::TouchEnd ||
134 event.type() == WebInputEvent::TouchCancel || event.touchesLength > 1) { 132 event.type() == WebInputEvent::TouchCancel || event.touchesLength > 1) {
135 m_suppressingTouchmovesWithinSlop = false; 133 m_suppressingTouchmovesWithinSlop = false;
136 } 134 }
137 135
138 if (m_suppressingTouchmovesWithinSlop && 136 if (m_suppressingTouchmovesWithinSlop &&
139 event.type() == WebInputEvent::TouchMove) { 137 event.type() == WebInputEvent::TouchMove) {
140 if (!event.movedBeyondSlopRegion) 138 if (!event.movedBeyondSlopRegion)
141 return WebInputEventResult::HandledSuppressed; 139 return WebInputEventResult::HandledSuppressed;
142 m_suppressingTouchmovesWithinSlop = false; 140 m_suppressingTouchmovesWithinSlop = false;
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 ? HandledTouches 283 ? HandledTouches
286 : UnhandledTouches); 284 : UnhandledTouches);
287 } 285 }
288 } 286 }
289 eventResult = EventHandlingUtil::mergeEventResult( 287 eventResult = EventHandlingUtil::mergeEventResult(
290 eventResult, 288 eventResult,
291 EventHandlingUtil::toWebInputEventResult(domDispatchResult)); 289 EventHandlingUtil::toWebInputEventResult(domDispatchResult));
292 } 290 }
293 } 291 }
294 292
293 // Do not suppress any touchmoves if the touchstart is consumed.
294 if (IsTouchSequenceStart(event) &&
295 eventResult == WebInputEventResult::NotHandled) {
296 m_suppressingTouchmovesWithinSlop = true;
297 }
298
295 return eventResult; 299 return eventResult;
296 } 300 }
297 301
298 void TouchEventManager::updateTargetAndRegionMapsForTouchStarts( 302 void TouchEventManager::updateTargetAndRegionMapsForTouchStarts(
299 HeapVector<TouchInfo>& touchInfos) { 303 HeapVector<TouchInfo>& touchInfos) {
300 for (auto& touchInfo : touchInfos) { 304 for (auto& touchInfo : touchInfos) {
301 // Touch events implicitly capture to the touched node, and don't change 305 // Touch events implicitly capture to the touched node, and don't change
302 // active/hover states themselves (Gesture events do). So we only need 306 // 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 307 // to hit-test on touchstart and when the target could be different than
304 // the corresponding pointer event target. 308 // the corresponding pointer event target.
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 } 516 }
513 517
514 return dispatchTouchEvents(event, touchInfos, allTouchesReleased); 518 return dispatchTouchEvents(event, touchInfos, allTouchesReleased);
515 } 519 }
516 520
517 bool TouchEventManager::isAnyTouchActive() const { 521 bool TouchEventManager::isAnyTouchActive() const {
518 return m_touchPressed; 522 return m_touchPressed;
519 } 523 }
520 524
521 } // namespace blink 525 } // 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