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

Unified Diff: third_party/WebKit/Source/core/page/Page.cpp

Issue 2550273004: Make Internals::mainThreadScrollingReasons work with spv2. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698