Chromium Code Reviews| Index: Source/core/rendering/RenderBoxModelObject.cpp |
| diff --git a/Source/core/rendering/RenderBoxModelObject.cpp b/Source/core/rendering/RenderBoxModelObject.cpp |
| index f4dacfa008004a50214b69139cf1b2e848fa3eaf..a71b4f50c21d6aee02d162875b4214a6b61a802e 100644 |
| --- a/Source/core/rendering/RenderBoxModelObject.cpp |
| +++ b/Source/core/rendering/RenderBoxModelObject.cpp |
| @@ -319,23 +319,43 @@ void RenderBoxModelObject::computeStickyPositionConstraints(StickyPositionViewpo |
| FloatRect absoluteStickyBoxRect(absContainerFrame.location() + stickyLocation, flippedStickyBoxRect.size()); |
| constraints.setAbsoluteStickyBoxRect(absoluteStickyBoxRect); |
| - if (!style()->left().isAuto()) { |
| + float horizontalOffsets = constraints.rightOffset() + constraints.leftOffset(); |
| + bool skipRight = false; |
| + bool skipLeft = false; |
| + if (!style()->left().isAuto() && !style()->right().isAuto()) { |
| + if (horizontalOffsets > containerContentRect.width().toFloat() |
| + || horizontalOffsets + containerContentRect.width().toFloat() > constrainingRect.width()) { |
|
Julien - ping for review
2014/05/22 15:49:02
[It's better to use a generated 'reply' comment, t
|
| + skipRight = style()->isLeftToRightDirection(); |
| + skipLeft = !skipRight; |
| + } |
| + } |
| + |
| + if (!style()->left().isAuto() && !skipLeft) { |
| constraints.setLeftOffset(floatValueForLength(style()->left(), constrainingRect.width())); |
| constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeLeft); |
| } |
| - if (!style()->right().isAuto()) { |
| + if (!style()->right().isAuto() && !skipRight) { |
| constraints.setRightOffset(floatValueForLength(style()->right(), constrainingRect.width())); |
| constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeRight); |
| } |
| + bool skipBottom = false; |
|
Julien - ping for review
2014/05/22 15:49:02
Let's add a FIXME about that and ideally a link to
ostap
2014/05/22 23:13:11
Done.
|
| + float verticalOffsets = constraints.topOffset() + constraints.bottomOffset(); |
| + if (!style()->top().isAuto() && !style()->bottom().isAuto()) { |
| + if (verticalOffsets > containerContentRect.height().toFloat() |
| + || verticalOffsets + containerContentRect.height().toFloat() > constrainingRect.height()) { |
| + skipBottom = true; |
| + } |
| + } |
| + |
| 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() )); |
| + if (!style()->bottom().isAuto() && !skipBottom) { |
| + constraints.setBottomOffset(floatValueForLength(style()->bottom(), constrainingRect.height())); |
| constraints.addAnchorEdge(ViewportConstraints::AnchorEdgeBottom); |
| } |
| } |