Chromium Code Reviews| 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..e8776d3b9dcabc2194e9b3176d6581e5f34f03af 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" |
| @@ -164,9 +165,40 @@ ScrollingCoordinator* Page::scrollingCoordinator() { |
| return m_scrollingCoordinator.get(); |
| } |
| -String Page::mainThreadScrollingReasonsAsText() { |
| - if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) |
| - return scrollingCoordinator->mainThreadScrollingReasonsAsText(); |
| +String Page::mainThreadScrollingReasonsAsText(Frame* frame) { |
| + if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| + // TODO(pdr): This walk should be unified with ScrollingCoordinator's |
|
pdr.
2016/12/07 22:25:29
Can you do this TODO in this patch? Basically, pul
|
| + // 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(frame); |
| + } |
| return String(); |
| } |