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

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

Issue 2255323004: Create MouseEventManager and EventHandlingUtil (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
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"
11 #include "core/frame/FrameHost.h" 11 #include "core/frame/FrameHost.h"
12 #include "core/frame/FrameView.h" 12 #include "core/frame/FrameView.h"
13 #include "core/html/HTMLCanvasElement.h" 13 #include "core/html/HTMLCanvasElement.h"
14 #include "core/input/EventHandler.h" 14 #include "core/input/EventHandlingUtil.h"
15 #include "core/input/TouchActionUtil.h" 15 #include "core/input/TouchActionUtil.h"
16 #include "core/page/ChromeClient.h" 16 #include "core/page/ChromeClient.h"
17 #include "core/page/Page.h" 17 #include "core/page/Page.h"
18 #include "platform/Histogram.h" 18 #include "platform/Histogram.h"
19 #include "platform/PlatformTouchEvent.h" 19 #include "platform/PlatformTouchEvent.h"
20 #include "wtf/CurrentTime.h" 20 #include "wtf/CurrentTime.h"
21 #include "wtf/PtrUtil.h" 21 #include "wtf/PtrUtil.h"
22 #include <memory> 22 #include <memory>
23 23
24 24
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 if (event.type() == PlatformEvent::TouchStart) { 214 if (event.type() == PlatformEvent::TouchStart) {
215 if (event.dispatchedDuringFling()) { 215 if (event.dispatchedDuringFling()) {
216 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositi onsDuringFlingHistogram, ("Event.Touch.TouchDispositionsDuringFling", TouchEvent DispatchResultTypeMax)); 216 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositi onsDuringFlingHistogram, ("Event.Touch.TouchDispositionsDuringFling", TouchEvent DispatchResultTypeMax));
217 touchDispositionsDuringFlingHistogram.count((domDispatch Result != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches) ; 217 touchDispositionsDuringFlingHistogram.count((domDispatch Result != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches) ;
218 } else { 218 } else {
219 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositi onsOutsideFlingHistogram, ("Event.Touch.TouchDispositionsOutsideFling", TouchEve ntDispatchResultTypeMax)); 219 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositi onsOutsideFlingHistogram, ("Event.Touch.TouchDispositionsOutsideFling", TouchEve ntDispatchResultTypeMax));
220 touchDispositionsOutsideFlingHistogram.count((domDispatc hResult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches ); 220 touchDispositionsOutsideFlingHistogram.count((domDispatc hResult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches );
221 } 221 }
222 } 222 }
223 } 223 }
224 eventResult = EventHandler::mergeEventResult(eventResult, 224 eventResult = EventHandlingUtil::mergeEventResult(eventResult,
225 EventHandler::toWebInputEventResult(domDispatchResult)); 225 EventHandlingUtil::toWebInputEventResult(domDispatchResult));
226 } 226 }
227 } 227 }
228 228
229 if (allTouchesReleased) 229 if (allTouchesReleased)
230 m_touchScrollStarted = false; 230 m_touchScrollStarted = false;
231 231
232 return eventResult; 232 return eventResult;
233 } 233 }
234 234
235 void TouchEventManager::updateTargetAndRegionMapsForTouchStarts( 235 void TouchEventManager::updateTargetAndRegionMapsForTouchStarts(
(...skipping 11 matching lines...) Expand all
247 // PointerEventManager. If it was the second touch there is a 247 // PointerEventManager. If it was the second touch there is a
248 // capturing documents for the touch and |m_touchSequenceDocument| 248 // capturing documents for the touch and |m_touchSequenceDocument|
249 // is not null. So if PointerEventManager should hit-test again 249 // is not null. So if PointerEventManager should hit-test again
250 // against |m_touchSequenceDocument| if the target set by 250 // against |m_touchSequenceDocument| if the target set by
251 // PointerEventManager was either null or not in 251 // PointerEventManager was either null or not in
252 // |m_touchSequenceDocument|. 252 // |m_touchSequenceDocument|.
253 if (m_touchSequenceDocument && (!touchInfo.touchNode 253 if (m_touchSequenceDocument && (!touchInfo.touchNode
254 || &touchInfo.touchNode->document() != m_touchSequenceDocument)) { 254 || &touchInfo.touchNode->document() != m_touchSequenceDocument)) {
255 if (m_touchSequenceDocument->frame()) { 255 if (m_touchSequenceDocument->frame()) {
256 LayoutPoint framePoint = roundedLayoutPoint(m_touchSequenceD ocument->frame()->view()->rootFrameToContents(touchInfo.point.pos())); 256 LayoutPoint framePoint = roundedLayoutPoint(m_touchSequenceD ocument->frame()->view()->rootFrameToContents(touchInfo.point.pos()));
257 result = EventHandler::hitTestResultInFrame(m_touchSequenceD ocument->frame(), framePoint, hitType); 257 result = EventHandlingUtil::hitTestResultInFrame(m_touchSequ enceDocument->frame(), framePoint, hitType);
258 Node* node = result.innerNode(); 258 Node* node = result.innerNode();
259 if (!node) 259 if (!node)
260 continue; 260 continue;
261 if (isHTMLCanvasElement(node)) { 261 if (isHTMLCanvasElement(node)) {
262 std::pair<Element*, String> regionInfo = toHTMLCanvasEle ment(node)->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame()); 262 std::pair<Element*, String> regionInfo = toHTMLCanvasEle ment(node)->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame());
263 if (regionInfo.first) 263 if (regionInfo.first)
264 node = regionInfo.first; 264 node = regionInfo.first;
265 touchInfo.region = regionInfo.second; 265 touchInfo.region = regionInfo.second;
266 } 266 }
267 // Touch events should not go to text nodes. 267 // Touch events should not go to text nodes.
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized; 533 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized;
534 break; 534 break;
535 default: 535 default:
536 NOTREACHED(); 536 NOTREACHED();
537 return; 537 return;
538 } 538 }
539 Deprecation::countDeprecation(m_frame, feature); 539 Deprecation::countDeprecation(m_frame, feature);
540 } 540 }
541 541
542 } // namespace blink 542 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698