Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp

Issue 2769353002: Only create sticky position constraints for constrained sticky position. (Closed)
Patch Set: Set dependent patch. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..089e1851d78d96b3f06043b49dffd355f17a4c41 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
@@ -74,7 +74,7 @@ LayoutBoxModelObject* findFirstStickyBetween(LayoutObject* from,
LayoutObject* to) {
LayoutObject* maybeStickyAncestor = from;
while (maybeStickyAncestor && maybeStickyAncestor != to) {
- if (maybeStickyAncestor->isStickyPositioned()) {
+ if (maybeStickyAncestor->style()->hasStickyConstrainedPosition()) {
return toLayoutBoxModelObject(maybeStickyAncestor);
}
@@ -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);
}

Powered by Google App Engine
This is Rietveld 408576698