Chromium Code Reviews| Index: Source/core/rendering/RenderBlockLineLayout.cpp |
| diff --git a/Source/core/rendering/RenderBlockLineLayout.cpp b/Source/core/rendering/RenderBlockLineLayout.cpp |
| index e3e1da8245bfadf54a2d1745862f63f05d5d5a4a..ee10a74b5b2468ebcc1445cb33de0a5c717d12c1 100644 |
| --- a/Source/core/rendering/RenderBlockLineLayout.cpp |
| +++ b/Source/core/rendering/RenderBlockLineLayout.cpp |
| @@ -181,6 +181,28 @@ inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa |
| return; |
| #if ENABLE(CSS_EXCLUSIONS) |
|
Julien - ping for review
2013/04/17 21:20:22
We should probably remove these.
|
| + // When floats with shape outside are stacked, the floats are positioned based on the bounding box of the shape, |
| + // not the shape's contour. Since we computed the width based on the shape contour when we added the float, |
| + // when we add a subsequent float on the same line, we need to undo the shape delta in order to position |
| + // based on the bounding box. In order to do this, we need to walk back through the floating object list to find |
| + // the first previous float that is on the same side as our newFloat. |
| + ExclusionShapeOutsideInfo* previousShapeOutsideInfo = 0; |
| + const RenderBlock::FloatingObjectSet& floatingObjectSet = m_block->m_floatingObjects->set(); |
| + RenderBlock::FloatingObjectSetIterator it = floatingObjectSet.end(); |
| + RenderBlock::FloatingObjectSetIterator begin = floatingObjectSet.begin(); |
| + while (it != begin) { |
| + --it; |
| + RenderBlock::FloatingObject* previousFloat = *it; |
| + if (previousFloat != newFloat && previousFloat->type() == newFloat->type()) { |
| + previousShapeOutsideInfo = previousFloat->renderer()->exclusionShapeOutsideInfo(); |
| + if (previousShapeOutsideInfo) { |
| + LayoutUnit lineTopInShapeCoordinates = m_block->logicalHeight() - m_block->logicalTopForFloat(previousFloat) + previousShapeOutsideInfo->shapeLogicalTop(); |
| + previousShapeOutsideInfo->computeSegmentsForLine(lineTopInShapeCoordinates, logicalHeightForLine(m_block, m_isFirstLine)); |
| + } |
| + break; |
| + } |
| + } |
| + |
| ExclusionShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->exclusionShapeOutsideInfo(); |
| if (shapeOutsideInfo) |
| shapeOutsideInfo->computeSegmentsForLine(m_block->logicalHeight() - m_block->logicalTopForFloat(newFloat) + shapeOutsideInfo->shapeLogicalTop(), logicalHeightForLine(m_block, m_isFirstLine)); |
| @@ -189,6 +211,8 @@ inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa |
| if (newFloat->type() == RenderBlock::FloatingObject::FloatLeft) { |
| float newLeft = m_block->logicalRightForFloat(newFloat); |
| #if ENABLE(CSS_EXCLUSIONS) |
| + if (previousShapeOutsideInfo) |
| + newLeft -= previousShapeOutsideInfo->rightSegmentShapeBoundingBoxDelta(); |
| if (shapeOutsideInfo) |
| newLeft += shapeOutsideInfo->rightSegmentShapeBoundingBoxDelta(); |
| #endif |
| @@ -199,6 +223,8 @@ inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa |
| } else { |
| float newRight = m_block->logicalLeftForFloat(newFloat); |
| #if ENABLE(CSS_EXCLUSIONS) |
| + if (previousShapeOutsideInfo) |
| + newRight -= previousShapeOutsideInfo->leftSegmentShapeBoundingBoxDelta(); |
| if (shapeOutsideInfo) |
| newRight += shapeOutsideInfo->leftSegmentShapeBoundingBoxDelta(); |
| #endif |