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..e39f3567e2940520de168522de1c1bfe7bb45ad0 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,9 @@ void CompositingRequirementsUpdater::updateRecursive( |
| CompositingReasons directReasons = |
| m_compositingReasonFinder.directReasons(layer); |
| + if (!compositor->preferCompositingToLCDTextEnabled()) |
| + updateMainThreadScrollingReasonsFromStyle(layer); |
|
bokan
2016/12/16 23:06:01
Sorry, one last thing. I think this is the wrong p
yigu
2016/12/18 15:05:11
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,28 @@ 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 (ScrollingCoordinator* scrollingCoordinator = |
|
bokan
2016/12/16 23:06:01
nit: we generally prefer the above pattern of earl
yigu
2016/12/18 15:05:12
Done.
|
| + m_layoutView.document().page()->scrollingCoordinator()) { |
| + if (layer->compositesWithOpacity() != |
| + layer->getScrollableArea()->hasMainThreadScrollingReason( |
| + MainThreadScrollingReason::kHasOpacity)) { |
| + layer->getScrollableArea()->flipMainThreadScrollingReason( |
| + MainThreadScrollingReason::kHasOpacity); |
| + |
| + scrollingCoordinator->adjustMainThreadReasonsFromStyle( |
| + MainThreadScrollingReason::kHasOpacity, |
| + layer->compositesWithOpacity()); |
| + } |
| + } |
| +} |
| + |
| } // namespace blink |