| Index: third_party/WebKit/Source/core/paint/PaintLayer.cpp
|
| diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
|
| index abd609c8f6e5c374e79065e6f3e944837b4054fa..50f607fbc06c6831b00e0a8408a7e1b500d04c54 100644
|
| --- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
|
| @@ -69,6 +69,7 @@
|
| #include "core/layout/svg/LayoutSVGRoot.h"
|
| #include "core/page/Page.h"
|
| #include "core/page/scrolling/ScrollingCoordinator.h"
|
| +#include "core/page/scrolling/StickyPositionScrollingConstraints.h"
|
| #include "core/paint/BoxReflectionUtils.h"
|
| #include "core/paint/FilterEffectBuilder.h"
|
| #include "core/paint/ObjectPaintInvalidator.h"
|
| @@ -327,9 +328,17 @@ void PaintLayer::dirtyAncestorChainHasSelfPaintingLayerDescendantStatus() {
|
| }
|
| }
|
|
|
| -bool PaintLayer::sticksToViewport() const {
|
| - if (layoutObject().style()->position() != EPosition::kFixed &&
|
| - layoutObject().style()->position() != EPosition::kSticky)
|
| +bool PaintLayer::sticksToScroller() const {
|
| + return layoutObject().style()->position() == EPosition::kSticky &&
|
| + ancestorOverflowLayer()
|
| + ->getScrollableArea()
|
| + ->stickyConstraintsMap()
|
| + .at(const_cast<PaintLayer*>(this))
|
| + .anchorEdges();
|
| +}
|
| +
|
| +bool PaintLayer::fixedToViewport() const {
|
| + if (layoutObject().style()->position() != EPosition::kFixed)
|
| return false;
|
|
|
| // TODO(pdr): This approach of calculating the nearest scroll node is O(n).
|
| @@ -338,30 +347,24 @@ bool PaintLayer::sticksToViewport() const {
|
| if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
|
| const auto* viewProperties = layoutObject().view()->paintProperties();
|
| const ScrollPaintPropertyNode* ancestorTargetScrollNode;
|
| - if (layoutObject().style()->position() == EPosition::kFixed) {
|
| - ancestorTargetScrollNode = viewProperties->localBorderBoxProperties()
|
| - ->transform()
|
| - ->findEnclosingScrollNode();
|
| - } else {
|
| - ancestorTargetScrollNode = viewProperties->contentsProperties()
|
| - ->transform()
|
| - ->findEnclosingScrollNode();
|
| - }
|
| + ancestorTargetScrollNode = viewProperties->localBorderBoxProperties()
|
| + ->transform()
|
| + ->findEnclosingScrollNode();
|
|
|
| const auto* properties = layoutObject().paintProperties();
|
| const auto* transform = properties->localBorderBoxProperties()->transform();
|
| return transform->findEnclosingScrollNode() == ancestorTargetScrollNode;
|
| }
|
|
|
| - return (layoutObject().style()->position() == EPosition::kFixed &&
|
| - layoutObject().containerForFixedPosition() ==
|
| - layoutObject().view()) ||
|
| - (layoutObject().style()->position() == EPosition::kSticky &&
|
| - (!ancestorScrollingLayer() || ancestorScrollingLayer() == root()));
|
| + return layoutObject().containerForFixedPosition() == layoutObject().view();
|
| }
|
|
|
| bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const {
|
| - if (sticksToViewport() != other->sticksToViewport())
|
| + if (fixedToViewport() != other->fixedToViewport())
|
| + return true;
|
| + // If either element sticks we cannot trivially determine that the layers do
|
| + // not scroll with respect to each other.
|
| + if (sticksToScroller() || other->sticksToScroller())
|
| return true;
|
| return ancestorScrollingLayer() != other->ancestorScrollingLayer();
|
| }
|
|
|