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

Unified Diff: Source/core/rendering/RenderBoxModelObject.cpp

Issue 267063007: Fix overconstrained behaviour for position: sticky. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « Source/core/page/scrolling/ScrollingConstraints.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBoxModelObject.cpp
diff --git a/Source/core/rendering/RenderBoxModelObject.cpp b/Source/core/rendering/RenderBoxModelObject.cpp
index 05743f6f538712356fb96c67ee003de927682691..231fde0c22179ed525fd0be2416e7f6cd9ba7c06 100644
--- a/Source/core/rendering/RenderBoxModelObject.cpp
+++ b/Source/core/rendering/RenderBoxModelObject.cpp
@@ -329,15 +329,34 @@ void RenderBoxModelObject::computeStickyPositionConstraints(StickyPositionViewpo
constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeRight);
}
+ float offsetsSum = constraints.rightOffset() + constraints.leftOffset();
Julien - ping for review 2014/05/16 13:17:49 We should rename this to a better name: verticalOf
ostap 2014/05/22 04:33:19 Done.
+ if (offsetsSum > containerContentRect.width().toFloat()
+ || offsetsSum + containerContentRect.width().toFloat() > constrainingRect.width()) {
+ if (style()->isLeftToRightDirection()) {
+ constraints.setRightOffset(0);
+ constraints.removeAnchorEdge(ViewportConstraints::AnchorEdgeRight);
+ } else {
+ constraints.setLeftOffset(0);
+ constraints.removeAnchorEdge(ViewportConstraints::AnchorEdgeLeft);
Julien - ping for review 2014/05/16 13:17:49 It would be cleaner if we didn't set the anchor ed
ostap 2014/05/22 04:33:19 Done
+ }
+ }
+
if (!style()->top().isAuto()) {
constraints.setTopOffset(floatValueForLength(style()->top(), constrainingRect.height()));
constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeTop);
}
if (!style()->bottom().isAuto()) {
- constraints.setBottomOffset(floatValueForLength(style()->bottom(), constrainingRect.height() ));
+ constraints.setBottomOffset(floatValueForLength(style()->bottom(), constrainingRect.height()));
constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeBottom);
}
+
+ offsetsSum = constraints.topOffset() + constraints.bottomOffset();
+ if (offsetsSum > containerContentRect.height().toFloat()
+ || offsetsSum + containerContentRect.height().toFloat() > constrainingRect.height()) {
+ constraints.setBottomOffset(0);
+ constraints.removeAnchorEdge(ViewportConstraints::AnchorEdgeBottom);
+ }
Julien - ping for review 2014/05/16 13:17:49 Shouldn't you check if our writing mode is not bot
ostap 2014/05/22 04:33:19 The over-constrained behavior is done similar to p
}
LayoutSize RenderBoxModelObject::stickyPositionOffset() const
« no previous file with comments | « Source/core/page/scrolling/ScrollingConstraints.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698