| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. | 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ight reserved. |
| 4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 // Adding a pair of midpoints before a character will split it out into a new li
ne box. | 420 // Adding a pair of midpoints before a character will split it out into a new li
ne box. |
| 421 static inline void ensureCharacterGetsLineBox(LineMidpointState& lineMidpointSta
te, InlineIterator& textParagraphSeparator) | 421 static inline void ensureCharacterGetsLineBox(LineMidpointState& lineMidpointSta
te, InlineIterator& textParagraphSeparator) |
| 422 { | 422 { |
| 423 InlineIterator midpoint(0, textParagraphSeparator.m_obj, textParagraphSepara
tor.m_pos); | 423 InlineIterator midpoint(0, textParagraphSeparator.m_obj, textParagraphSepara
tor.m_pos); |
| 424 startIgnoringSpaces(lineMidpointState, InlineIterator(0, textParagraphSepara
tor.m_obj, textParagraphSeparator.m_pos - 1)); | 424 startIgnoringSpaces(lineMidpointState, InlineIterator(0, textParagraphSepara
tor.m_obj, textParagraphSeparator.m_pos - 1)); |
| 425 stopIgnoringSpaces(lineMidpointState, InlineIterator(0, textParagraphSeparat
or.m_obj, textParagraphSeparator.m_pos)); | 425 stopIgnoringSpaces(lineMidpointState, InlineIterator(0, textParagraphSeparat
or.m_obj, textParagraphSeparator.m_pos)); |
| 426 } | 426 } |
| 427 | 427 |
| 428 static inline BidiRun* createRun(int start, int end, RenderObject* obj, InlineBi
diResolver& resolver) | 428 static inline BidiRun* createRun(int start, int end, RenderObject* obj, InlineBi
diResolver& resolver) |
| 429 { | 429 { |
| 430 return new (obj->renderArena()) BidiRun(start, end, obj, resolver.context(),
resolver.dir()); | 430 return new BidiRun(start, end, obj, resolver.context(), resolver.dir()); |
| 431 } | 431 } |
| 432 | 432 |
| 433 void RenderBlock::appendRunsForObject(BidiRunList<BidiRun>& runs, int start, int
end, RenderObject* obj, InlineBidiResolver& resolver) | 433 void RenderBlock::appendRunsForObject(BidiRunList<BidiRun>& runs, int start, int
end, RenderObject* obj, InlineBidiResolver& resolver) |
| 434 { | 434 { |
| 435 if (start > end || shouldSkipCreatingRunsForObject(obj)) | 435 if (start > end || shouldSkipCreatingRunsForObject(obj)) |
| 436 return; | 436 return; |
| 437 | 437 |
| 438 LineMidpointState& lineMidpointState = resolver.midpointState(); | 438 LineMidpointState& lineMidpointState = resolver.midpointState(); |
| 439 bool haveNextMidpoint = (lineMidpointState.currentMidpoint < lineMidpointSta
te.numMidpoints); | 439 bool haveNextMidpoint = (lineMidpointState.currentMidpoint < lineMidpointSta
te.numMidpoints); |
| 440 InlineIterator nextMidpoint; | 440 InlineIterator nextMidpoint; |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 if (firstSpace == trailingSpaceRun->stop()) | 1196 if (firstSpace == trailingSpaceRun->stop()) |
| 1197 return 0; | 1197 return 0; |
| 1198 | 1198 |
| 1199 TextDirection direction = style()->direction(); | 1199 TextDirection direction = style()->direction(); |
| 1200 bool shouldReorder = trailingSpaceRun != (direction == LTR ? bidiRuns.lastRu
n() : bidiRuns.firstRun()); | 1200 bool shouldReorder = trailingSpaceRun != (direction == LTR ? bidiRuns.lastRu
n() : bidiRuns.firstRun()); |
| 1201 if (firstSpace != trailingSpaceRun->start()) { | 1201 if (firstSpace != trailingSpaceRun->start()) { |
| 1202 BidiContext* baseContext = currentContext; | 1202 BidiContext* baseContext = currentContext; |
| 1203 while (BidiContext* parent = baseContext->parent()) | 1203 while (BidiContext* parent = baseContext->parent()) |
| 1204 baseContext = parent; | 1204 baseContext = parent; |
| 1205 | 1205 |
| 1206 BidiRun* newTrailingRun = new (renderArena()) BidiRun(firstSpace, traili
ngSpaceRun->m_stop, trailingSpaceRun->m_object, baseContext, OtherNeutral); | 1206 BidiRun* newTrailingRun = new BidiRun(firstSpace, trailingSpaceRun->m_st
op, trailingSpaceRun->m_object, baseContext, OtherNeutral); |
| 1207 trailingSpaceRun->m_stop = firstSpace; | 1207 trailingSpaceRun->m_stop = firstSpace; |
| 1208 if (direction == LTR) | 1208 if (direction == LTR) |
| 1209 bidiRuns.addRun(newTrailingRun); | 1209 bidiRuns.addRun(newTrailingRun); |
| 1210 else | 1210 else |
| 1211 bidiRuns.prependRun(newTrailingRun); | 1211 bidiRuns.prependRun(newTrailingRun); |
| 1212 trailingSpaceRun = newTrailingRun; | 1212 trailingSpaceRun = newTrailingRun; |
| 1213 return trailingSpaceRun; | 1213 return trailingSpaceRun; |
| 1214 } | 1214 } |
| 1215 if (!shouldReorder) | 1215 if (!shouldReorder) |
| 1216 return trailingSpaceRun; | 1216 return trailingSpaceRun; |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1474 LayoutUnit& m_repaintLogicalTop; | 1474 LayoutUnit& m_repaintLogicalTop; |
| 1475 LayoutUnit& m_repaintLogicalBottom; | 1475 LayoutUnit& m_repaintLogicalBottom; |
| 1476 | 1476 |
| 1477 LayoutUnit m_adjustedLogicalLineTop; | 1477 LayoutUnit m_adjustedLogicalLineTop; |
| 1478 | 1478 |
| 1479 bool m_usesRepaintBounds; | 1479 bool m_usesRepaintBounds; |
| 1480 | 1480 |
| 1481 RenderFlowThread* m_flowThread; | 1481 RenderFlowThread* m_flowThread; |
| 1482 }; | 1482 }; |
| 1483 | 1483 |
| 1484 static void deleteLineRange(LineLayoutState& layoutState, RenderArena* arena, Ro
otInlineBox* startLine, RootInlineBox* stopLine = 0) | 1484 static void deleteLineRange(LineLayoutState& layoutState, RootInlineBox* startLi
ne, RootInlineBox* stopLine = 0) |
| 1485 { | 1485 { |
| 1486 RootInlineBox* boxToDelete = startLine; | 1486 RootInlineBox* boxToDelete = startLine; |
| 1487 while (boxToDelete && boxToDelete != stopLine) { | 1487 while (boxToDelete && boxToDelete != stopLine) { |
| 1488 layoutState.updateRepaintRangeFromBox(boxToDelete); | 1488 layoutState.updateRepaintRangeFromBox(boxToDelete); |
| 1489 // Note: deleteLineRange(renderArena(), firstRootBox()) is not identical
to deleteLineBoxTree(). | 1489 // Note: deleteLineRange(firstRootBox()) is not identical to deleteLineB
oxTree(). |
| 1490 // deleteLineBoxTree uses nextLineBox() instead of nextRootBox() when tr
aversing. | 1490 // deleteLineBoxTree uses nextLineBox() instead of nextRootBox() when tr
aversing. |
| 1491 RootInlineBox* next = boxToDelete->nextRootBox(); | 1491 RootInlineBox* next = boxToDelete->nextRootBox(); |
| 1492 boxToDelete->deleteLine(arena); | 1492 boxToDelete->deleteLine(); |
| 1493 boxToDelete = next; | 1493 boxToDelete = next; |
| 1494 } | 1494 } |
| 1495 } | 1495 } |
| 1496 | 1496 |
| 1497 void RenderBlock::layoutRunsAndFloats(LineLayoutState& layoutState, bool hasInli
neChild) | 1497 void RenderBlock::layoutRunsAndFloats(LineLayoutState& layoutState, bool hasInli
neChild) |
| 1498 { | 1498 { |
| 1499 // We want to skip ahead to the first dirty line | 1499 // We want to skip ahead to the first dirty line |
| 1500 InlineBidiResolver resolver; | 1500 InlineBidiResolver resolver; |
| 1501 RootInlineBox* startLine = determineStartPosition(layoutState, resolver); | 1501 RootInlineBox* startLine = determineStartPosition(layoutState, resolver); |
| 1502 | 1502 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1527 // We also find the first clean line and extract these lines. We will add t
hem back | 1527 // We also find the first clean line and extract these lines. We will add t
hem back |
| 1528 // if we determine that we're able to synchronize after handling all our dir
ty lines. | 1528 // if we determine that we're able to synchronize after handling all our dir
ty lines. |
| 1529 InlineIterator cleanLineStart; | 1529 InlineIterator cleanLineStart; |
| 1530 BidiStatus cleanLineBidiStatus; | 1530 BidiStatus cleanLineBidiStatus; |
| 1531 if (!layoutState.isFullLayout() && startLine) | 1531 if (!layoutState.isFullLayout() && startLine) |
| 1532 determineEndPosition(layoutState, startLine, cleanLineStart, cleanLineBi
diStatus); | 1532 determineEndPosition(layoutState, startLine, cleanLineStart, cleanLineBi
diStatus); |
| 1533 | 1533 |
| 1534 if (startLine) { | 1534 if (startLine) { |
| 1535 if (!layoutState.usesRepaintBounds()) | 1535 if (!layoutState.usesRepaintBounds()) |
| 1536 layoutState.setRepaintRange(logicalHeight()); | 1536 layoutState.setRepaintRange(logicalHeight()); |
| 1537 deleteLineRange(layoutState, renderArena(), startLine); | 1537 deleteLineRange(layoutState, startLine); |
| 1538 } | 1538 } |
| 1539 | 1539 |
| 1540 if (!layoutState.isFullLayout() && lastRootBox() && lastRootBox()->endsWithB
reak()) { | 1540 if (!layoutState.isFullLayout() && lastRootBox() && lastRootBox()->endsWithB
reak()) { |
| 1541 // If the last line before the start line ends with a line break that cl
ear floats, | 1541 // If the last line before the start line ends with a line break that cl
ear floats, |
| 1542 // adjust the height accordingly. | 1542 // adjust the height accordingly. |
| 1543 // A line break can be either the first or the last object on a line, de
pending on its direction. | 1543 // A line break can be either the first or the last object on a line, de
pending on its direction. |
| 1544 if (InlineBox* lastLeafChild = lastRootBox()->lastLeafChild()) { | 1544 if (InlineBox* lastLeafChild = lastRootBox()->lastLeafChild()) { |
| 1545 RenderObject* lastObject = lastLeafChild->renderer(); | 1545 RenderObject* lastObject = lastLeafChild->renderer(); |
| 1546 if (!lastObject->isBR()) | 1546 if (!lastObject->isBR()) |
| 1547 lastObject = lastRootBox()->firstLeafChild()->renderer(); | 1547 lastObject = lastRootBox()->firstLeafChild()->renderer(); |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1840 LayoutUnit adjustment = 0; | 1840 LayoutUnit adjustment = 0; |
| 1841 adjustLinePositionForPagination(lineBox, adjustment, layoutS
tate.flowThread()); | 1841 adjustLinePositionForPagination(lineBox, adjustment, layoutS
tate.flowThread()); |
| 1842 if (adjustment) { | 1842 if (adjustment) { |
| 1843 LayoutUnit oldLineWidth = availableLogicalWidthForLine(o
ldLogicalHeight, layoutState.lineInfo().isFirstLine()); | 1843 LayoutUnit oldLineWidth = availableLogicalWidthForLine(o
ldLogicalHeight, layoutState.lineInfo().isFirstLine()); |
| 1844 lineBox->adjustBlockDirectionPosition(adjustment); | 1844 lineBox->adjustBlockDirectionPosition(adjustment); |
| 1845 if (layoutState.usesRepaintBounds()) | 1845 if (layoutState.usesRepaintBounds()) |
| 1846 layoutState.updateRepaintRangeFromBox(lineBox); | 1846 layoutState.updateRepaintRangeFromBox(lineBox); |
| 1847 | 1847 |
| 1848 if (availableLogicalWidthForLine(oldLogicalHeight + adju
stment, layoutState.lineInfo().isFirstLine()) != oldLineWidth) { | 1848 if (availableLogicalWidthForLine(oldLogicalHeight + adju
stment, layoutState.lineInfo().isFirstLine()) != oldLineWidth) { |
| 1849 // We have to delete this line, remove all floats th
at got added, and let line layout re-run. | 1849 // We have to delete this line, remove all floats th
at got added, and let line layout re-run. |
| 1850 lineBox->deleteLine(renderArena()); | 1850 lineBox->deleteLine(); |
| 1851 end = restartLayoutRunsAndFloatsInRange(oldLogicalHe
ight, oldLogicalHeight + adjustment, lastFloatFromPreviousLine, resolver, oldEnd
); | 1851 end = restartLayoutRunsAndFloatsInRange(oldLogicalHe
ight, oldLogicalHeight + adjustment, lastFloatFromPreviousLine, resolver, oldEnd
); |
| 1852 continue; | 1852 continue; |
| 1853 } | 1853 } |
| 1854 | 1854 |
| 1855 setLogicalHeight(lineBox->lineBottomWithLeading()); | 1855 setLogicalHeight(lineBox->lineBottomWithLeading()); |
| 1856 } | 1856 } |
| 1857 | 1857 |
| 1858 if (layoutState.flowThread()) | 1858 if (layoutState.flowThread()) |
| 1859 lineBox->setContainingRegion(regionAtBlockOffset(lineBox
->lineTopWithLeading())); | 1859 lineBox->setContainingRegion(regionAtBlockOffset(lineBox
->lineTopWithLeading())); |
| 1860 } | 1860 } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1980 ASSERT(!floatingObject->m_originatingLine); | 1980 ASSERT(!floatingObject->m_originatingLine); |
| 1981 floatingObject->m_originatingLine = line; | 1981 floatingObject->m_originatingLine = line; |
| 1982 setLogicalHeight(logicalTopForChild(*f) - marginBeforeFo
rChild(*f) + delta); | 1982 setLogicalHeight(logicalTopForChild(*f) - marginBeforeFo
rChild(*f) + delta); |
| 1983 positionNewFloats(); | 1983 positionNewFloats(); |
| 1984 } | 1984 } |
| 1985 } | 1985 } |
| 1986 } | 1986 } |
| 1987 setLogicalHeight(lastRootBox()->lineBottomWithLeading()); | 1987 setLogicalHeight(lastRootBox()->lineBottomWithLeading()); |
| 1988 } else { | 1988 } else { |
| 1989 // Delete all the remaining lines. | 1989 // Delete all the remaining lines. |
| 1990 deleteLineRange(layoutState, renderArena(), layoutState.endLine()); | 1990 deleteLineRange(layoutState, layoutState.endLine()); |
| 1991 } | 1991 } |
| 1992 } | 1992 } |
| 1993 | 1993 |
| 1994 if (floatingObjects() && (layoutState.checkForFloatsFromLastLine() || positi
onNewFloats()) && lastRootBox()) { | 1994 if (floatingObjects() && (layoutState.checkForFloatsFromLastLine() || positi
onNewFloats()) && lastRootBox()) { |
| 1995 // In case we have a float on the last line, it might not be positioned
up to now. | 1995 // In case we have a float on the last line, it might not be positioned
up to now. |
| 1996 // This has to be done before adding in the bottom border/padding, or th
e float will | 1996 // This has to be done before adding in the bottom border/padding, or th
e float will |
| 1997 // include the padding incorrectly. -dwh | 1997 // include the padding incorrectly. -dwh |
| 1998 if (layoutState.checkForFloatsFromLastLine()) { | 1998 if (layoutState.checkForFloatsFromLastLine()) { |
| 1999 LayoutUnit bottomVisualOverflow = lastRootBox()->logicalBottomVisual
Overflow(); | 1999 LayoutUnit bottomVisualOverflow = lastRootBox()->logicalBottomVisual
Overflow(); |
| 2000 LayoutUnit bottomLayoutOverflow = lastRootBox()->logicalBottomLayout
Overflow(); | 2000 LayoutUnit bottomLayoutOverflow = lastRootBox()->logicalBottomLayout
Overflow(); |
| 2001 TrailingFloatsRootInlineBox* trailingFloatsLineBox = new (renderAren
a()) TrailingFloatsRootInlineBox(this); | 2001 TrailingFloatsRootInlineBox* trailingFloatsLineBox = new TrailingFlo
atsRootInlineBox(this); |
| 2002 m_lineBoxes.appendLineBox(trailingFloatsLineBox); | 2002 m_lineBoxes.appendLineBox(trailingFloatsLineBox); |
| 2003 trailingFloatsLineBox->setConstructed(); | 2003 trailingFloatsLineBox->setConstructed(); |
| 2004 GlyphOverflowAndFallbackFontsMap textBoxDataMap; | 2004 GlyphOverflowAndFallbackFontsMap textBoxDataMap; |
| 2005 VerticalPositionCache verticalPositionCache; | 2005 VerticalPositionCache verticalPositionCache; |
| 2006 LayoutUnit blockLogicalHeight = logicalHeight(); | 2006 LayoutUnit blockLogicalHeight = logicalHeight(); |
| 2007 trailingFloatsLineBox->alignBoxesInBlockDirection(blockLogicalHeight
, textBoxDataMap, verticalPositionCache); | 2007 trailingFloatsLineBox->alignBoxesInBlockDirection(blockLogicalHeight
, textBoxDataMap, verticalPositionCache); |
| 2008 trailingFloatsLineBox->setLineTopBottomPositions(blockLogicalHeight,
blockLogicalHeight, blockLogicalHeight, blockLogicalHeight); | 2008 trailingFloatsLineBox->setLineTopBottomPositions(blockLogicalHeight,
blockLogicalHeight, blockLogicalHeight, blockLogicalHeight); |
| 2009 trailingFloatsLineBox->setPaginatedLineWidth(availableLogicalWidthFo
rContent(blockLogicalHeight)); | 2009 trailingFloatsLineBox->setPaginatedLineWidth(availableLogicalWidthFo
rContent(blockLogicalHeight)); |
| 2010 LayoutRect logicalLayoutOverflow(0, blockLogicalHeight, 1, bottomLay
outOverflow - blockLogicalHeight); | 2010 LayoutRect logicalLayoutOverflow(0, blockLogicalHeight, 1, bottomLay
outOverflow - blockLogicalHeight); |
| 2011 LayoutRect logicalVisualOverflow(0, blockLogicalHeight, 1, bottomVis
ualOverflow - blockLogicalHeight); | 2011 LayoutRect logicalVisualOverflow(0, blockLogicalHeight, 1, bottomVis
ualOverflow - blockLogicalHeight); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2054 | 2054 |
| 2055 RenderFlowThread* flowThread = flowThreadContainingBlock(); | 2055 RenderFlowThread* flowThread = flowThreadContainingBlock(); |
| 2056 bool clearLinesForPagination = firstLineBox() && flowThread && !flowThread->
hasRegions(); | 2056 bool clearLinesForPagination = firstLineBox() && flowThread && !flowThread->
hasRegions(); |
| 2057 | 2057 |
| 2058 // Figure out if we should clear out our line boxes. | 2058 // Figure out if we should clear out our line boxes. |
| 2059 // FIXME: Handle resize eventually! | 2059 // FIXME: Handle resize eventually! |
| 2060 bool isFullLayout = !firstLineBox() || selfNeedsLayout() || relayoutChildren
|| clearLinesForPagination; | 2060 bool isFullLayout = !firstLineBox() || selfNeedsLayout() || relayoutChildren
|| clearLinesForPagination; |
| 2061 LineLayoutState layoutState(isFullLayout, repaintLogicalTop, repaintLogicalB
ottom, flowThread); | 2061 LineLayoutState layoutState(isFullLayout, repaintLogicalTop, repaintLogicalB
ottom, flowThread); |
| 2062 | 2062 |
| 2063 if (isFullLayout) | 2063 if (isFullLayout) |
| 2064 lineBoxes()->deleteLineBoxes(renderArena()); | 2064 lineBoxes()->deleteLineBoxes(); |
| 2065 | 2065 |
| 2066 // Text truncation kicks in in two cases: | 2066 // Text truncation kicks in in two cases: |
| 2067 // 1) If your overflow isn't visible and your text-overflow-mode isn't c
lip. | 2067 // 1) If your overflow isn't visible and your text-overflow-mode isn't c
lip. |
| 2068 // 2) If you're an anonymous block with a block parent that satisfies #1
. | 2068 // 2) If you're an anonymous block with a block parent that satisfies #1
. |
| 2069 // FIXME: CSS3 says that descendants that are clipped must also know how to
truncate. This is insanely | 2069 // FIXME: CSS3 says that descendants that are clipped must also know how to
truncate. This is insanely |
| 2070 // difficult to figure out in general (especially in the middle of doing lay
out), so we only handle the | 2070 // difficult to figure out in general (especially in the middle of doing lay
out), so we only handle the |
| 2071 // simple case of an anonymous block truncating when it's parent is clipped. | 2071 // simple case of an anonymous block truncating when it's parent is clipped. |
| 2072 bool hasTextOverflow = (style()->textOverflow() && hasOverflowClip()) | 2072 bool hasTextOverflow = (style()->textOverflow() && hasOverflowClip()) |
| 2073 || (isAnonymousBlock() && parent() && parent()->isRenderBlock() && paren
t()->style()->textOverflow() && parent()->hasOverflowClip()); | 2073 || (isAnonymousBlock() && parent() && parent()->isRenderBlock() && paren
t()->style()->textOverflow() && parent()->hasOverflowClip()); |
| 2074 | 2074 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2222 break; | 2222 break; |
| 2223 } | 2223 } |
| 2224 // Check if a new float has been inserted after the last known float. | 2224 // Check if a new float has been inserted after the last known float. |
| 2225 if (!curr && floatIndex < layoutState.floats().size()) | 2225 if (!curr && floatIndex < layoutState.floats().size()) |
| 2226 layoutState.markForFullLayout(); | 2226 layoutState.markForFullLayout(); |
| 2227 } | 2227 } |
| 2228 | 2228 |
| 2229 if (layoutState.isFullLayout()) { | 2229 if (layoutState.isFullLayout()) { |
| 2230 // FIXME: This should just call deleteLineBoxTree, but that causes | 2230 // FIXME: This should just call deleteLineBoxTree, but that causes |
| 2231 // crashes for fast/repaint tests. | 2231 // crashes for fast/repaint tests. |
| 2232 RenderArena* arena = renderArena(); | |
| 2233 curr = firstRootBox(); | 2232 curr = firstRootBox(); |
| 2234 while (curr) { | 2233 while (curr) { |
| 2235 // Note: This uses nextRootBox() insted of nextLineBox() like delete
LineBoxTree does. | 2234 // Note: This uses nextRootBox() insted of nextLineBox() like delete
LineBoxTree does. |
| 2236 RootInlineBox* next = curr->nextRootBox(); | 2235 RootInlineBox* next = curr->nextRootBox(); |
| 2237 curr->deleteLine(arena); | 2236 curr->deleteLine(); |
| 2238 curr = next; | 2237 curr = next; |
| 2239 } | 2238 } |
| 2240 ASSERT(!firstLineBox() && !lastLineBox()); | 2239 ASSERT(!firstLineBox() && !lastLineBox()); |
| 2241 } else { | 2240 } else { |
| 2242 if (curr) { | 2241 if (curr) { |
| 2243 // We have a dirty line. | 2242 // We have a dirty line. |
| 2244 if (RootInlineBox* prevRootBox = curr->prevRootBox()) { | 2243 if (RootInlineBox* prevRootBox = curr->prevRootBox()) { |
| 2245 // We have a previous line. | 2244 // We have a previous line. |
| 2246 if (!dirtiedByFloat && (!prevRootBox->endsWithBreak() || !prevRo
otBox->lineBreakObj() || (prevRootBox->lineBreakObj()->isText() && prevRootBox->
lineBreakPos() >= toRenderText(prevRootBox->lineBreakObj())->textLength()))) | 2245 if (!dirtiedByFloat && (!prevRootBox->endsWithBreak() || !prevRo
otBox->lineBreakObj() || (prevRootBox->lineBreakObj()->isText() && prevRootBox->
lineBreakPos() >= toRenderText(prevRootBox->lineBreakObj())->textLength()))) |
| 2247 // The previous line didn't break cleanly or broke at a newl
ine | 2246 // The previous line didn't break cleanly or broke at a newl
ine |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2406 | 2405 |
| 2407 bool matched = false; | 2406 bool matched = false; |
| 2408 RootInlineBox* result = line->nextRootBox(); | 2407 RootInlineBox* result = line->nextRootBox(); |
| 2409 layoutState.setEndLine(result); | 2408 layoutState.setEndLine(result); |
| 2410 if (result) { | 2409 if (result) { |
| 2411 layoutState.setEndLineLogicalTop(line->lineBottomWithLeading()); | 2410 layoutState.setEndLineLogicalTop(line->lineBottomWithLeading()); |
| 2412 matched = checkPaginationAndFloatsAtEndLine(layoutState); | 2411 matched = checkPaginationAndFloatsAtEndLine(layoutState); |
| 2413 } | 2412 } |
| 2414 | 2413 |
| 2415 // Now delete the lines that we failed to sync. | 2414 // Now delete the lines that we failed to sync. |
| 2416 deleteLineRange(layoutState, renderArena(), originalEndLine, result)
; | 2415 deleteLineRange(layoutState, originalEndLine, result); |
| 2417 return matched; | 2416 return matched; |
| 2418 } | 2417 } |
| 2419 } | 2418 } |
| 2420 | 2419 |
| 2421 return false; | 2420 return false; |
| 2422 } | 2421 } |
| 2423 | 2422 |
| 2424 enum WhitespacePosition { LeadingWhitespace, TrailingWhitespace }; | 2423 enum WhitespacePosition { LeadingWhitespace, TrailingWhitespace }; |
| 2425 static inline bool shouldCollapseWhiteSpace(const RenderStyle* style, const Line
Info& lineInfo, WhitespacePosition whitespacePosition) | 2424 static inline bool shouldCollapseWhiteSpace(const RenderStyle* style, const Line
Info& lineInfo, WhitespacePosition whitespacePosition) |
| 2426 { | 2425 { |
| (...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3545 | 3544 |
| 3546 void RenderBlock::layoutLineGridBox() | 3545 void RenderBlock::layoutLineGridBox() |
| 3547 { | 3546 { |
| 3548 if (style()->lineGrid() == RenderStyle::initialLineGrid()) { | 3547 if (style()->lineGrid() == RenderStyle::initialLineGrid()) { |
| 3549 setLineGridBox(0); | 3548 setLineGridBox(0); |
| 3550 return; | 3549 return; |
| 3551 } | 3550 } |
| 3552 | 3551 |
| 3553 setLineGridBox(0); | 3552 setLineGridBox(0); |
| 3554 | 3553 |
| 3555 RootInlineBox* lineGridBox = new (renderArena()) RootInlineBox(this); | 3554 RootInlineBox* lineGridBox = new RootInlineBox(this); |
| 3556 lineGridBox->setHasTextChildren(); // Needed to make the line ascent/descent
actually be honored in quirks mode. | 3555 lineGridBox->setHasTextChildren(); // Needed to make the line ascent/descent
actually be honored in quirks mode. |
| 3557 lineGridBox->setConstructed(); | 3556 lineGridBox->setConstructed(); |
| 3558 GlyphOverflowAndFallbackFontsMap textBoxDataMap; | 3557 GlyphOverflowAndFallbackFontsMap textBoxDataMap; |
| 3559 VerticalPositionCache verticalPositionCache; | 3558 VerticalPositionCache verticalPositionCache; |
| 3560 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); | 3559 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver
ticalPositionCache); |
| 3561 | 3560 |
| 3562 setLineGridBox(lineGridBox); | 3561 setLineGridBox(lineGridBox); |
| 3563 | 3562 |
| 3564 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying | 3563 // FIXME: If any of the characteristics of the box change compared to the ol
d one, then we need to do a deep dirtying |
| 3565 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping | 3564 // (similar to what happens when the page height changes). Ideally, though,
we only do this if someone is actually snapping |
| 3566 // to this grid. | 3565 // to this grid. |
| 3567 } | 3566 } |
| 3568 | 3567 |
| 3569 } | 3568 } |
| OLD | NEW |