Chromium Code Reviews| 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..ae46639e44795182fd95910819f543f6bf941761 100644 |
| --- a/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp |
| +++ b/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp |
| @@ -28,6 +28,8 @@ |
| #include "core/layout/LayoutView.h" |
| #include "core/layout/compositing/PaintLayerCompositor.h" |
| +#include "core/page/Page.h" |
| +#include "core/page/scrolling/ScrollingCoordinator.h" |
| #include "core/paint/PaintLayer.h" |
| #include "core/paint/PaintLayerStackingNode.h" |
| #include "core/paint/PaintLayerStackingNodeIterator.h" |
| @@ -250,6 +252,8 @@ void CompositingRequirementsUpdater::updateRecursive( |
| CompositingReasons directReasons = |
| m_compositingReasonFinder.directReasons(layer); |
| + updateMainThreadScrollingReasonsFromStyle(layer); |
| + |
| // 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 +548,27 @@ 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) 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); |
| + |
| + if (ScrollingCoordinator* scrollingCoordinator = |
|
bokan
2016/12/15 20:47:45
Should we early out above if there's no scrolling
yigu
2016/12/16 18:17:39
Done.
|
| + m_layoutView.document().page()->scrollingCoordinator()) { |
| + scrollingCoordinator->adjustMainThreadReasonsFromStyle( |
| + MainThreadScrollingReason::kHasOpacity, |
| + layer->compositesWithOpacity()); |
| + } |
| + } |
| +} |
| + |
| } // namespace blink |