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

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

Issue 2531603003: Only scroll on main if the targeted frames need to scroll on main (Closed)
Patch Set: Update sub-frame using loops instead of recursion & integrate a patch to fix spv2 problem 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
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();
}

Powered by Google App Engine
This is Rietveld 408576698