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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp

Issue 2565223002: Add more specific metrics for main thread scrolling reasons (Closed)
Patch Set: Move updating main thread scrolling reasons from style to PLSA 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/paint/PaintLayerScrollableArea.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
index ac22ac5ab04f247e1d77926b9acabb6a835c8cac..e2090aaef65d5c21b8317e05ede26ebb29611c70 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -106,7 +106,8 @@ PaintLayerScrollableArea::PaintLayerScrollableArea(PaintLayer& layer)
m_scrollbarManager(*this),
m_scrollCorner(nullptr),
m_resizer(nullptr),
- m_scrollAnchor(this)
+ m_scrollAnchor(this),
+ m_reasons(0)
#if DCHECK_IS_ON()
,
m_hasBeenDisposed(false)
@@ -1750,10 +1751,37 @@ static bool layerNeedsCompositedScrolling(
layer->layoutObject()->style()->hasBorderRadius());
}
+// Check if current layer has layout object that contains properties that cause
+// main thread scrolling.
+void PaintLayerScrollableArea::updateMainThreadScrollingReasonsFromStyle(
bokan 2016/12/19 14:54:25 Sorry to waffle on the name again, but after seein
yigu 2016/12/19 18:55:04 Done.
+ const PaintLayer* layer) const {
+ // If current layer has opacity and has not been recorded, add the layer into
+ // frameView and vice versa.
+ if (!layer || !layer->getScrollableArea())
bokan 2016/12/19 14:54:25 Now that we're in PLSA you don't have to check for
yigu 2016/12/19 18:55:04 Done.
+ return;
+
+ if (!box().frame()->page()->scrollingCoordinator())
+ return;
+ ScrollingCoordinator* scrollingCoordinator =
+ box().frame()->page()->scrollingCoordinator();
+ if (layer->compositesWithOpacity() !=
+ layer->getScrollableArea()->hasMainThreadScrollingReason(
bokan 2016/12/19 14:54:25 layer->getScrollableArea() isn't needed anymore.
yigu 2016/12/19 18:55:04 Done.
+ MainThreadScrollingReason::kHasOpacity)) {
+ layer->getScrollableArea()->flipMainThreadScrollingReason(
+ MainThreadScrollingReason::kHasOpacity);
+
+ scrollingCoordinator->adjustMainThreadReasonsFromStyle(
+ MainThreadScrollingReason::kHasOpacity, layer->compositesWithOpacity());
+ }
+}
+
void PaintLayerScrollableArea::updateNeedsCompositedScrolling(
LCDTextMode mode) {
const bool needsCompositedScrolling =
layerNeedsCompositedScrolling(mode, layer());
+ if (!needsCompositedScrolling)
+ updateMainThreadScrollingReasonsFromStyle(layer());
+
if (static_cast<bool>(m_needsCompositedScrolling) !=
needsCompositedScrolling) {
m_needsCompositedScrolling = needsCompositedScrolling;

Powered by Google App Engine
This is Rietveld 408576698