Chromium Code Reviews| 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; |