void LineWidth::fitBelowFloats(bool isFirstLine) { ASSERT(!m_committedWidth); ASSERT(!fitsOnLine()); LayoutUnit floatLogicalBottom; LayoutUnit lastFloatLogicalBottom = m_block.logicalHeight(); float newLineWidth = m_availableWidth; float newLineLeft = m_left; float newLineRight = m_right; FloatingObject* lastFloatFromPreviousLine = (m_block.containsFloats() ? m_block.m_floatingObjects->set().last().get() : 0); if (lastFloatFromPreviousLine && lastFloatFromPreviousLine->renderer()->shapeOutsideInfo()) return wrapNextToShapeOutside(isFirstLine); while (true) { floatLogicalBottom = m_block.nextFloatLogicalBottomBelow(lastFloatLogicalBottom, ShapeOutsideFloatShapeOffset); if (floatLogicalBottom <= lastFloatLogicalBottom) break; newLineWidth = availableWidthAtOffset(m_block, floatLogicalBottom, shouldIndentText(), newLineLeft, newLineRight); lastFloatLogicalBottom = floatLogicalBottom; if (newLineWidth >= m_uncommittedWidth) break; } updateLineDimension(lastFloatLogicalBottom, newLineWidth, newLineLeft, newLineRight); }
void LineWidth::fitBelowFloats(bool isFirstLine) { ASSERT(!m_committedWidth); ASSERT(!fitsOnLine()); m_block.positionNewFloats(m_block.logicalHeight(), this); LayoutUnit floatLogicalBottom; LayoutUnit lastFloatLogicalBottom = m_block.logicalHeight(); LayoutUnit newLineWidth = m_availableWidth; LayoutUnit newLineLeft = m_left; LayoutUnit newLineRight = m_right; FloatingObject* lastFloatFromPreviousLine = m_block.lastFloatFromPreviousLine(); if (lastFloatFromPreviousLine && lastFloatFromPreviousLine->layoutObject()->shapeOutsideInfo()) return wrapNextToShapeOutside(isFirstLine); while (true) { floatLogicalBottom = m_block.nextFloatLogicalBottomBelow(lastFloatLogicalBottom); if (floatLogicalBottom <= lastFloatLogicalBottom) break; newLineWidth = availableWidthAtOffset( m_block, floatLogicalBottom, indentText(), newLineLeft, newLineRight); lastFloatLogicalBottom = floatLogicalBottom; if (newLineWidth >= m_uncommittedWidth) break; } updateLineDimension(lastFloatLogicalBottom, LayoutUnit(newLineWidth), newLineLeft, newLineRight); }
void LineWidth::fitBelowFloats(bool isFirstLine) { ASSERT(!m_committedWidth); ASSERT(!fitsOnLine()); LayoutUnit floatLogicalBottom; LayoutUnit lastFloatLogicalBottom = m_block.logicalHeight(); float newLineWidth = m_availableWidth; float newLineLeft = m_left; float newLineRight = m_right; while (true) { floatLogicalBottom = lastFloatLogicalBottom; if (floatLogicalBottom <= lastFloatLogicalBottom) break; newLineLeft = m_block.logicalLeftOffsetForLine(shouldIndentText()).toFloat(); newLineRight = m_block.logicalRightOffsetForLine(shouldIndentText()).toFloat(); newLineWidth = std::max(0.0f, newLineRight - newLineLeft); lastFloatLogicalBottom = floatLogicalBottom; if (newLineWidth >= m_uncommittedWidth) break; } updateLineDimension(lastFloatLogicalBottom, newLineWidth, newLineLeft, newLineRight); }
void LineWidth::fitBelowFloats() { ASSERT(!m_committedWidth); ASSERT(!fitsOnLine()); LayoutUnit floatLogicalBottom; LayoutUnit lastFloatLogicalBottom = m_block.logicalHeight(); float newLineWidth = m_availableWidth; float newLineLeft = m_left; float newLineRight = m_right; while (true) { floatLogicalBottom = m_block.nextFloatLogicalBottomBelow(lastFloatLogicalBottom, ShapeOutsideFloatShapeOffset); if (floatLogicalBottom <= lastFloatLogicalBottom) break; newLineLeft = m_block.logicalLeftOffsetForLine(floatLogicalBottom, shouldIndentText()); newLineRight = m_block.logicalRightOffsetForLine(floatLogicalBottom, shouldIndentText()); newLineWidth = max(0.0f, newLineRight - newLineLeft); lastFloatLogicalBottom = floatLogicalBottom; #if ENABLE(CSS_SHAPES) // FIXME: This code should be refactored to incorporate with the code above. ShapeInsideInfo* shapeInsideInfo = m_block.layoutShapeInsideInfo(); if (shapeInsideInfo) { LayoutUnit logicalOffsetFromShapeContainer = m_block.logicalOffsetFromShapeAncestorContainer(shapeInsideInfo->owner()).height(); LayoutUnit lineHeight = m_block.lineHeight(false, m_block.isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); shapeInsideInfo->updateSegmentsForLine(lastFloatLogicalBottom + logicalOffsetFromShapeContainer, lineHeight); updateCurrentShapeSegment(); updateAvailableWidth(); } #endif if (newLineWidth >= m_uncommittedWidth) break; } if (newLineWidth > m_availableWidth) { m_block.setLogicalHeight(lastFloatLogicalBottom); m_availableWidth = newLineWidth + m_overhangWidth; m_left = newLineLeft; m_right = newLineRight; } }