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

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

Issue 2773893003: Record size of scroller that user scrolls (Closed)
Patch Set: Add scrollEnd event after scrollBegin in test 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 727c3e74e57525196f5f4abb1ec12c18a21ecc4c..f7cda6811e7b4ae610cdba32f8bf660080f62ffc 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>();
@@ -566,4 +575,26 @@ bool ScrollManager::canHandleGestureEvent(
return false;
}
+void ScrollManager::recordScrollerSize(const LayoutObject& layoutObject,
+ const WebGestureDevice device) {
+ if (!layoutObject.enclosingLayer())
flackr 2017/04/12 15:31:04 I'm confused, is the scroll gesture handling node
+ return;
+
+ if (device == WebGestureDeviceTouchpad) {
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, sizeHistogramWheel,
+ ("Event.Scroll.ScrollerSize.OnScroll_Wheel", 1,
+ kMaxScrollerSize, kBucketNum));
+ sizeHistogramWheel.count(
+ layoutObject.enclosingLayer()->visualRect().width().toInt() *
bokan 2017/03/31 20:23:50 I think this misses a few edge cases. For starters
bokan 2017/03/31 20:24:45 I think this is probably the reason your frame scr
yigu 2017/03/31 20:38:32 We basically don't care about the main scroller as
bokan 2017/04/04 15:25:45 If we don't care about the viewport, we should avo
+ layoutObject.enclosingLayer()->visualRect().height().toInt());
+ } else {
+ DEFINE_STATIC_LOCAL(CustomCountHistogram, sizeHistogramTouch,
+ ("Event.Scroll.ScrollerSize.OnScroll_Touch", 1,
+ kMaxScrollerSize, kBucketNum));
+ sizeHistogramTouch.count(
+ layoutObject.enclosingLayer()->visualRect().width().toInt() *
+ layoutObject.enclosingLayer()->visualRect().height().toInt());
+ }
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698