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 d9d504bf573b63b0e753f78cd7ab3c20467d2b50..9b67152ba09e586d7e5b5b030acf6c4c691ec6b6 100644 |
| --- a/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp |
| +++ b/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp |
| @@ -14,6 +14,23 @@ |
| namespace blink { |
| +namespace { |
| +// TODO(smcgruer): Extract to common helper function. |
| +StickyPositionScrollingConstraints* stickyConstraintsForLayoutObject( |
| + const LayoutBoxModelObject* o) { |
|
flackr
2017/02/22 22:40:15
Can we pass through the reference type instead of
smcgruer
2017/02/23 20:14:17
Used the original PaintLayer instead, and pulled t
|
| + if (!o || !o->layer()->ancestorOverflowLayer()) |
|
flackr
2017/02/22 22:40:15
o should never be null afaict. Since we're calling
smcgruer
2017/02/23 20:14:17
Done.
|
| + return nullptr; |
| + |
| + PaintLayerScrollableArea* scrollableArea = |
| + o->layer()->ancestorOverflowLayer()->getScrollableArea(); |
| + auto it = scrollableArea->stickyConstraintsMap().find(o->layer()); |
| + if (it == scrollableArea->stickyConstraintsMap().end()) |
| + return nullptr; |
|
flackr
2017/02/22 22:40:15
Can this happen? We only call this function for st
smcgruer
2017/02/23 20:14:17
Done.
|
| + |
| + return &it->value; |
| +} |
| +} // namespace |
| + |
| CompositingReasonFinder::CompositingReasonFinder(LayoutView& layoutView) |
| : m_layoutView(layoutView), |
| m_compositingTriggers( |
| @@ -231,8 +248,16 @@ bool CompositingReasonFinder::requiresCompositingForScrollDependentPosition( |
| // container rather than the enclosing frame. |
| if (layer->sticksToViewport()) |
| return m_layoutView.frameView()->isScrollable(); |
| - return layer->layoutObject().style()->position() == EPosition::kSticky && |
| - layer->ancestorOverflowLayer()->scrollsOverflow(); |
| + |
| + if (layer->layoutObject().style()->position() != EPosition::kSticky) |
| + return false; |
| + |
| + // Don't promote nested sticky elements; the compositor can't handle them. |
| + // TODO(smcgruer): Add cc nested sticky support (http://crbug.com/672710) |
| + StickyPositionScrollingConstraints* constraints = |
| + stickyConstraintsForLayoutObject(&layer->layoutObject()); |
| + return layer->ancestorOverflowLayer()->scrollsOverflow() && |
| + !constraints->hasAncestorStickyElement(); |
|
flackr
2017/02/22 22:40:15
stickyConstraintsForLayoutObject can return null b
smcgruer
2017/02/23 20:14:17
Done.
|
| } |
| } // namespace blink |