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; 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::wrapNextToShapeOutside(bool isFirstLine) { LayoutUnit lineHeight = m_block.lineHeight( isFirstLine, m_block.isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); LayoutUnit lineLogicalTop = m_block.logicalHeight(); LayoutUnit newLineTop = lineLogicalTop; LayoutUnit floatLogicalBottom = m_block.nextFloatLogicalBottomBelow(lineLogicalTop); LayoutUnit newLineWidth; LayoutUnit newLineLeft = m_left; LayoutUnit newLineRight = m_right; while (true) { newLineWidth = availableWidthAtOffset(m_block, newLineTop, indentText(), newLineLeft, newLineRight, lineHeight); if (newLineWidth >= m_uncommittedWidth) break; if (newLineTop >= floatLogicalBottom) break; newLineTop++; } updateLineDimension(newLineTop, LayoutUnit(newLineWidth), newLineLeft, newLineRight); }
inline static bool isWholeLineFit(const RenderBlockFlow& block, const LayoutUnit& lineTop, LayoutUnit lineHeight, float uncommittedWidth, bool shouldIndentText) { for (LayoutUnit lineBottom = lineTop; lineBottom <= lineTop + lineHeight; lineBottom++) { LayoutUnit availableWidthAtBottom = availableWidthAtOffset(block, lineBottom, shouldIndentText); if (availableWidthAtBottom < uncommittedWidth) return false; } return true; }