Index: third_party/WebKit/Source/core/input/TouchEventManager.cpp |
diff --git a/third_party/WebKit/Source/core/input/TouchEventManager.cpp b/third_party/WebKit/Source/core/input/TouchEventManager.cpp |
index 597100315230e4647231157628744570e5205f5c..6e9ea47b811249bbc56201669a6d8bd957f728d7 100644 |
--- a/third_party/WebKit/Source/core/input/TouchEventManager.cpp |
+++ b/third_party/WebKit/Source/core/input/TouchEventManager.cpp |
@@ -95,15 +95,6 @@ WebInputEventResult TouchEventManager::dispatchTouchEvents( |
const HeapVector<TouchInfo>& touchInfos, |
bool allTouchesReleased) |
{ |
- bool touchStartOrFirstTouchMove = false; |
- if (event.type() == PlatformEvent::TouchStart) { |
- m_waitingForFirstTouchMove = true; |
dtapuska
2016/08/15 14:41:29
Can the class variable now be removed?
lanwei
2016/08/17 01:22:35
Done.
|
- touchStartOrFirstTouchMove = true; |
- } else if (event.type() == PlatformEvent::TouchMove) { |
- touchStartOrFirstTouchMove = m_waitingForFirstTouchMove; |
- m_waitingForFirstTouchMove = false; |
- } |
- |
// Build up the lists to use for the |touches|, |targetTouches| and |
// |changedTouches| attributes in the JS event. See |
// http://www.w3.org/TR/touch-events/#touchevent-interface for how these |
@@ -186,37 +177,41 @@ WebInputEventResult TouchEventManager::dispatchTouchEvents( |
TouchEvent* touchEvent = TouchEvent::create( |
touches, touchesByTarget.get(touchEventTarget), changedTouches[state].m_touches.get(), |
eventName, touchEventTarget->toNode()->document().domWindow(), |
- event.getModifiers(), event.cancelable(), event.causesScrollingIfUncanceled(), touchStartOrFirstTouchMove, event.timestamp()); |
+ event.getModifiers(), event.cancelable(), event.causesScrollingIfUncanceled(), event.touchStartOrFirstTouchMove(), event.timestamp()); |
DispatchEventResult domDispatchResult = touchEventTarget->dispatchEvent(touchEvent); |
// Only report for top level documents with a single touch on |
// touch-start or the first touch-move. |
- if (touchStartOrFirstTouchMove && touchInfos.size() == 1 && event.cancelable() && m_frame->isMainFrame()) { |
+ if (event.touchStartOrFirstTouchMove() && touchInfos.size() == 1 && m_frame->isMainFrame()) { |
// Record the disposition and latency of touch starts and first touch moves before and after the page is fully loaded respectively. |
int64_t latencyInMicros = static_cast<int64_t>((monotonicallyIncreasingTime() - event.timestamp()) * 1000000.0); |
- if (m_frame->document()->isLoadCompleted()) { |
- DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsAfterPageLoadHistogram, ("Event.Touch.TouchDispositionsAfterPageLoad", TouchEventDispatchResultTypeMax)); |
- touchDispositionsAfterPageLoadHistogram.count((domDispatchResult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches); |
+ if (event.cancelable()) { |
+ if (m_frame->document()->isLoadCompleted()) { |
+ DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsAfterPageLoadHistogram, ("Event.Touch.TouchDispositionsAfterPageLoad", TouchEventDispatchResultTypeMax)); |
+ touchDispositionsAfterPageLoadHistogram.count((domDispatchResult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches); |
- DEFINE_STATIC_LOCAL(CustomCountHistogram, eventLatencyAfterPageLoadHistogram, ("Event.Touch.TouchLatencyAfterPageLoad", 1, 100000000, 50)); |
- eventLatencyAfterPageLoadHistogram.count(latencyInMicros); |
- } else { |
- DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsBeforePageLoadHistogram, ("Event.Touch.TouchDispositionsBeforePageLoad", TouchEventDispatchResultTypeMax)); |
- touchDispositionsBeforePageLoadHistogram.count((domDispatchResult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches); |
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, eventLatencyAfterPageLoadHistogram, ("Event.Touch.TouchLatencyAfterPageLoad", 1, 100000000, 50)); |
+ eventLatencyAfterPageLoadHistogram.count(latencyInMicros); |
+ } else { |
+ DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsBeforePageLoadHistogram, ("Event.Touch.TouchDispositionsBeforePageLoad", TouchEventDispatchResultTypeMax)); |
+ touchDispositionsBeforePageLoadHistogram.count((domDispatchResult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches); |
- DEFINE_STATIC_LOCAL(CustomCountHistogram, eventLatencyBeforePageLoadHistogram, ("Event.Touch.TouchLatencyBeforePageLoad", 1, 100000000, 50)); |
- eventLatencyBeforePageLoadHistogram.count(latencyInMicros); |
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, eventLatencyBeforePageLoadHistogram, ("Event.Touch.TouchLatencyBeforePageLoad", 1, 100000000, 50)); |
+ eventLatencyBeforePageLoadHistogram.count(latencyInMicros); |
+ } |
} |
// Report the touch disposition, split by whether there is an active fling animation. |
- if (event.type() == PlatformEvent::TouchStart) { |
- if (event.dispatchedDuringFling()) { |
- DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsDuringFlingHistogram, ("Event.Touch.TouchDispositionsDuringFling", TouchEventDispatchResultTypeMax)); |
- touchDispositionsDuringFlingHistogram.count((domDispatchResult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches); |
- } else { |
- DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsOutsideFlingHistogram, ("Event.Touch.TouchDispositionsOutsideFling", TouchEventDispatchResultTypeMax)); |
+ if (event.dispatchedDuringFling()) { |
+ if (event.dispatchType() == PlatformEvent::ListenersForcedNonBlockingPassiveDueToFling) { |
+ DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsDuringFlingHistogram, ("Event.Touch.TouchDispositionsDuringFling2", TouchEventDispatchResultTypeMax)); |
+ touchDispositionsDuringFlingHistogram.count(touchEvent->preventDefaultCalledOnUncancelableEvent() ? HandledTouches : UnhandledTouches); |
+ } |
+ } else { |
+ if (event.cancelable()) { |
+ DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsOutsideFlingHistogram, ("Event.Touch.TouchDispositionsOutsideFling2", TouchEventDispatchResultTypeMax)); |
touchDispositionsOutsideFlingHistogram.count((domDispatchResult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches); |
} |
} |