Chromium Code Reviews| 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 |