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

Unified Diff: third_party/WebKit/Source/core/input/ScrollManager.cpp

Issue 2773893003: Record size of scroller that user scrolls (Closed)
Patch Set: Use scrollBegin gesture event to test UMA metrics Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/input/ScrollManager.cpp
diff --git a/third_party/WebKit/Source/core/input/ScrollManager.cpp b/third_party/WebKit/Source/core/input/ScrollManager.cpp
index 6d05fe059f6f8a7ddb8b1370866f43cd5abda5ea..6dd3700b69280dd3779063f866c4b32e3ef71c07 100644
--- a/third_party/WebKit/Source/core/input/ScrollManager.cpp
+++ b/third_party/WebKit/Source/core/input/ScrollManager.cpp
@@ -22,6 +22,7 @@
#include "core/page/scrolling/RootScrollerController.h"
#include "core/page/scrolling/ScrollState.h"
#include "core/paint/PaintLayer.h"
+#include "platform/Histogram.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "wtf/PtrUtil.h"
@@ -221,6 +222,13 @@ WebInputEventResult ScrollManager::handleGestureScrollBegin(
passScrollGestureEvent(gestureEvent,
m_scrollGestureHandlingNode->layoutObject());
+ if (m_scrollGestureHandlingNode->layoutObject() &&
+ (gestureEvent.sourceDevice == WebGestureDeviceTouchpad ||
+ gestureEvent.sourceDevice == WebGestureDeviceTouchscreen)) {
+ recordScrollerSize(*(m_scrollGestureHandlingNode->layoutObject()),
+ gestureEvent.sourceDevice);
+ }
+
m_currentScrollChain.clear();
std::unique_ptr<ScrollStateData> scrollStateData =
WTF::makeUnique<ScrollStateData>();
@@ -559,4 +567,24 @@ bool ScrollManager::canHandleGestureEvent(
return false;
}
+void ScrollManager::recordScrollerSize(const LayoutObject& layoutObject,
+ const WebGestureDevice device) {
+ if (!layoutObject.enclosingLayer())
+ return;
+
+ if (device == WebGestureDeviceTouchpad) {
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, sizeHistogram,
+ ("Event.Scroll.Wheel.ScrollerSize", 1, 90000, 50));
+ sizeHistogram.count(
+ layoutObject.enclosingLayer()->visualRect().width().toInt() *
+ layoutObject.enclosingLayer()->visualRect().height().toInt());
+ } else {
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, sizeHistogram,
+ ("Event.Scroll.Touch.ScrollerSize", 1, 90000, 50));
+ sizeHistogram.count(
+ layoutObject.enclosingLayer()->visualRect().width().toInt() *
+ layoutObject.enclosingLayer()->visualRect().height().toInt());
+ }
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698