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

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

Issue 1879233005: Add UMA metric for tracking listeners for blocking touch before page finished loading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change the histogram name and discription Created 4 years, 7 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 FrameView* view = document->view(); 249 FrameView* view = document->view();
250 if (view && view->isScrollable()) 250 if (view && view->isScrollable())
251 result += kTouchTargetHistogramScrollableDocumentOffset; 251 result += kTouchTargetHistogramScrollableDocumentOffset;
252 } 252 }
253 253
254 if (dispatchResult != DispatchEventResult::NotCanceled) 254 if (dispatchResult != DispatchEventResult::NotCanceled)
255 result += kTouchTargetHistogramHandledOffset; 255 result += kTouchTargetHistogramHandledOffset;
256 return static_cast<TouchTargetAndDispatchResultType>(result); 256 return static_cast<TouchTargetAndDispatchResultType>(result);
257 } 257 }
258 258
259 enum TouchEventDispatchResultType {
260 UnhandledTouches, // Unhandled touch events.
261 HandledTouches, // Handled touch events.
262 TouchEventDispatchResultTypeMax,
263 };
264
259 } // namespace 265 } // namespace
260 266
261 using namespace HTMLNames; 267 using namespace HTMLNames;
262 268
263 // The link drag hysteresis is much larger than the others because there 269 // The link drag hysteresis is much larger than the others because there
264 // needs to be enough space to cancel the link press without starting a link dra g, 270 // needs to be enough space to cancel the link press without starting a link dra g,
265 // and because dragging links is rare. 271 // and because dragging links is rare.
266 static const int LinkDragHysteresis = 40; 272 static const int LinkDragHysteresis = 40;
267 static const int ImageDragHysteresis = 5; 273 static const int ImageDragHysteresis = 5;
268 static const int TextDragHysteresis = 3; 274 static const int TextDragHysteresis = 3;
(...skipping 3617 matching lines...) Expand 10 before | Expand all | Expand 10 after
3886 eventName, touchEventTarget->toNode()->document().domWindow(), 3892 eventName, touchEventTarget->toNode()->document().domWindow(),
3887 event.getModifiers(), event.cancelable(), event.causesScrollingI fUncanceled(), event.timestamp()); 3893 event.getModifiers(), event.cancelable(), event.causesScrollingI fUncanceled(), event.timestamp());
3888 3894
3889 DispatchEventResult domDispatchResult = touchEventTarget->dispatchEv ent(touchEvent); 3895 DispatchEventResult domDispatchResult = touchEventTarget->dispatchEv ent(touchEvent);
3890 3896
3891 // Only report for top level documents with a single touch on 3897 // Only report for top level documents with a single touch on
3892 // touch-start or the first touch-move. 3898 // touch-start or the first touch-move.
3893 if (touchStartOrFirstTouchMove && touchInfos.size() == 1 && event.ca ncelable() && !m_frame->document()->ownerElement()) { 3899 if (touchStartOrFirstTouchMove && touchInfos.size() == 1 && event.ca ncelable() && !m_frame->document()->ownerElement()) {
3894 DEFINE_STATIC_LOCAL(EnumerationHistogram, rootDocumentListenerHi stogram, ("Event.Touch.TargetAndDispatchResult", TouchTargetAndDispatchResultTyp eMax)); 3900 DEFINE_STATIC_LOCAL(EnumerationHistogram, rootDocumentListenerHi stogram, ("Event.Touch.TargetAndDispatchResult", TouchTargetAndDispatchResultTyp eMax));
3895 rootDocumentListenerHistogram.count(toTouchTargetHistogramValue( eventTarget, domDispatchResult)); 3901 rootDocumentListenerHistogram.count(toTouchTargetHistogramValue( eventTarget, domDispatchResult));
3902
3903 // Count the handled touch starts and first touch moves before a nd after the page is fully loaded respectively.
3904 if (m_frame->document()->isLoadCompleted()) {
3905 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsA fterPageLoadHistogram, ("Event.Touch.TouchDispositionsAfterPageLoad", TouchEvent DispatchResultTypeMax));
3906 touchDispositionsAfterPageLoadHistogram.count((domDispatchRe sult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches);
3907 } else {
3908 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsB eforePageLoadHistogram, ("Event.Touch.TouchDispositionsBeforePageLoad", TouchEve ntDispatchResultTypeMax));
3909 touchDispositionsBeforePageLoadHistogram.count((domDispatchR esult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches);
3910 }
3896 } 3911 }
3897 eventResult = mergeEventResult(eventResult, toWebInputEventResult(do mDispatchResult)); 3912 eventResult = mergeEventResult(eventResult, toWebInputEventResult(do mDispatchResult));
3898 } 3913 }
3899 } 3914 }
3900
3901 return eventResult; 3915 return eventResult;
3902 } 3916 }
3903 3917
3904 WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve nt) 3918 WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve nt)
3905 { 3919 {
3906 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent"); 3920 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent");
3907 3921
3908 if (event.type() == PlatformEvent::TouchScrollStarted) { 3922 if (event.type() == PlatformEvent::TouchScrollStarted) {
3909 m_pointerEventManager.blockTouchPointers(); 3923 m_pointerEventManager.blockTouchPointers();
3910 return WebInputEventResult::HandledSystem; 3924 return WebInputEventResult::HandledSystem;
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
4170 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() 4184 PlatformEvent::Modifiers EventHandler::accessKeyModifiers()
4171 { 4185 {
4172 #if OS(MACOSX) 4186 #if OS(MACOSX)
4173 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 4187 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
4174 #else 4188 #else
4175 return PlatformEvent::AltKey; 4189 return PlatformEvent::AltKey;
4176 #endif 4190 #endif
4177 } 4191 }
4178 4192
4179 } // namespace blink 4193 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698