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

Unified Diff: third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp

Issue 2565223002: Add more specific metrics for main thread scrolling reasons (Closed)
Patch Set: Relocate the logic of updating mainThreadScrollingFromStyle 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/layout/compositing/CompositingRequirementsUpdater.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp
index 762ab7bff80d818af0700a35f89fe35f65b5c10f..ce0018e27f918cbca2c241f3b048de4c3944866d 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp
@@ -28,6 +28,7 @@
#include "core/layout/LayoutView.h"
#include "core/layout/compositing/PaintLayerCompositor.h"
+#include "core/page/Page.h"
#include "core/paint/PaintLayer.h"
#include "core/paint/PaintLayerStackingNode.h"
#include "core/paint/PaintLayerStackingNodeIterator.h"
@@ -250,6 +251,10 @@ void CompositingRequirementsUpdater::updateRecursive(
CompositingReasons directReasons =
m_compositingReasonFinder.directReasons(layer);
+ if (ScrollingCoordinator* scrollingCoordinator =
+ m_layoutView.document().page()->scrollingCoordinator())
+ updateMainThreadScrollingReasonsFromStyle(layer, scrollingCoordinator);
bokan 2016/12/14 13:28:58 No need to pass in ScrollingCoordinator, just get
yigu 2016/12/14 21:17:32 Done.
+
// Video is special. It's the only PaintLayer type that can both have
// PaintLayer children and whose children can't use its backing to render
// into. These children (the controls) always need to be promoted into their
@@ -544,4 +549,24 @@ void CompositingRequirementsUpdater::updateRecursive(
layer->setCompositingReasons(reasonsToComposite);
}
+// Check if current layer has layout object that contains properties that cause
+// main thread scrolling.
+void CompositingRequirementsUpdater::updateMainThreadScrollingReasonsFromStyle(
+ const PaintLayer* layer,
+ ScrollingCoordinator* scrollingCoordinator) const {
+ // If current layer has opacity and has not been recorded, add the layer into
+ // frameView and vice versa.
+ if (!layer || !layer->getScrollableArea())
+ return;
+ if (layer->compositesWithOpacity() !=
+ layer->getScrollableArea()->hasMainThreadScrollingReason(
+ MainThreadScrollingReason::kHasOpacity)) {
+ layer->getScrollableArea()->flipMainThreadScrollingReason(
+ MainThreadScrollingReason::kHasOpacity);
+
+ scrollingCoordinator->adjustMainThreadReasonsFromStyle(
+ MainThreadScrollingReason::kHasOpacity, layer->compositesWithOpacity());
+ }
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698