| OLD | NEW |
| 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/layout/HitTestCanvasResult.h" | 16 #include "core/layout/HitTestCanvasResult.h" |
| 17 #include "core/page/ChromeClient.h" | 17 #include "core/page/ChromeClient.h" |
| 18 #include "core/page/Page.h" | 18 #include "core/page/Page.h" |
| 19 #include "platform/Histogram.h" | 19 #include "platform/Histogram.h" |
| 20 #include "platform/PlatformTouchEvent.h" | 20 #include "platform/PlatformTouchEvent.h" |
| 21 #include "wtf/CurrentTime.h" | 21 #include "wtf/CurrentTime.h" |
| 22 #include "wtf/PtrUtil.h" | 22 #include "wtf/PtrUtil.h" |
| 23 #include <memory> | 23 #include <memory> |
| 24 | 24 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsO
utsideFlingHistogram, ("Event.Touch.TouchDispositionsOutsideFling2", TouchEventD
ispatchResultTypeMax)); | 206 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsO
utsideFlingHistogram, ("Event.Touch.TouchDispositionsOutsideFling2", TouchEventD
ispatchResultTypeMax)); |
| 207 touchDispositionsOutsideFlingHistogram.count((domDispatchRes
ult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches); | 207 touchDispositionsOutsideFlingHistogram.count((domDispatchRes
ult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches); |
| 208 } | 208 } |
| 209 | 209 |
| 210 // Report the touch disposition when there is an active fling an
imation. | 210 // Report the touch disposition when there is an active fling an
imation. |
| 211 if (event.dispatchType() == PlatformEvent::ListenersForcedNonBlo
ckingDueToFling) { | 211 if (event.dispatchType() == PlatformEvent::ListenersForcedNonBlo
ckingDueToFling) { |
| 212 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsD
uringFlingHistogram, ("Event.Touch.TouchDispositionsDuringFling2", TouchEventDis
patchResultTypeMax)); | 212 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsD
uringFlingHistogram, ("Event.Touch.TouchDispositionsDuringFling2", TouchEventDis
patchResultTypeMax)); |
| 213 touchDispositionsDuringFlingHistogram.count(touchEvent->prev
entDefaultCalledOnUncancelableEvent() ? HandledTouches : UnhandledTouches); | 213 touchDispositionsDuringFlingHistogram.count(touchEvent->prev
entDefaultCalledOnUncancelableEvent() ? HandledTouches : UnhandledTouches); |
| 214 } | 214 } |
| 215 } | 215 } |
| 216 eventResult = EventHandler::mergeEventResult(eventResult, | 216 eventResult = EventHandlingUtil::mergeEventResult(eventResult, |
| 217 EventHandler::toWebInputEventResult(domDispatchResult)); | 217 EventHandlingUtil::toWebInputEventResult(domDispatchResult)); |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 | 220 |
| 221 if (allTouchesReleased) | 221 if (allTouchesReleased) |
| 222 m_touchScrollStarted = false; | 222 m_touchScrollStarted = false; |
| 223 | 223 |
| 224 return eventResult; | 224 return eventResult; |
| 225 } | 225 } |
| 226 | 226 |
| 227 void TouchEventManager::updateTargetAndRegionMapsForTouchStarts( | 227 void TouchEventManager::updateTargetAndRegionMapsForTouchStarts( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 239 // PointerEventManager. If it was the second touch there is a | 239 // PointerEventManager. If it was the second touch there is a |
| 240 // capturing documents for the touch and |m_touchSequenceDocument| | 240 // capturing documents for the touch and |m_touchSequenceDocument| |
| 241 // is not null. So if PointerEventManager should hit-test again | 241 // is not null. So if PointerEventManager should hit-test again |
| 242 // against |m_touchSequenceDocument| if the target set by | 242 // against |m_touchSequenceDocument| if the target set by |
| 243 // PointerEventManager was either null or not in | 243 // PointerEventManager was either null or not in |
| 244 // |m_touchSequenceDocument|. | 244 // |m_touchSequenceDocument|. |
| 245 if (m_touchSequenceDocument && (!touchInfo.touchNode | 245 if (m_touchSequenceDocument && (!touchInfo.touchNode |
| 246 || &touchInfo.touchNode->document() != m_touchSequenceDocument))
{ | 246 || &touchInfo.touchNode->document() != m_touchSequenceDocument))
{ |
| 247 if (m_touchSequenceDocument->frame()) { | 247 if (m_touchSequenceDocument->frame()) { |
| 248 LayoutPoint framePoint = roundedLayoutPoint(m_touchSequenceD
ocument->frame()->view()->rootFrameToContents(touchInfo.point.pos())); | 248 LayoutPoint framePoint = roundedLayoutPoint(m_touchSequenceD
ocument->frame()->view()->rootFrameToContents(touchInfo.point.pos())); |
| 249 result = EventHandler::hitTestResultInFrame(m_touchSequenceD
ocument->frame(), framePoint, hitType); | 249 result = EventHandlingUtil::hitTestResultInFrame(m_touchSequ
enceDocument->frame(), framePoint, hitType); |
| 250 Node* node = result.innerNode(); | 250 Node* node = result.innerNode(); |
| 251 if (!node) | 251 if (!node) |
| 252 continue; | 252 continue; |
| 253 if (isHTMLCanvasElement(node)) { | 253 if (isHTMLCanvasElement(node)) { |
| 254 HitTestCanvasResult* hitTestCanvasResult = toHTMLCanvasE
lement(node)->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame()); | 254 HitTestCanvasResult* hitTestCanvasResult = toHTMLCanvasE
lement(node)->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame()); |
| 255 if (hitTestCanvasResult->getControl()) | 255 if (hitTestCanvasResult->getControl()) |
| 256 node = hitTestCanvasResult->getControl(); | 256 node = hitTestCanvasResult->getControl(); |
| 257 touchInfo.region = hitTestCanvasResult->getId(); | 257 touchInfo.region = hitTestCanvasResult->getId(); |
| 258 } | 258 } |
| 259 // Touch events should not go to text nodes. | 259 // Touch events should not go to text nodes. |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized; | 524 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized; |
| 525 break; | 525 break; |
| 526 default: | 526 default: |
| 527 NOTREACHED(); | 527 NOTREACHED(); |
| 528 return; | 528 return; |
| 529 } | 529 } |
| 530 Deprecation::countDeprecation(m_frame, feature); | 530 Deprecation::countDeprecation(m_frame, feature); |
| 531 } | 531 } |
| 532 | 532 |
| 533 } // namespace blink | 533 } // namespace blink |
| OLD | NEW |