Chromium Code Reviews| Index: Source/WebCore/rendering/RenderBlockLineLayout.cpp |
| diff --git a/Source/WebCore/rendering/RenderBlockLineLayout.cpp b/Source/WebCore/rendering/RenderBlockLineLayout.cpp |
| index 5ec6851eb6de76292d3c6d88c78296870563715e..181e4b1651b0f79ba5979249743eeef858b35c52 100644 |
| --- a/Source/WebCore/rendering/RenderBlockLineLayout.cpp |
| +++ b/Source/WebCore/rendering/RenderBlockLineLayout.cpp |
| @@ -182,6 +182,25 @@ inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa |
| return; |
| #if ENABLE(CSS_EXCLUSIONS) |
| + // 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* lastShapeOutsideInfo = 0; |
| + const RenderBlock::FloatingObjectSet& floatingObjectSet = m_block->m_floatingObjects->set(); |
| + RenderBlock::FloatingObjectSetIterator it = floatingObjectSet.end(); |
| + RenderBlock::FloatingObjectSetIterator begin = floatingObjectSet.begin(); |
| + for (--it; it != begin; --it) { |
|
Julien - ping for review
2013/04/10 21:33:59
Won't this loop ignore the first float if it is yo
|
| + RenderBlock::FloatingObject* lastFloat = *it; |
| + if (lastFloat != newFloat && lastFloat->type() == newFloat->type()) { |
| + lastShapeOutsideInfo = lastFloat->renderer()->exclusionShapeOutsideInfo(); |
| + if (lastShapeOutsideInfo) |
| + lastShapeOutsideInfo->computeSegmentsForLine(m_block->logicalHeight() - m_block->logicalTopForFloat(lastFloat) + lastShapeOutsideInfo->shapeLogicalTop(), 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)); |
| @@ -190,6 +209,8 @@ inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa |
| if (newFloat->type() == RenderBlock::FloatingObject::FloatLeft) { |
| float newLeft = m_block->logicalRightForFloat(newFloat); |
| #if ENABLE(CSS_EXCLUSIONS) |
| + if (lastShapeOutsideInfo) |
| + newLeft -= lastShapeOutsideInfo->rightSegmentShapeBoundingBoxDelta(); |
| if (shapeOutsideInfo) |
| newLeft += shapeOutsideInfo->rightSegmentShapeBoundingBoxDelta(); |
| #endif |
| @@ -200,6 +221,8 @@ inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa |
| } else { |
| float newRight = m_block->logicalLeftForFloat(newFloat); |
| #if ENABLE(CSS_EXCLUSIONS) |
| + if (lastShapeOutsideInfo) |
| + newRight -= lastShapeOutsideInfo->leftSegmentShapeBoundingBoxDelta(); |
| if (shapeOutsideInfo) |
| newRight += shapeOutsideInfo->leftSegmentShapeBoundingBoxDelta(); |
| #endif |