| 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..60fbb0d73cb5ae8041afd94ef85b6045e6584a15 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"
|
|
|
| @@ -196,6 +197,67 @@ void ScrollManager::customizedScroll(const Node& startNode,
|
| scrollState.distributeToScrollChainDescendant();
|
| }
|
|
|
| +uint32_t ScrollManager::computeNonCompositedMainThreadScrollingReasons() {
|
| + // When scrolling on the main thread, the scrollableArea may or may not be
|
| + // composited. Either way, we have recorded either the reasons stored in
|
| + // its layer or the reason NonFastScrollableRegion from the compositor
|
| + // side. Here we record scrolls that occurred on main thread due to a
|
| + // non-composited scroller.
|
| + if (!m_scrollGestureHandlingNode->layoutObject() || !m_frame->view())
|
| + return 0;
|
| +
|
| + uint32_t nonCompositedMainThreadScrollingReasons = 0;
|
| +
|
| + for (auto* curBox =
|
| + m_scrollGestureHandlingNode->layoutObject()->enclosingBox();
|
| + curBox; curBox = curBox->containingBlock()) {
|
| + PaintLayerScrollableArea* scrollableArea = curBox->getScrollableArea();
|
| +
|
| + if (!scrollableArea || !scrollableArea->scrollsOverflow())
|
| + continue;
|
| +
|
| + DCHECK(!scrollableArea->usesCompositedScrolling() ||
|
| + !scrollableArea->getNonCompositedMainThreadScrollingReasons());
|
| + nonCompositedMainThreadScrollingReasons |=
|
| + scrollableArea->getNonCompositedMainThreadScrollingReasons();
|
| + }
|
| +
|
| + return nonCompositedMainThreadScrollingReasons;
|
| +}
|
| +
|
| +void ScrollManager::recordNonCompositedMainThreadScrollingReasons(
|
| + const WebGestureDevice device) {
|
| + if (device != WebGestureDeviceTouchpad &&
|
| + device != WebGestureDeviceTouchscreen) {
|
| + return;
|
| + }
|
| +
|
| + uint32_t reasons = computeNonCompositedMainThreadScrollingReasons();
|
| + if (!reasons)
|
| + return;
|
| + DCHECK(MainThreadScrollingReason::NonCompositedScrollReasons(reasons));
|
| +
|
| + uint32_t mainThreadScrollingReasonEnumMax =
|
| + MainThreadScrollingReason::kMainThreadScrollingReasonCount + 1;
|
| + for (uint32_t i = MainThreadScrollingReason::kNonCompositedReasonsFirst;
|
| + i <= MainThreadScrollingReason::kNonCompositedReasonsLast; ++i) {
|
| + unsigned val = 1 << i;
|
| + if (reasons & val) {
|
| + if (device == WebGestureDeviceTouchscreen) {
|
| + DEFINE_STATIC_LOCAL(EnumerationHistogram, touchHistogram,
|
| + ("Renderer4.MainThreadGestureScrollReason",
|
| + mainThreadScrollingReasonEnumMax));
|
| + touchHistogram.count(i + 1);
|
| + } else {
|
| + DEFINE_STATIC_LOCAL(EnumerationHistogram, wheelHistogram,
|
| + ("Renderer4.MainThreadWheelScrollReason",
|
| + mainThreadScrollingReasonEnumMax));
|
| + wheelHistogram.count(i + 1);
|
| + }
|
| + }
|
| + }
|
| +}
|
| +
|
| WebInputEventResult ScrollManager::handleGestureScrollBegin(
|
| const WebGestureEvent& gestureEvent) {
|
| Document* document = m_frame->document();
|
| @@ -221,6 +283,8 @@ WebInputEventResult ScrollManager::handleGestureScrollBegin(
|
| passScrollGestureEvent(gestureEvent,
|
| m_scrollGestureHandlingNode->layoutObject());
|
|
|
| + recordNonCompositedMainThreadScrollingReasons(gestureEvent.sourceDevice);
|
| +
|
| m_currentScrollChain.clear();
|
| std::unique_ptr<ScrollStateData> scrollStateData =
|
| WTF::makeUnique<ScrollStateData>();
|
|
|