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

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

Issue 2773893003: Record size of scroller that user scrolls (Closed)
Patch Set: bug fix 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..7777ef150b7db56b9da194032a8c5b528748c445 100644
--- a/third_party/WebKit/Source/core/input/ScrollManager.cpp
+++ b/third_party/WebKit/Source/core/input/ScrollManager.cpp
@@ -22,7 +22,9 @@
#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 "platform/scroll/ScrollerSize.h"
#include "wtf/PtrUtil.h"
namespace blink {
@@ -221,6 +223,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 +568,30 @@ 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, sizeHistogramWheel,
+ ("Event.Scroll.ScrollerSize.OnScroll_Wheel", 1,
+ LayerTreeHostImpl::m_pairForScrollerSizeHistograms.first,
+ LayerTreeHostImpl::m_pairForScrollerSizeHistograms.second));
+ sizeHistogramWheel.count(
+ layoutObject.enclosingLayer()->visualRect().width().toInt() *
+ layoutObject.enclosingLayer()->visualRect().height().toInt());
+ } else {
+ DEFINE_STATIC_LOCAL(
+ CustomCountHistogram, sizeHistogramTouch,
+ ("Event.Scroll.ScrollerSize.OnScroll_Touch", 1,
+ LayerTreeHostImpl::m_pairForScrollerSizeHistograms.first,
+ LayerTreeHostImpl::m_pairForScrollerSizeHistograms.second));
+ sizeHistogramTouch.count(
+ layoutObject.enclosingLayer()->visualRect().width().toInt() *
+ layoutObject.enclosingLayer()->visualRect().height().toInt());
+ }
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698