Ejemplo n.º 1
0
LineWidth::LineWidth(LineLayoutBlockFlow block,
                     bool isFirstLine,
                     IndentTextOrNot indentText)
    : m_block(block),
      m_uncommittedWidth(0),
      m_committedWidth(0),
      m_overhangWidth(0),
      m_trailingWhitespaceWidth(0),
      m_isFirstLine(isFirstLine),
      m_indentText(indentText) {
  updateAvailableWidth();
}
Ejemplo n.º 2
0
LineWidth::LineWidth(RenderParagraph& block, bool isFirstLine, IndentTextOrNot shouldIndentText)
    : m_block(block)
    , m_uncommittedWidth(0)
    , m_committedWidth(0)
    , m_trailingWhitespaceWidth(0)
    , m_left(0)
    , m_right(0)
    , m_availableWidth(0)
    , m_shouldIndentText(shouldIndentText)
{
    updateAvailableWidth();
}
Ejemplo n.º 3
0
LineWidth::LineWidth(RenderBlockFlow& block, bool isFirstLine, IndentTextOrNot shouldIndentText)
    : m_block(block)
    , m_uncommittedWidth(0)
    , m_committedWidth(0)
    , m_overhangWidth(0)
    , m_left(0)
    , m_right(0)
    , m_availableWidth(0)
    , m_isFirstLine(isFirstLine)
    , m_shouldIndentText(shouldIndentText)
{
    updateAvailableWidth();
}
Ejemplo n.º 4
0
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;
    }
}
Ejemplo n.º 5
0
LineWidth::LineWidth(RenderBlockFlow& block, bool isFirstLine, IndentTextOrNot shouldIndentText)
    : m_block(block)
    , m_uncommittedWidth(0)
    , m_committedWidth(0)
    , m_overhangWidth(0)
    , m_trailingWhitespaceWidth(0)
    , m_trailingCollapsedWhitespaceWidth(0)
    , m_left(0)
    , m_right(0)
    , m_availableWidth(0)
#if ENABLE(CSS_SHAPES)
    , m_segment(0)
#endif
    , m_isFirstLine(isFirstLine)
    , m_shouldIndentText(shouldIndentText)
{
#if ENABLE(CSS_SHAPES)
    updateCurrentShapeSegment();
#endif
    updateAvailableWidth();
}