Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp |
| index 1076826b28bd9a6aa4651db6a5eb340c0e3a0ee0..f7bed6a20d8c98621454d9126cb9e0fe4e395b75 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp |
| @@ -74,13 +74,13 @@ LayoutBoxModelObject* findFirstStickyBetween(LayoutObject* from, |
| LayoutObject* to) { |
| LayoutObject* maybeStickyAncestor = from; |
| while (maybeStickyAncestor && maybeStickyAncestor != to) { |
| - if (maybeStickyAncestor->isStickyPositioned()) { |
| + if (maybeStickyAncestor->style()->hasStickyConstrainedPosition()) { |
| return toLayoutBoxModelObject(maybeStickyAncestor); |
| } |
| maybeStickyAncestor = |
| maybeStickyAncestor->isLayoutInline() |
| - ? maybeStickyAncestor->containingBlock() |
| + ? maybeStickyAncestor->container() |
|
flackr
2017/03/20 21:04:59
Stephen I noticed when I added an unanchored stick
smcgruer
2017/03/21 14:06:19
Good catch, this should not have been jumping to t
chrishtr
2017/03/21 16:43:16
container() is the containing block. containingBlo
flackr
2017/03/21 16:56:32
FYI, container() isn't equivalent to CSS containin
|
| : toLayoutBox(maybeStickyAncestor)->locationContainer(); |
| } |
| return nullptr; |
| @@ -249,7 +249,8 @@ void LayoutBoxModelObject::willBeDestroyed() { |
| // 0 during destruction. |
| if (LocalFrame* frame = this->frame()) { |
| if (FrameView* frameView = frame->view()) { |
| - if (style()->hasViewportConstrainedPosition()) |
| + if (style()->hasViewportConstrainedPosition() || |
| + style()->hasStickyConstrainedPosition()) |
| frameView->removeViewportConstrainedObject(*this); |
| } |
| } |
| @@ -430,9 +431,9 @@ void LayoutBoxModelObject::styleDidChange(StyleDifference diff, |
| style()->position() == EPosition::kFixed; |
| bool oldStyleIsViewportConstrained = |
| oldStyle && oldStyle->position() == EPosition::kFixed; |
| - bool newStyleIsSticky = style()->position() == EPosition::kSticky; |
| + bool newStyleIsSticky = style()->hasStickyConstrainedPosition(); |
| bool oldStyleIsSticky = |
| - oldStyle && oldStyle->position() == EPosition::kSticky; |
| + oldStyle && oldStyle->hasStickyConstrainedPosition(); |
| if (newStyleIsSticky != oldStyleIsSticky) { |
| if (newStyleIsSticky) { |
| @@ -1053,6 +1054,8 @@ void LayoutBoxModelObject::updateStickyPositionConstraints() const { |
| constraints.addAnchorEdge( |
| StickyPositionScrollingConstraints::AnchorEdgeBottom); |
| } |
| + // At least one edge should be anchored if we are calculating constraints. |
| + DCHECK(constraints.anchorEdges()); |
| scrollableArea->stickyConstraintsMap().set(layer(), constraints); |
| } |