Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp |
| index 1ee5b2d22a5a7dec2d091f2c86020a1f9f2018db..264efedd96965b1cc55b09fe7dcc3920a6d73212 100644 |
| --- a/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp |
| +++ b/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp |
| @@ -178,12 +178,39 @@ bool CompositingReasonFinder::requiresCompositingForAnimation( |
| return style.shouldCompositeForCurrentAnimations(); |
| } |
| +// Check if current layer has layout object that contains properties that cause |
| +// main thread scrolling. |
| +void CompositingReasonFinder::updateMainThreadScrollingReasonDueToLayoutObject( |
| + const PaintLayer* layer) const { |
| + // TODO(yigu) Keeping the reasons in PaintLayerScrollableArea |
| + // is not ideal. When a layout becomes to non-scrollable |
|
bokan
2016/12/13 14:38:57
nit: "layout becomes to" -> "layer becomes"
bokan
2016/12/13 14:38:57
Also, perhaps counterintuitively, I believe all la
yigu
2016/12/13 20:54:10
Done.
yigu
2016/12/13 20:54:10
Done.
|
| + // the reasons kept in that scrollable area cannot be updated |
| + // in the frameView correctly. |
| + // 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); |
| + layer->layoutObject() |
| + ->frameView() |
| + ->adjustMainThreadReasonsDueToLayoutObject( |
| + MainThreadScrollingReason::kHasOpacity, |
| + layer->compositesWithOpacity()); |
| + } |
| +} |
| + |
| bool CompositingReasonFinder::requiresCompositingForScrollDependentPosition( |
| const PaintLayer* layer) const { |
| if (layer->layoutObject()->style()->position() != FixedPosition && |
| layer->layoutObject()->style()->position() != StickyPosition) |
| return false; |
| + updateMainThreadScrollingReasonDueToLayoutObject(layer); |
|
bokan
2016/12/13 14:38:57
This is only meant for Fixed/Sticky layers? The na
yigu
2016/12/13 20:54:10
No. It should be moved somewhere else.
|
| + |
| if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger) && |
| (!RuntimeEnabledFeatures::compositeOpaqueFixedPositionEnabled() || |
| !layer->backgroundIsKnownToBeOpaqueInRect( |