Changeset 85652 in webkit
- Timestamp:
- May 3, 2011 1:49:15 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r85650 r85652 1 2011-05-03 Levi Weintraub <leviw@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Extract LineInfo class 6 https://bugs.webkit.org/show_bug.cgi?id=60044 7 8 Created a LineInfo class in RenderBlockLineLayout.cpp that brings together the relevant 9 layout information about a line. This simplifies function signatures and clears up initialization. 10 11 No new tests as this is refactoring. 12 13 * rendering/RenderBlock.h: Updated internal layout function signatures to use LineInfo. 14 * rendering/RenderBlockLineLayout.cpp: 15 (WebCore::LineInfo::LineInfo): 16 (WebCore::LineInfo::isFirstLine): 17 (WebCore::LineInfo::isLastLine): 18 (WebCore::LineInfo::isEmpty): 19 (WebCore::LineInfo::previousLineBrokeCleanly): 20 (WebCore::LineInfo::setFirstLine): 21 (WebCore::LineInfo::setLastLine): 22 (WebCore::LineInfo::setEmpty): 23 (WebCore::LineInfo::setPreviousLineBrokeCleanly): 24 (WebCore::RenderBlock::createLineBoxes): 25 (WebCore::RenderBlock::constructLine): 26 (WebCore::RenderBlock::computeInlineDirectionPositionsForLine): 27 (WebCore::RenderBlock::layoutInlineChildren): 28 (WebCore::RenderBlock::determineStartPosition): 29 (WebCore::skipNonBreakingSpace): 30 (WebCore::shouldCollapseWhiteSpace): 31 (WebCore::requiresLineBox): Moved from RenderBlock.h and made it locally scoped to RenderBlockLineLayout.cpp 32 (WebCore::RenderBlock::generatesLineBoxesForInlineChild): 33 (WebCore::RenderBlock::skipTrailingWhitespace): 34 (WebCore::RenderBlock::skipLeadingWhitespace): 35 (WebCore::RenderBlock::findNextLineBreak): 36 1 37 2011-05-03 Roland Steiner <rolandsteiner@chromium.org> 2 38 -
trunk/Source/WebCore/rendering/RenderBlock.h
r85512 r85652 44 44 struct BidiRun; 45 45 struct PaintInfo; 46 class LineInfo; 46 47 47 48 template <class Iterator, class Run> class BidiResolver; … … 94 95 RootInlineBox* createAndAppendRootInlineBox(); 95 96 96 bool generatesLineBoxesForInlineChild(RenderObject* , bool isLineEmpty = true, bool previousLineBrokeCleanly = true);97 bool generatesLineBoxesForInlineChild(RenderObject*); 97 98 98 99 void markAllDescendantsWithFloatsForLayout(RenderBox* floatToRemove = 0, bool inLayout = true); … … 157 158 158 159 static void appendRunsForObject(BidiRunList<BidiRun>&, int start, int end, RenderObject*, InlineBidiResolver&); 159 static bool requiresLineBox(const InlineIterator&, bool isLineEmpty = true, bool previousLineBrokeCleanly = true);160 160 161 161 ColumnInfo* columnInfo() const; … … 492 492 // The following functions' implementations are in RenderBlockLineLayout.cpp. 493 493 void checkFloatsInCleanLine(RootInlineBox*, Vector<FloatWithRect>&, size_t& floatIndex, bool& encounteredNewFloat, bool& dirtiedByFloat); 494 RootInlineBox* determineStartPosition(bool& firstLine, bool& fullLayout, bool& previousLineBrokeCleanly, 495 InlineBidiResolver&, Vector<FloatWithRect>& floats, unsigned& numCleanFloats, 494 RootInlineBox* determineStartPosition(LineInfo&, bool& fullLayout, InlineBidiResolver&, Vector<FloatWithRect>& floats, unsigned& numCleanFloats, 496 495 bool& useRepaintBounds, int& repaintTop, int& repaintBottom); 497 496 RootInlineBox* determineEndPosition(RootInlineBox* startBox, Vector<FloatWithRect>& floats, size_t floatIndex, InlineIterator& cleanLineStart, … … 500 499 RootInlineBox*& endLine, int& endYPos, int& repaintBottom, int& repaintTop); 501 500 502 void skipTrailingWhitespace(InlineIterator&, bool isLineEmpty, bool previousLineBrokeCleanly);503 void skipLeadingWhitespace(InlineBidiResolver&, bool isLineEmpty, bool previousLineBrokeCleanly, FloatingObject* lastFloatFromPreviousLine, LineWidth&);501 void skipTrailingWhitespace(InlineIterator&, const LineInfo&); 502 void skipLeadingWhitespace(InlineBidiResolver&, const LineInfo&, FloatingObject* lastFloatFromPreviousLine, LineWidth&); 504 503 typedef std::pair<RenderText*, LazyLineBreakIterator> LineBreakIteratorInfo; 505 InlineIterator findNextLineBreak(InlineBidiResolver&, bool firstLine, bool& isLineEmpty, LineBreakIteratorInfo&, bool& previousLineBrokeCleanly, bool& hyphenated,504 InlineIterator findNextLineBreak(InlineBidiResolver&, LineInfo&, LineBreakIteratorInfo&, bool& hyphenated, 506 505 EClear*, FloatingObject* lastFloatFromPreviousLine, Vector<RenderBox*>& positionedObjects); 507 RootInlineBox* constructLine(BidiRunList<BidiRun>&, bool firstLine, bool lastLine);508 InlineFlowBox* createLineBoxes(RenderObject*, bool firstLine, InlineBox* childBox);509 510 void computeInlineDirectionPositionsForLine(RootInlineBox*, bool firstLine, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&);506 RootInlineBox* constructLine(BidiRunList<BidiRun>&, const LineInfo&); 507 InlineFlowBox* createLineBoxes(RenderObject*, const LineInfo&, InlineBox* childBox); 508 509 void computeInlineDirectionPositionsForLine(RootInlineBox*, const LineInfo&, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&); 511 510 void computeBlockDirectionPositionsForLine(RootInlineBox*, BidiRun*, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&); 512 511 void deleteEllipsisLineBoxes(); -
trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp
r85649 r85652 60 60 // We don't let our line box tree for a single line get any deeper than this. 61 61 const unsigned cMaxLineDepth = 200; 62 63 class LineInfo { 64 public: 65 LineInfo() 66 : m_isFirstLine(true) 67 , m_isLastLine(false) 68 , m_isEmpty(true) 69 , m_previousLineBrokeCleanly(true) 70 { } 71 72 bool isFirstLine() const { return m_isFirstLine; } 73 bool isLastLine() const { return m_isLastLine; } 74 bool isEmpty() const { return m_isEmpty; } 75 bool previousLineBrokeCleanly() const { return m_previousLineBrokeCleanly; } 76 77 void setFirstLine(bool firstLine) { m_isFirstLine = firstLine; } 78 void setLastLine(bool lastLine) { m_isLastLine = lastLine; } 79 void setEmpty(bool empty) { m_isEmpty = empty; } 80 void setPreviousLineBrokeCleanly(bool previousLineBrokeCleanly) { m_previousLineBrokeCleanly = previousLineBrokeCleanly; } 81 82 private: 83 bool m_isFirstLine; 84 bool m_isLastLine; 85 bool m_isEmpty; 86 bool m_previousLineBrokeCleanly; 87 }; 62 88 63 89 static inline int borderPaddingMarginStart(RenderInline* child) … … 205 231 } 206 232 207 InlineFlowBox* RenderBlock::createLineBoxes(RenderObject* obj, bool firstLine, InlineBox* childBox)233 InlineFlowBox* RenderBlock::createLineBoxes(RenderObject* obj, const LineInfo& lineInfo, InlineBox* childBox) 208 234 { 209 235 // See if we have an unconstructed line box for this object that is also … … 235 261 ASSERT(newBox->isInlineFlowBox()); 236 262 parentBox = static_cast<InlineFlowBox*>(newBox); 237 parentBox->setFirstLineStyleBit( firstLine);263 parentBox->setFirstLineStyleBit(lineInfo.isFirstLine()); 238 264 parentBox->setIsHorizontal(isHorizontalWritingMode()); 239 265 if (!hasDefaultLineBoxContain) … … 288 314 } 289 315 290 RootInlineBox* RenderBlock::constructLine(BidiRunList<BidiRun>& bidiRuns, bool firstLine, bool lastLine)316 RootInlineBox* RenderBlock::constructLine(BidiRunList<BidiRun>& bidiRuns, const LineInfo& lineInfo) 291 317 { 292 318 ASSERT(bidiRuns.firstRun()); … … 315 341 if (!parentBox || parentBox->renderer() != r->m_object->parent()) 316 342 // Create new inline boxes all the way back to the appropriate insertion point. 317 parentBox = createLineBoxes(r->m_object->parent(), firstLine, box);343 parentBox = createLineBoxes(r->m_object->parent(), lineInfo, box); 318 344 else { 319 345 // Append the inline box to this line. … … 348 374 // the line. 349 375 bool isLogicallyLastRunWrapped = bidiRuns.logicallyLastRun()->m_object && bidiRuns.logicallyLastRun()->m_object->isText() ? !reachedEndOfTextRenderer(bidiRuns) : true; 350 lastLineBox()->determineSpacingForFlowBoxes(l astLine, isLogicallyLastRunWrapped, bidiRuns.logicallyLastRun()->m_object);376 lastLineBox()->determineSpacingForFlowBoxes(lineInfo.isLastLine(), isLogicallyLastRunWrapped, bidiRuns.logicallyLastRun()->m_object); 351 377 352 378 // Now mark the line boxes as being constructed. … … 418 444 } 419 445 420 void RenderBlock::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox, bool firstLine, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd,446 void RenderBlock::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox, const LineInfo& lineInfo, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, 421 447 GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache) 422 448 { 423 449 ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWithBreak()); 424 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), firstLine);425 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), firstLine) - logicalLeft;450 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), lineInfo.isFirstLine()); 451 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), lineInfo.isFirstLine()) - logicalLeft; 426 452 427 453 bool needsWordSpacing = false; … … 450 476 if (int length = rt->textLength()) { 451 477 if (!r->m_start && needsWordSpacing && isSpaceOrNewline(rt->characters()[r->m_start])) 452 totalLogicalWidth += rt->style( firstLine)->font().wordSpacing();478 totalLogicalWidth += rt->style(lineInfo.isFirstLine())->font().wordSpacing(); 453 479 needsWordSpacing = !isSpaceOrNewline(rt->characters()[r->m_stop - 1]) && r->m_stop == length; 454 480 } … … 462 488 bool includeRootLine = lineBox->includesRootLineBoxFontOrLeading(); 463 489 int baselineShift = lineBox->verticalPositionForBox(r->m_box, verticalPositionCache); 464 int rootDescent = includeRootLine ? lineBox->renderer()->style( firstLine)->font().fontMetrics().descent() : 0;465 int rootAscent = includeRootLine ? lineBox->renderer()->style( firstLine)->font().fontMetrics().ascent() : 0;466 int boxAscent = rt->style( firstLine)->font().fontMetrics().ascent() - baselineShift;467 int boxDescent = rt->style( firstLine)->font().fontMetrics().descent() + baselineShift;490 int rootDescent = includeRootLine ? lineBox->renderer()->style(lineInfo.isFirstLine())->font().fontMetrics().descent() : 0; 491 int rootAscent = includeRootLine ? lineBox->renderer()->style(lineInfo.isFirstLine())->font().fontMetrics().ascent() : 0; 492 int boxAscent = rt->style(lineInfo.isFirstLine())->font().fontMetrics().ascent() - baselineShift; 493 int boxDescent = rt->style(lineInfo.isFirstLine())->font().fontMetrics().descent() + baselineShift; 468 494 if (boxAscent > rootDescent || boxDescent > rootAscent) 469 495 glyphOverflow.computeBounds = true; … … 473 499 if (static_cast<InlineTextBox*>(r->m_box)->hasHyphen()) { 474 500 const AtomicString& hyphenString = rt->style()->hyphenString(); 475 hyphenWidth = rt->style( firstLine)->font().width(TextRun(hyphenString.characters(), hyphenString.length()));476 } 477 r->m_box->setLogicalWidth(rt->width(r->m_start, r->m_stop - r->m_start, totalLogicalWidth, firstLine, &fallbackFonts, &glyphOverflow) + hyphenWidth);501 hyphenWidth = rt->style(lineInfo.isFirstLine())->font().width(TextRun(hyphenString.characters(), hyphenString.length())); 502 } 503 r->m_box->setLogicalWidth(rt->width(r->m_start, r->m_stop - r->m_start, totalLogicalWidth, lineInfo.isFirstLine(), &fallbackFonts, &glyphOverflow) + hyphenWidth); 478 504 if (!fallbackFonts.isEmpty()) { 479 505 ASSERT(r->m_box->isText()); … … 503 529 } 504 530 } 505 toRenderRubyRun(renderBox)->getOverhang( firstLine, renderBox->style()->isLeftToRightDirection() ? previousObject : nextObject, renderBox->style()->isLeftToRightDirection() ? nextObject : previousObject, startOverhang, endOverhang);531 toRenderRubyRun(renderBox)->getOverhang(lineInfo.isFirstLine(), renderBox->style()->isLeftToRightDirection() ? previousObject : nextObject, renderBox->style()->isLeftToRightDirection() ? nextObject : previousObject, startOverhang, endOverhang); 506 532 setMarginStartForChild(renderBox, -startOverhang); 507 533 setMarginEndForChild(renderBox, -endOverhang); … … 793 819 InlineBidiResolver resolver; 794 820 unsigned floatIndex; 795 bool firstLine = true; 796 bool previousLineBrokeCleanly = true; 797 RootInlineBox* startLine = determineStartPosition(firstLine, fullLayout, previousLineBrokeCleanly, resolver, floats, floatIndex, 821 LineInfo lineInfo; 822 RootInlineBox* startLine = determineStartPosition(lineInfo, fullLayout, resolver, floats, floatIndex, 798 823 useRepaintBounds, repaintLogicalTop, repaintLogicalBottom); 799 824 … … 862 887 bool checkForFloatsFromLastLine = false; 863 888 864 bool isLineEmpty = true;865 889 bool paginated = view()->layoutState() && view()->layoutState()->isPaginated(); 866 890 … … 875 899 lineMidpointState.reset(); 876 900 877 isLineEmpty = true;901 lineInfo.setEmpty(true); 878 902 879 903 EClear clear = CNONE; … … 883 907 InlineIterator oldEnd = end; 884 908 FloatingObject* lastFloatFromPreviousLine = (m_floatingObjects && !m_floatingObjects->set().isEmpty()) ? m_floatingObjects->set().last() : 0; 885 end = findNextLineBreak(resolver, firstLine, isLineEmpty, lineBreakIteratorInfo, previousLineBrokeCleanly, hyphenated, &clear, lastFloatFromPreviousLine, positionedObjects);909 end = findNextLineBreak(resolver, lineInfo, lineBreakIteratorInfo, hyphenated, &clear, lastFloatFromPreviousLine, positionedObjects); 886 910 if (resolver.position().atEnd()) { 887 911 // FIXME: We shouldn't be creating any runs in findNextLineBreak to begin with! … … 894 918 ASSERT(end != resolver.position()); 895 919 896 if ( isLineEmpty) {920 if (lineInfo.isEmpty()) { 897 921 if (lastRootBox()) 898 922 lastRootBox()->setLineBreakInfo(end.m_obj, end.m_pos, resolver.status()); … … 901 925 // FIXME: This ownership is reversed. We should own the BidiRunList and pass it to createBidiRunsForLine. 902 926 BidiRunList<BidiRun>& bidiRuns = resolver.runs(); 903 resolver.createBidiRunsForLine(end, override, previousLineBrokeCleanly);927 resolver.createBidiRunsForLine(end, override, lineInfo.previousLineBrokeCleanly()); 904 928 ASSERT(resolver.position() == end); 905 929 906 BidiRun* trailingSpaceRun = ! previousLineBrokeCleanly? handleTrailingSpaces(bidiRuns, resolver.context()) : 0;930 BidiRun* trailingSpaceRun = !lineInfo.previousLineBrokeCleanly() ? handleTrailingSpaces(bidiRuns, resolver.context()) : 0; 907 931 908 932 // Now that the runs have been ordered, we create the line boxes. … … 915 939 if (hyphenated) 916 940 bidiRuns.logicallyLastRun()->m_hasHyphen = true; 917 lineBox = constructLine(bidiRuns, firstLine, !end.m_obj); 941 lineInfo.setLastLine(!end.m_obj); 942 lineBox = constructLine(bidiRuns, lineInfo); 918 943 if (lineBox) { 919 lineBox->setEndsWithBreak( previousLineBrokeCleanly);944 lineBox->setEndsWithBreak(lineInfo.previousLineBrokeCleanly()); 920 945 921 946 #if ENABLE(SVG) … … 929 954 // Now we position all of our text runs horizontally. 930 955 if (!isSVGRootInlineBox) 931 computeInlineDirectionPositionsForLine(lineBox, firstLine, bidiRuns.firstRun(), trailingSpaceRun, end.atEnd(), textBoxDataMap, verticalPositionCache);956 computeInlineDirectionPositionsForLine(lineBox, lineInfo, bidiRuns.firstRun(), trailingSpaceRun, end.atEnd(), textBoxDataMap, verticalPositionCache); 932 957 933 958 // Now position our text runs vertically. … … 971 996 adjustLinePositionForPagination(lineBox, adjustment); 972 997 if (adjustment) { 973 int oldLineWidth = availableLogicalWidthForLine(oldLogicalHeight, firstLine);998 int oldLineWidth = availableLogicalWidthForLine(oldLogicalHeight, lineInfo.isFirstLine()); 974 999 lineBox->adjustBlockDirectionPosition(adjustment); 975 1000 if (useRepaintBounds) // This can only be a positive adjustment, so no need to update repaintTop. 976 1001 repaintLogicalBottom = max(repaintLogicalBottom, lineBox->logicalBottomVisualOverflow()); 977 1002 978 if (availableLogicalWidthForLine(oldLogicalHeight + adjustment, firstLine) != oldLineWidth) {1003 if (availableLogicalWidthForLine(oldLogicalHeight + adjustment, lineInfo.isFirstLine()) != oldLineWidth) { 979 1004 // We have to delete this line, remove all floats that got added, and let line layout re-run. 980 1005 lineBox->deleteLine(renderArena()); … … 994 1019 setStaticPositions(this, positionedObjects[i]); 995 1020 996 firstLine = false;1021 lineInfo.setFirstLine(false); 997 1022 newLine(clear); 998 1023 } … … 1160 1185 } 1161 1186 1162 RootInlineBox* RenderBlock::determineStartPosition(bool& firstLine, bool& fullLayout, bool& previousLineBrokeCleanly, 1163 InlineBidiResolver& resolver, Vector<FloatWithRect>& floats, unsigned& numCleanFloats, 1164 bool& useRepaintBounds, int& repaintLogicalTop, int& repaintLogicalBottom) 1187 RootInlineBox* RenderBlock::determineStartPosition(LineInfo& lineInfo, bool& fullLayout, InlineBidiResolver& resolver, Vector<FloatWithRect>& floats, 1188 unsigned& numCleanFloats, bool& useRepaintBounds, int& repaintLogicalTop, int& repaintLogicalBottom) 1165 1189 { 1166 1190 RootInlineBox* curr = 0; … … 1257 1281 } 1258 1282 1259 firstLine = !last;1260 previousLineBrokeCleanly = !last || last->endsWithBreak();1283 lineInfo.setFirstLine(!last); 1284 lineInfo.setPreviousLineBrokeCleanly(!last || last->endsWithBreak()); 1261 1285 1262 1286 if (last) { … … 1391 1415 } 1392 1416 1393 static inline bool skipNonBreakingSpace(const InlineIterator& it, bool isLineEmpty, bool previousLineBrokeCleanly)1417 static inline bool skipNonBreakingSpace(const InlineIterator& it, const LineInfo& lineInfo) 1394 1418 { 1395 1419 if (it.m_obj->style()->nbspMode() != SPACE || it.current() != noBreakSpace) … … 1401 1425 // on a line after a clean line break (or on the first line, since previousLineBrokeCleanly starts off 1402 1426 // |true|). 1403 if ( isLineEmpty && previousLineBrokeCleanly)1427 if (lineInfo.isEmpty() && lineInfo.previousLineBrokeCleanly()) 1404 1428 return false; 1405 1429 … … 1407 1431 } 1408 1432 1409 static inline bool shouldCollapseWhiteSpace(const RenderStyle* style, bool isLineEmpty, bool previousLineBrokeCleanly)1410 { 1411 return style->collapseWhiteSpace() || (style->whiteSpace() == PRE_WRAP && (! isLineEmpty || !previousLineBrokeCleanly));1433 static inline bool shouldCollapseWhiteSpace(const RenderStyle* style, const LineInfo& lineInfo) 1434 { 1435 return style->collapseWhiteSpace() || (style->whiteSpace() == PRE_WRAP && (!lineInfo.isEmpty() || !lineInfo.previousLineBrokeCleanly())); 1412 1436 } 1413 1437 … … 1420 1444 } 1421 1445 1422 bool RenderBlock::requiresLineBox(const InlineIterator& it, bool isLineEmpty, bool previousLineBrokeCleanly)1446 static bool requiresLineBox(const InlineIterator& it, const LineInfo& lineInfo = LineInfo()) 1423 1447 { 1424 1448 if (it.m_obj->isFloatingOrPositioned()) … … 1428 1452 return false; 1429 1453 1430 if (!shouldCollapseWhiteSpace(it.m_obj->style(), isLineEmpty, previousLineBrokeCleanly) || it.m_obj->isBR())1454 if (!shouldCollapseWhiteSpace(it.m_obj->style(), lineInfo) || it.m_obj->isBR()) 1431 1455 return true; 1432 1456 1433 1457 UChar current = it.current(); 1434 1458 return current != ' ' && current != '\t' && current != softHyphen && (current != '\n' || it.m_obj->preservesNewline()) 1435 && !skipNonBreakingSpace(it, isLineEmpty, previousLineBrokeCleanly);1436 } 1437 1438 bool RenderBlock::generatesLineBoxesForInlineChild(RenderObject* inlineObj , bool isLineEmpty, bool previousLineBrokeCleanly)1459 && !skipNonBreakingSpace(it, lineInfo); 1460 } 1461 1462 bool RenderBlock::generatesLineBoxesForInlineChild(RenderObject* inlineObj) 1439 1463 { 1440 1464 ASSERT(inlineObj->parent() == this); 1441 1465 1442 1466 InlineIterator it(this, inlineObj, 0); 1443 while (!it.atEnd() && !requiresLineBox(it , isLineEmpty, previousLineBrokeCleanly))1467 while (!it.atEnd() && !requiresLineBox(it)) 1444 1468 it.increment(); 1445 1469 … … 1453 1477 // NB. this function will insert any floating elements that would otherwise 1454 1478 // be skipped but it will not position them. 1455 void RenderBlock::skipTrailingWhitespace(InlineIterator& iterator, bool isLineEmpty, bool previousLineBrokeCleanly)1456 { 1457 while (!iterator.atEnd() && !requiresLineBox(iterator, isLineEmpty, previousLineBrokeCleanly)) {1479 void RenderBlock::skipTrailingWhitespace(InlineIterator& iterator, const LineInfo& lineInfo) 1480 { 1481 while (!iterator.atEnd() && !requiresLineBox(iterator, lineInfo)) { 1458 1482 RenderObject* object = iterator.m_obj; 1459 1483 if (object->isFloating()) { … … 1465 1489 } 1466 1490 1467 void RenderBlock::skipLeadingWhitespace(InlineBidiResolver& resolver, bool isLineEmpty, bool previousLineBrokeCleanly,1491 void RenderBlock::skipLeadingWhitespace(InlineBidiResolver& resolver, const LineInfo& lineInfo, 1468 1492 FloatingObject* lastFloatFromPreviousLine, LineWidth& width) 1469 1493 { 1470 while (!resolver.position().atEnd() && !requiresLineBox(resolver.position(), isLineEmpty, previousLineBrokeCleanly)) {1494 while (!resolver.position().atEnd() && !requiresLineBox(resolver.position(), lineInfo)) { 1471 1495 RenderObject* object = resolver.position().m_obj; 1472 1496 if (object->isFloating()) … … 1742 1766 } 1743 1767 1744 InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool firstLine, bool& isLineEmpty, LineBreakIteratorInfo& lineBreakIteratorInfo, bool& previousLineBrokeCleanly,1768 InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, LineInfo& lineInfo, LineBreakIteratorInfo& lineBreakIteratorInfo, 1745 1769 bool& hyphenated, EClear* clear, FloatingObject* lastFloatFromPreviousLine, Vector<RenderBox*>& positionedBoxes) 1746 1770 { … … 1750 1774 LineMidpointState& lineMidpointState = resolver.midpointState(); 1751 1775 1752 LineWidth width(this, firstLine);1753 1754 skipLeadingWhitespace(resolver, isLineEmpty, previousLineBrokeCleanly, lastFloatFromPreviousLine, width);1776 LineWidth width(this, lineInfo.isFirstLine()); 1777 1778 skipLeadingWhitespace(resolver, lineInfo, lastFloatFromPreviousLine, width); 1755 1779 1756 1780 if (resolver.position().atEnd()) … … 1779 1803 bool atStart = true; 1780 1804 1781 bool prevLineBrokeCleanly = previousLineBrokeCleanly;1782 previousLineBrokeCleanly = false;1805 bool startingNewParagraph = lineInfo.previousLineBrokeCleanly(); 1806 lineInfo.setPreviousLineBrokeCleanly(false); 1783 1807 1784 1808 hyphenated = false; … … 1821 1845 // cleanly. Otherwise the <br> has no effect on whether the line is 1822 1846 // empty or not. 1823 if ( prevLineBrokeCleanly)1824 isLineEmpty = false;1847 if (startingNewParagraph) 1848 lineInfo.setEmpty(false); 1825 1849 trailingObjects.clear(); 1826 previousLineBrokeCleanly = true;1827 1828 if (! isLineEmpty&& clear)1850 lineInfo.setPreviousLineBrokeCleanly(true); 1851 1852 if (!lineInfo.isEmpty() && clear) 1829 1853 *clear = o->style()->clear(); 1830 1854 } … … 1885 1909 // start ignoring spaces. 1886 1910 if (inlineFlowRequiresLineBox(flowBox)) { 1887 isLineEmpty = false;1911 lineInfo.setEmpty(false); 1888 1912 if (ignoringSpaces) { 1889 1913 trailingObjects.clear(); … … 1913 1937 addMidpoint(lineMidpointState, InlineIterator(0, o, 0)); 1914 1938 1915 isLineEmpty = false;1939 lineInfo.setEmpty(false); 1916 1940 ignoringSpaces = false; 1917 1941 currentCharacterIsSpace = false; … … 1946 1970 #endif 1947 1971 1948 RenderStyle* style = t->style( firstLine);1972 RenderStyle* style = t->style(lineInfo.isFirstLine()); 1949 1973 if (style->hasTextCombine() && o->isCombineText()) 1950 1974 toRenderCombineText(o)->combineText(); … … 1989 2013 1990 2014 if (!collapseWhiteSpace || !currentCharacterIsSpace) 1991 isLineEmpty = false;2015 lineInfo.setEmpty(false); 1992 2016 1993 2017 if (c == softHyphen && autoWrap && !hyphenWidth && style->hyphens() != HyphensNone) { … … 2063 2087 lineWasTooWide = true; 2064 2088 lBreak.moveTo(o, pos, nextBreakable); 2065 skipTrailingWhitespace(lBreak, isLineEmpty, previousLineBrokeCleanly);2089 skipTrailingWhitespace(lBreak, lineInfo); 2066 2090 } 2067 2091 } … … 2079 2103 } 2080 2104 lBreak.increment(); 2081 previousLineBrokeCleanly = true;2105 lineInfo.setPreviousLineBrokeCleanly(true); 2082 2106 } 2083 2107 if (lBreak.m_obj && lBreak.m_pos && lBreak.m_obj->isText() && toRenderText(lBreak.m_obj)->textLength() && toRenderText(lBreak.m_obj)->characters()[lBreak.m_pos - 1] == softHyphen && style->hyphens() != HyphensNone) … … 2103 2127 lBreak.moveTo(o, pos, nextBreakable); 2104 2128 lBreak.increment(); 2105 previousLineBrokeCleanly = true;2129 lineInfo.setPreviousLineBrokeCleanly(true); 2106 2130 return lBreak; 2107 2131 }
Note: See TracChangeset
for help on using the changeset viewer.