diff options
Diffstat (limited to 'WebCore/rendering/RenderBlockLineLayout.cpp')
-rw-r--r-- | WebCore/rendering/RenderBlockLineLayout.cpp | 69 |
1 files changed, 29 insertions, 40 deletions
diff --git a/WebCore/rendering/RenderBlockLineLayout.cpp b/WebCore/rendering/RenderBlockLineLayout.cpp index 3950372..14e7dce 100644 --- a/WebCore/rendering/RenderBlockLineLayout.cpp +++ b/WebCore/rendering/RenderBlockLineLayout.cpp @@ -770,11 +770,8 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, bool // The widths of all runs are now known. We can now place every inline box (and // compute accurate widths for the inline flow boxes). - int leftPosition = x; - int rightPosition = x; needsWordSpacing = false; - lineBox->placeBoxesHorizontally(x, leftPosition, rightPosition, needsWordSpacing); - lineBox->setHorizontalOverflowPositions(leftPosition, rightPosition); + lineBox->placeBoxesHorizontally(x, needsWordSpacing); } void RenderBlock::computeVerticalPositionsForLine(RootInlineBox* lineBox, BidiRun* firstRun) @@ -782,11 +779,6 @@ void RenderBlock::computeVerticalPositionsForLine(RootInlineBox* lineBox, BidiRu setHeight(lineBox->verticallyAlignBoxes(height())); lineBox->setBlockHeight(height()); - // See if the line spilled out. If so set overflow height accordingly. - int bottomOfLine = lineBox->bottomOverflow(); - if (bottomOfLine > height() && bottomOfLine > m_overflowHeight) - m_overflowHeight = bottomOfLine; - // Now make sure we place replaced render objects correctly. for (BidiRun* r = firstRun; r; r = r->next()) { ASSERT(r->m_box); @@ -831,7 +823,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i { bool useRepaintBounds = false; - m_overflowHeight = 0; + m_overflow.clear(); setHeight(borderTop() + paddingTop()); int toAdd = borderBottom() + paddingBottom() + horizontalScrollbarHeight(); @@ -855,14 +847,13 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i if (firstChild()) { #ifdef ANDROID_LAYOUT - // if we are in fitColumnToScreen mode and viewport width is not device-width, + // if we are in fitColumnToScreen mode // and the current object is not float:right in LTR or not float:left in RTL, // and text align is auto, or justify or left in LTR, or right in RTL, we // will wrap text around screen width so that it doesn't need to scroll // horizontally when reading a paragraph. const Settings* settings = document()->settings(); - bool doTextWrap = settings && settings->viewportWidth() != 0 && - settings->layoutAlgorithm() == Settings::kLayoutFitColumnToScreen; + bool doTextWrap = settings && settings->layoutAlgorithm() == Settings::kLayoutFitColumnToScreen; if (doTextWrap) { int ta = style()->textAlign(); int dir = style()->direction(); @@ -873,7 +864,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i EFloat cssfloat = style()->floating(); doTextWrap = autowrap && !positioned && (((dir == LTR && cssfloat != FRIGHT) || - (dir == RTL && cssfloat != FLEFT)) && + (dir == RTL && cssfloat != FLEFT)) && ((ta == TAAUTO) || (ta == JUSTIFY) || ((ta == LEFT || ta == WEBKIT_LEFT) && (dir == LTR)) || ((ta == RIGHT || ta == WEBKIT_RIGHT) && (dir == RTL)))); @@ -956,7 +947,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i break; } if (obj->isFloating() || obj->isPositioned()) { - // floating and absolute or fixed positioning are done out + // floating and absolute or fixed positioning are done out // of normal flow. Don't need to worry about height any more. break; } @@ -978,7 +969,13 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i setWidth(min(width(), maxWidth)); m_minPrefWidth = min(m_minPrefWidth, maxWidth); m_maxPrefWidth = min(m_maxPrefWidth, maxWidth); - m_overflowWidth = min(m_overflowWidth, maxWidth); + + IntRect overflow = layoutOverflowRect(); + if (overflow.width() > maxWidth) { + overflow.setWidth(maxWidth); + clearLayoutOverflow(); + addLayoutOverflow(overflow); + } } } } @@ -1022,8 +1019,8 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i RenderArena* arena = renderArena(); RootInlineBox* box = startLine; while (box) { - repaintTop = min(repaintTop, box->topOverflow()); - repaintBottom = max(repaintBottom, box->bottomOverflow()); + repaintTop = min(repaintTop, box->topVisibleOverflow()); + repaintBottom = max(repaintBottom, box->bottomVisibleOverflow()); RootInlineBox* next = box->nextRootBox(); box->deleteLine(arena); box = next; @@ -1159,8 +1156,8 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i if (lineBox) { lineBox->setLineBreakInfo(end.obj, end.pos, resolver.status()); if (useRepaintBounds) { - repaintTop = min(repaintTop, lineBox->topOverflow()); - repaintBottom = max(repaintBottom, lineBox->bottomOverflow()); + repaintTop = min(repaintTop, lineBox->topVisibleOverflow()); + repaintBottom = max(repaintBottom, lineBox->bottomVisibleOverflow()); } } @@ -1199,8 +1196,8 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i for (RootInlineBox* line = endLine; line; line = line->nextRootBox()) { line->attachLine(); if (delta) { - repaintTop = min(repaintTop, line->topOverflow() + min(delta, 0)); - repaintBottom = max(repaintBottom, line->bottomOverflow() + max(delta, 0)); + repaintTop = min(repaintTop, line->topVisibleOverflow() + min(delta, 0)); + repaintBottom = max(repaintBottom, line->bottomVisibleOverflow() + max(delta, 0)); line->adjustPosition(0, delta); } if (Vector<RenderBox*>* cleanLineFloats = line->floatsPtr()) { @@ -1216,12 +1213,12 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i setHeight(lastRootBox()->blockHeight()); } else { // Delete all the remaining lines. - InlineRunBox* line = endLine; + RootInlineBox* line = endLine; RenderArena* arena = renderArena(); while (line) { - repaintTop = min(repaintTop, line->topOverflow()); - repaintBottom = max(repaintBottom, line->bottomOverflow()); - InlineRunBox* next = line->nextLineBox(); + repaintTop = min(repaintTop, line->topVisibleOverflow()); + repaintBottom = max(repaintBottom, line->bottomVisibleOverflow()); + RootInlineBox* next = line->nextRootBox(); line->deleteLine(arena); line = next; } @@ -1259,12 +1256,6 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, int& repaintTop, i // Now add in the bottom border/padding. setHeight(height() + toAdd); - // Always make sure this is at least our height. - m_overflowHeight = max(height(), m_overflowHeight); - - // See if any lines spill out of the block. If so, we need to update our overflow width. - checkLinesForOverflow(); - if (!firstLineBox() && hasLineIfEmpty()) setHeight(height() + lineHeight(true, true)); @@ -1491,8 +1482,8 @@ bool RenderBlock::matchedEndLine(const InlineBidiResolver& resolver, const Inlin RootInlineBox* boxToDelete = endLine; RenderArena* arena = renderArena(); while (boxToDelete && boxToDelete != result) { - repaintTop = min(repaintTop, boxToDelete->topOverflow()); - repaintBottom = max(repaintBottom, boxToDelete->bottomOverflow()); + repaintTop = min(repaintTop, boxToDelete->topVisibleOverflow()); + repaintBottom = max(repaintBottom, boxToDelete->bottomVisibleOverflow()); RootInlineBox* next = boxToDelete->nextRootBox(); boxToDelete->deleteLine(arena); boxToDelete = next; @@ -2312,14 +2303,12 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool return lBreak; } -void RenderBlock::checkLinesForOverflow() +void RenderBlock::addOverflowFromInlineChildren() { - m_overflowWidth = width(); for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) { - m_overflowLeft = min(curr->leftOverflow(), m_overflowLeft); - m_overflowTop = min(curr->topOverflow(), m_overflowTop); - m_overflowWidth = max(curr->rightOverflow(), m_overflowWidth); - m_overflowHeight = max(curr->bottomOverflow(), m_overflowHeight); + addLayoutOverflow(curr->layoutOverflowRect()); + if (!hasOverflowClip()) + addVisualOverflow(curr->visualOverflowRect()); } } |