| 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/EventHandlerRegistry.h" | 9 #include "core/frame/EventHandlerRegistry.h" |
| 10 #include "core/frame/FrameHost.h" | 10 #include "core/frame/FrameHost.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 EventTarget* touchEventTarget = eventTarget; | 232 EventTarget* touchEventTarget = eventTarget; |
| 233 TouchEvent* touchEvent = TouchEvent::create( | 233 TouchEvent* touchEvent = TouchEvent::create( |
| 234 touches, touchesByTarget.get(touchEventTarget), changedTouches[s
tate].m_touches.get(), | 234 touches, touchesByTarget.get(touchEventTarget), changedTouches[s
tate].m_touches.get(), |
| 235 eventName, touchEventTarget->toNode()->document().domWindow(), | 235 eventName, touchEventTarget->toNode()->document().domWindow(), |
| 236 event.getModifiers(), event.cancelable(), event.causesScrollingI
fUncanceled(), event.timestamp()); | 236 event.getModifiers(), event.cancelable(), event.causesScrollingI
fUncanceled(), event.timestamp()); |
| 237 | 237 |
| 238 DispatchEventResult domDispatchResult = touchEventTarget->dispatchEv
ent(touchEvent); | 238 DispatchEventResult domDispatchResult = touchEventTarget->dispatchEv
ent(touchEvent); |
| 239 | 239 |
| 240 // Only report for top level documents with a single touch on | 240 // Only report for top level documents with a single touch on |
| 241 // touch-start or the first touch-move. | 241 // touch-start or the first touch-move. |
| 242 if (touchStartOrFirstTouchMove && touchInfos.size() == 1 && event.ca
ncelable() && !m_frame->document()->ownerElement()) { | 242 if (touchStartOrFirstTouchMove && touchInfos.size() == 1 && event.ca
ncelable() && m_frame->isMainFrame()) { |
| 243 DEFINE_STATIC_LOCAL(EnumerationHistogram, rootDocumentListenerHi
stogram, ("Event.Touch.TargetAndDispatchResult", TouchTargetAndDispatchResultTyp
eMax)); | 243 DEFINE_STATIC_LOCAL(EnumerationHistogram, rootDocumentListenerHi
stogram, ("Event.Touch.TargetAndDispatchResult", TouchTargetAndDispatchResultTyp
eMax)); |
| 244 rootDocumentListenerHistogram.count(toTouchTargetHistogramValue(
eventTarget, domDispatchResult)); | 244 rootDocumentListenerHistogram.count(toTouchTargetHistogramValue(
eventTarget, domDispatchResult)); |
| 245 | 245 |
| 246 // Count the handled touch starts and first touch moves before a
nd after the page is fully loaded respectively. | 246 // Count the handled touch starts and first touch moves before a
nd after the page is fully loaded respectively. |
| 247 if (m_frame->document()->isLoadCompleted()) { | 247 if (m_frame->document()->isLoadCompleted()) { |
| 248 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsA
fterPageLoadHistogram, ("Event.Touch.TouchDispositionsAfterPageLoad", TouchEvent
DispatchResultTypeMax)); | 248 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsA
fterPageLoadHistogram, ("Event.Touch.TouchDispositionsAfterPageLoad", TouchEvent
DispatchResultTypeMax)); |
| 249 touchDispositionsAfterPageLoadHistogram.count((domDispatchRe
sult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches); | 249 touchDispositionsAfterPageLoadHistogram.count((domDispatchRe
sult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches); |
| 250 } else { | 250 } else { |
| 251 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsB
eforePageLoadHistogram, ("Event.Touch.TouchDispositionsBeforePageLoad", TouchEve
ntDispatchResultTypeMax)); | 251 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsB
eforePageLoadHistogram, ("Event.Touch.TouchDispositionsBeforePageLoad", TouchEve
ntDispatchResultTypeMax)); |
| 252 touchDispositionsBeforePageLoadHistogram.count((domDispatchR
esult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches); | 252 touchDispositionsBeforePageLoadHistogram.count((domDispatchR
esult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches); |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 } | 504 } |
| 505 | 505 |
| 506 DEFINE_TRACE(TouchEventManager) | 506 DEFINE_TRACE(TouchEventManager) |
| 507 { | 507 { |
| 508 visitor->trace(m_frame); | 508 visitor->trace(m_frame); |
| 509 visitor->trace(m_touchSequenceDocument); | 509 visitor->trace(m_touchSequenceDocument); |
| 510 visitor->trace(m_targetForTouchID); | 510 visitor->trace(m_targetForTouchID); |
| 511 } | 511 } |
| 512 | 512 |
| 513 } // namespace blink | 513 } // namespace blink |
| OLD | NEW |