| Index: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
|
| index 9ccc571f92f13b4630fbe0964a6a8d79db5369b6..16146d16488c38a33004f56b7cd2eaa297a6638a 100644
|
| --- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
|
| @@ -50,6 +50,7 @@
|
| #include "core/page/ChromeClient.h"
|
| #include "core/page/Page.h"
|
| #include "core/page/scrolling/ScrollingCoordinator.h"
|
| +#include "core/page/scrolling/StickyPositionScrollingConstraints.h"
|
| #include "core/paint/ObjectPaintInvalidator.h"
|
| #include "core/paint/PaintInfo.h"
|
| #include "core/paint/PaintLayerPainter.h"
|
| @@ -71,6 +72,7 @@
|
| #include "platform/graphics/paint/PaintController.h"
|
| #include "platform/graphics/paint/SkPictureBuilder.h"
|
| #include "platform/graphics/paint/TransformDisplayItem.h"
|
| +#include "public/platform/WebLayerStickyPositionConstraint.h"
|
| #include "wtf/CurrentTime.h"
|
| #include "wtf/text/StringBuilder.h"
|
| #include <memory>
|
| @@ -231,6 +233,7 @@ void CompositedLayerMapping::createPrimaryGraphicsLayer()
|
| updateTransform(layoutObject()->styleRef());
|
| updateFilters(layoutObject()->styleRef());
|
| updateBackdropFilters(layoutObject()->styleRef());
|
| + updateStickyConstraints(layoutObject()->styleRef());
|
| updateLayerBlendMode(layoutObject()->styleRef());
|
| updateIsRootForIsolatedGroup();
|
| }
|
| @@ -281,6 +284,38 @@ void CompositedLayerMapping::updateBackdropFilters(const ComputedStyle& style)
|
| m_graphicsLayer->setBackdropFilters(owningLayer().computeBackdropFilterOperations(style));
|
| }
|
|
|
| +void CompositedLayerMapping::updateStickyConstraints(const ComputedStyle& style)
|
| +{
|
| + bool sticky = style.position() == EPosition::StickyPosition;
|
| + const PaintLayer* ancestorOverflowLayer = m_owningLayer.ancestorOverflowLayer();
|
| + // TODO(flackr): Do we still need this?
|
| + if (sticky) {
|
| + if (!ancestorOverflowLayer->isRootLayer()) {
|
| + sticky = ancestorOverflowLayer->needsCompositedScrolling();
|
| + } else {
|
| + sticky = layoutObject()->view()->frameView()->isScrollable();
|
| + }
|
| + }
|
| +
|
| + WebLayerStickyPositionConstraint webConstraint;
|
| + if (sticky) {
|
| + const StickyPositionScrollingConstraints& constraints = ancestorOverflowLayer->getScrollableArea()->stickyConstraintsMap().get(&m_owningLayer);
|
| + webConstraint.isSticky = true;
|
| + webConstraint.isAnchoredLeft = constraints.anchorEdges() & StickyPositionScrollingConstraints::AnchorEdgeLeft;
|
| + webConstraint.isAnchoredRight = constraints.anchorEdges() & StickyPositionScrollingConstraints::AnchorEdgeRight;
|
| + webConstraint.isAnchoredTop = constraints.anchorEdges() & StickyPositionScrollingConstraints::AnchorEdgeTop;
|
| + webConstraint.isAnchoredBottom = constraints.anchorEdges() & StickyPositionScrollingConstraints::AnchorEdgeBottom;
|
| + webConstraint.leftOffset = constraints.leftOffset();
|
| + webConstraint.rightOffset = constraints.rightOffset();
|
| + webConstraint.topOffset = constraints.topOffset();
|
| + webConstraint.bottomOffset = constraints.bottomOffset();
|
| + webConstraint.absoluteStickyBoxRect = enclosingIntRect(constraints.scrollContainerRelativeStickyBoxRect());
|
| + webConstraint.absoluteContainingBlockRect = enclosingIntRect(constraints.scrollContainerRelativeContainingBlockRect());
|
| + }
|
| +
|
| + m_graphicsLayer->setStickyPositionConstraint(webConstraint);
|
| +}
|
| +
|
| void CompositedLayerMapping::updateLayerBlendMode(const ComputedStyle& style)
|
| {
|
| setBlendMode(style.blendMode());
|
| @@ -735,6 +770,8 @@ void CompositedLayerMapping::updateGraphicsLayerGeometry(const PaintLayer* compo
|
| if (!layoutObject()->style()->isRunningBackdropFilterAnimationOnCompositor())
|
| updateBackdropFilters(layoutObject()->styleRef());
|
|
|
| + updateStickyConstraints(layoutObject()->styleRef());
|
| +
|
| // We compute everything relative to the enclosing compositing layer.
|
| IntRect ancestorCompositingBounds;
|
| if (compositingContainer) {
|
|
|