| Index: third_party/WebKit/Source/core/page/Page.cpp
|
| diff --git a/third_party/WebKit/Source/core/page/Page.cpp b/third_party/WebKit/Source/core/page/Page.cpp
|
| index bcc4c7944f597920d7f7e1e3a8638cb9c095e1af..39399e7c4fd6f2d4da6ef384c6b4d10adce81240 100644
|
| --- a/third_party/WebKit/Source/core/page/Page.cpp
|
| +++ b/third_party/WebKit/Source/core/page/Page.cpp
|
| @@ -42,6 +42,7 @@
|
| #include "core/html/HTMLMediaElement.h"
|
| #include "core/inspector/ConsoleMessageStorage.h"
|
| #include "core/inspector/InspectorInstrumentation.h"
|
| +#include "core/layout/LayoutView.h"
|
| #include "core/layout/TextAutosizer.h"
|
| #include "core/page/AutoscrollController.h"
|
| #include "core/page/ChromeClient.h"
|
| @@ -165,8 +166,39 @@ ScrollingCoordinator* Page::scrollingCoordinator() {
|
| }
|
|
|
| String Page::mainThreadScrollingReasonsAsText() {
|
| - if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
|
| - return scrollingCoordinator->mainThreadScrollingReasonsAsText();
|
| + if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
|
| + // TODO(pdr): This walk should be unified with ScrollingCoordinator's
|
| + // mainThreadScrollingReasons().
|
| + MainThreadScrollingReasons reasons = 0;
|
| + for (Frame* frame = mainFrame(); frame;
|
| + frame = frame->tree().traverseNext()) {
|
| + if (!frame->isLocalFrame())
|
| + continue;
|
| + // TODO(alexmos,kenrb): For OOPIF, local roots that are different from
|
| + // the main frame can't be used in the calculation, since they use
|
| + // different compositors with unrelated state, which breaks some of the
|
| + // calculations below.
|
| + if (toLocalFrame(frame)->localFrameRoot() != mainFrame())
|
| + continue;
|
| + if (const auto* frameView = toLocalFrame(frame)->view()) {
|
| + if (const auto* scrollNode = frameView->scroll())
|
| + reasons |= scrollNode->mainThreadScrollingReasons();
|
| + for (LayoutObject* object = frameView->layoutView(); object;
|
| + object = object->nextInPreOrder()) {
|
| + if (const auto* properties = object->paintProperties()) {
|
| + if (const auto* scrollNode = properties->scroll())
|
| + reasons |= scrollNode->mainThreadScrollingReasons();
|
| + }
|
| + }
|
| + }
|
| + }
|
| + return String(
|
| + MainThreadScrollingReason::mainThreadScrollingReasonsAsText(reasons)
|
| + .c_str());
|
| + } else {
|
| + if (auto* scrollingCoordinator = this->scrollingCoordinator())
|
| + return scrollingCoordinator->mainThreadScrollingReasonsAsText();
|
| + }
|
|
|
| return String();
|
| }
|
|
|