Changeset 44649 in webkit
- Timestamp:
- Jun 12, 2009 11:04:40 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r44648 r44649 1 2009-06-12 David Hyatt <hyatt@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 https://bugs.webkit.org/show_bug.cgi?id=26367 6 7 Remove the global variables in bidi.cpp. Make a new struct, MidpointState, that holds all of the 8 midpoint information. Add the remaining global variables as arguments passed down through functions 9 as needed. 10 11 * platform/text/BidiResolver.h: 12 (WebCore::MidpointState::MidpointState): 13 (WebCore::MidpointState::reset): 14 (WebCore::BidiResolver::midpointState): 15 * rendering/RenderBlock.h: 16 * rendering/bidi.cpp: 17 (WebCore::BidiRun::operator delete): 18 (WebCore::chopMidpointsAt): 19 (WebCore::checkMidpoints): 20 (WebCore::addMidpoint): 21 (WebCore::appendRunsForObject): 22 (WebCore::RenderBlock::bidiReorderLine): 23 (WebCore::RenderBlock::layoutInlineChildren): 24 (WebCore::RenderBlock::determineStartPosition): 25 (WebCore::skipNonBreakingSpace): 26 (WebCore::shouldCollapseWhiteSpace): 27 (WebCore::requiresLineBox): 28 (WebCore::RenderBlock::generatesLineBoxesForInlineChild): 29 (WebCore::RenderBlock::skipTrailingWhitespace): 30 (WebCore::RenderBlock::skipLeadingWhitespace): 31 (WebCore::shouldSkipWhitespaceAfterStartObject): 32 (WebCore::RenderBlock::findNextLineBreak): 33 1 34 2009-06-12 Holger Hans Peter Freyther <zecke@selfish.org> 2 35 -
trunk/WebCore/platform/text/BidiResolver.h
r42895 r44649 30 30 namespace WebCore { 31 31 32 template <class Iterator> class MidpointState 33 { 34 public: 35 MidpointState() 36 { 37 reset(); 38 } 39 40 void reset() 41 { 42 m_numMidpoints = 0; 43 m_currentMidpoint = 0; 44 m_betweenMidpoints = false; 45 } 46 47 // The goal is to reuse the line state across multiple 48 // lines so we just keep an array around for midpoints and never clear it across multiple 49 // lines. We track the number of items and position using the two other variables. 50 Vector<Iterator> m_midpoints; 51 unsigned m_numMidpoints; 52 unsigned m_currentMidpoint; 53 bool m_betweenMidpoints; 54 }; 55 32 56 // The BidiStatus at a given position (typically the end of a line) can 33 57 // be cached and then used to restart bidi resolution at that position. … … 136 160 void setStatus(const BidiStatus s) { m_status = s; } 137 161 162 MidpointState<Iterator>& midpointState() { return m_midpointState; } 163 138 164 void embed(WTF::Unicode::Direction); 139 165 void commitExplicitEmbedding(); … … 173 199 Run* m_logicallyLastRun; 174 200 unsigned m_runCount; 201 MidpointState<Iterator> m_midpointState; 175 202 176 203 private: -
trunk/WebCore/rendering/RenderBlock.h
r44446 r44649 25 25 #ifndef RenderBlock_h 26 26 #define RenderBlock_h 27 28 27 #include "DeprecatedPtrList.h" 29 28 #include "GapRects.h" … … 43 42 44 43 template <class Iterator, class Run> class BidiResolver; 44 template <class Iterator> class MidpointState; 45 45 typedef BidiResolver<InlineIterator, BidiRun> InlineBidiResolver; 46 typedef MidpointState<InlineIterator> LineMidpointState; 46 47 47 48 enum CaretType { CursorCaret, DragCaret }; … … 158 159 }; 159 160 160 void bidiReorderLine(InlineBidiResolver&, const InlineIterator& end); 161 RootInlineBox* determineStartPosition(bool& firstLine, bool& fullLayout, InlineBidiResolver&, Vector<FloatWithRect>& floats, unsigned& numCleanFloats); 161 void bidiReorderLine(InlineBidiResolver&, const InlineIterator& end, bool previousLineBrokeCleanly); 162 RootInlineBox* determineStartPosition(bool& firstLine, bool& fullLayout, bool& previousLineBrokeCleanly, 163 InlineBidiResolver&, Vector<FloatWithRect>& floats, unsigned& numCleanFloats); 162 164 RootInlineBox* determineEndPosition(RootInlineBox* startBox, InlineIterator& cleanLineStart, 163 165 BidiStatus& cleanLineBidiStatus, … … 165 167 bool matchedEndLine(const InlineBidiResolver&, const InlineIterator& endLineStart, const BidiStatus& endLineStatus, 166 168 RootInlineBox*& endLine, int& endYPos, int& repaintBottom, int& repaintTop); 167 bool generatesLineBoxesForInlineChild(RenderObject* );168 void skipTrailingWhitespace(InlineIterator& );169 int skipLeadingWhitespace(InlineBidiResolver&, bool firstLine );169 bool generatesLineBoxesForInlineChild(RenderObject*, bool isLineEmpty = true, bool previousLineBrokeCleanly = true); 170 void skipTrailingWhitespace(InlineIterator&, bool isLineEmpty, bool previousLineBrokeCleanly); 171 int skipLeadingWhitespace(InlineBidiResolver&, bool firstLine, bool isLineEmpty, bool previousLineBrokeCleanly); 170 172 void fitBelowFloats(int widthToFit, bool firstLine, int& availableWidth); 171 InlineIterator findNextLineBreak(InlineBidiResolver&, bool firstLine, EClear* clear = 0);173 InlineIterator findNextLineBreak(InlineBidiResolver&, bool firstLine, bool& isLineEmpty, bool& previousLineBrokeCleanly, EClear* clear = 0); 172 174 RootInlineBox* constructLine(unsigned runCount, BidiRun* firstRun, BidiRun* lastRun, bool firstLine, bool lastLine, RenderObject* endObject); 173 175 InlineFlowBox* createLineBoxes(RenderObject*, bool firstLine); -
trunk/WebCore/rendering/bidi.cpp
r43664 r44649 79 79 }; 80 80 81 // Midpoint globals. The goal is not to do any allocation when dealing with82 // these midpoints, so we just keep an array around and never clear it. We track83 // the number of items and position using the two other variables.84 static Vector<InlineIterator>* smidpoints;85 static unsigned sNumMidpoints;86 static unsigned sCurrMidpoint;87 static bool betweenMidpoints;88 89 static bool isLineEmpty = true;90 static bool previousLineBrokeCleanly = true;91 92 81 static int getBorderPaddingMargin(RenderBoxModelObject* child, bool endOfInline) 93 82 { … … 148 137 bidiRunCounter.decrement(); 149 138 #endif 150 ASSERT(inBidiRunDestroy);139 //ASSERT(inBidiRunDestroy); 151 140 152 141 // Stash size where destroy() can find it. … … 328 317 // ------------------------------------------------------------------------------------------------- 329 318 330 static void chopMidpointsAt( RenderObject* obj, unsigned pos)331 { 332 if (! sNumMidpoints)319 static void chopMidpointsAt(LineMidpointState& lineMidpointState, RenderObject* obj, unsigned pos) 320 { 321 if (!lineMidpointState.m_numMidpoints) 333 322 return; 334 InlineIterator* midpoints = smidpoints->data();335 for (int i = sNumMidpoints - 1; i >= 0; i--) {323 InlineIterator* midpoints = lineMidpointState.m_midpoints.data(); 324 for (int i = lineMidpointState.m_numMidpoints - 1; i >= 0; i--) { 336 325 const InlineIterator& point = midpoints[i]; 337 326 if (point.obj == obj && point.pos == pos) { 338 sNumMidpoints = i;327 lineMidpointState.m_numMidpoints = i; 339 328 break; 340 329 } … … 342 331 } 343 332 344 static void checkMidpoints( InlineIterator& lBreak)333 static void checkMidpoints(LineMidpointState& lineMidpointState, InlineIterator& lBreak) 345 334 { 346 335 // Check to see if our last midpoint is a start point beyond the line break. If so, 347 336 // shave it off the list, and shave off a trailing space if the previous end point doesn't 348 337 // preserve whitespace. 349 if (lBreak.obj && sNumMidpoints && sNumMidpoints % 2 == 0) {350 InlineIterator* midpoints = smidpoints->data();351 InlineIterator& endpoint = midpoints[ sNumMidpoints-2];352 const InlineIterator& startpoint = midpoints[ sNumMidpoints-1];338 if (lBreak.obj && lineMidpointState.m_numMidpoints && !(lineMidpointState.m_numMidpoints % 2)) { 339 InlineIterator* midpoints = lineMidpointState.m_midpoints.data(); 340 InlineIterator& endpoint = midpoints[lineMidpointState.m_numMidpoints - 2]; 341 const InlineIterator& startpoint = midpoints[lineMidpointState.m_numMidpoints - 1]; 353 342 InlineIterator currpoint = endpoint; 354 343 while (!currpoint.atEnd() && currpoint != startpoint && currpoint != lBreak) … … 356 345 if (currpoint == lBreak) { 357 346 // We hit the line break before the start point. Shave off the start point. 358 sNumMidpoints--;347 lineMidpointState.m_numMidpoints--; 359 348 if (endpoint.obj->style()->collapseWhiteSpace()) { 360 349 if (endpoint.obj->isText()) { … … 376 365 } 377 366 378 static void addMidpoint( const InlineIterator& midpoint)379 { 380 if ( smidpoints->size() <= sNumMidpoints)381 smidpoints->grow(sNumMidpoints + 10);382 383 InlineIterator* midpoints = smidpoints->data();384 midpoints[ sNumMidpoints++] = midpoint;367 static void addMidpoint(LineMidpointState& lineMidpointState, const InlineIterator& midpoint) 368 { 369 if (lineMidpointState.m_midpoints.size() <= lineMidpointState.m_numMidpoints) 370 lineMidpointState.m_midpoints.grow(lineMidpointState.m_numMidpoints + 10); 371 372 InlineIterator* midpoints = lineMidpointState.m_midpoints.data(); 373 midpoints[lineMidpointState.m_numMidpoints++] = midpoint; 385 374 } 386 375 … … 391 380 return; 392 381 393 bool haveNextMidpoint = (sCurrMidpoint < sNumMidpoints); 382 LineMidpointState& lineMidpointState = resolver.midpointState(); 383 bool haveNextMidpoint = (lineMidpointState.m_currentMidpoint < lineMidpointState.m_numMidpoints); 394 384 InlineIterator nextMidpoint; 395 385 if (haveNextMidpoint) 396 nextMidpoint = smidpoints->at(sCurrMidpoint);397 if ( betweenMidpoints) {386 nextMidpoint = lineMidpointState.m_midpoints[lineMidpointState.m_currentMidpoint]; 387 if (lineMidpointState.m_betweenMidpoints) { 398 388 if (!(haveNextMidpoint && nextMidpoint.obj == obj)) 399 389 return; 400 390 // This is a new start point. Stop ignoring objects and 401 391 // adjust our start. 402 betweenMidpoints = false;392 lineMidpointState.m_betweenMidpoints = false; 403 393 start = nextMidpoint.pos; 404 sCurrMidpoint++;394 lineMidpointState.m_currentMidpoint++; 405 395 if (start < end) 406 396 return appendRunsForObject(start, end, obj, resolver); … … 414 404 // need to go ahead and append a run with our endpoint. 415 405 if (static_cast<int>(nextMidpoint.pos + 1) <= end) { 416 betweenMidpoints = true;417 sCurrMidpoint++;406 lineMidpointState.m_betweenMidpoints = true; 407 lineMidpointState.m_currentMidpoint++; 418 408 if (nextMidpoint.pos != UINT_MAX) { // UINT_MAX means stop at the object and don't include any of it. 419 409 if (static_cast<int>(nextMidpoint.pos + 1) > start) … … 792 782 793 783 // collects one line of the paragraph and transforms it to visual order 794 void RenderBlock::bidiReorderLine(InlineBidiResolver& resolver, const InlineIterator& end )784 void RenderBlock::bidiReorderLine(InlineBidiResolver& resolver, const InlineIterator& end, bool previousLineBrokeCleanly) 795 785 { 796 786 resolver.createBidiRunsForLine(end, style()->visuallyOrdered(), previousLineBrokeCleanly); … … 875 865 unsigned floatIndex; 876 866 bool firstLine = true; 877 RootInlineBox* startLine = determineStartPosition(firstLine, fullLayout, resolver, floats, floatIndex); 867 bool previousLineBrokeCleanly = true; 868 RootInlineBox* startLine = determineStartPosition(firstLine, fullLayout, previousLineBrokeCleanly, resolver, floats, floatIndex); 878 869 879 870 if (fullLayout && !selfNeedsLayout()) { … … 892 883 FloatingObject* lastFloat = m_floatingObjects ? m_floatingObjects->last() : 0; 893 884 894 if (!smidpoints) 895 smidpoints = new Vector<InlineIterator>(); 896 897 sNumMidpoints = 0; 898 sCurrMidpoint = 0; 885 LineMidpointState& lineMidpointState = resolver.midpointState(); 899 886 900 887 // We also find the first clean line and extract these lines. We will add them back … … 944 931 int lastHeight = height(); 945 932 933 bool isLineEmpty = true; 934 946 935 while (!end.atEnd()) { 947 936 // FIXME: Is this check necessary before the first iteration or can it be moved to the end? … … 949 938 break; 950 939 951 betweenMidpoints = false; 940 lineMidpointState.reset(); 941 952 942 isLineEmpty = true; 953 943 954 944 EClear clear = CNONE; 955 end = findNextLineBreak(resolver, firstLine, &clear);945 end = findNextLineBreak(resolver, firstLine, isLineEmpty, previousLineBrokeCleanly, &clear); 956 946 if (resolver.position().atEnd()) { 957 947 resolver.deleteRuns(); … … 962 952 963 953 if (!isLineEmpty) { 964 bidiReorderLine(resolver, end );954 bidiReorderLine(resolver, end, previousLineBrokeCleanly); 965 955 ASSERT(resolver.position() == end); 966 956 … … 1076 1066 1077 1067 lastHeight = height(); 1078 sNumMidpoints = 0; 1079 sCurrMidpoint = 0; 1068 lineMidpointState.reset(); 1080 1069 resolver.setPosition(end); 1081 1070 } … … 1134 1123 } 1135 1124 1136 sNumMidpoints = 0;1137 sCurrMidpoint = 0;1138 1139 1125 // Now add in the bottom border/padding. 1140 1126 setHeight(height() + toAdd); … … 1155 1141 } 1156 1142 1157 RootInlineBox* RenderBlock::determineStartPosition(bool& firstLine, bool& fullLayout, InlineBidiResolver& resolver, Vector<FloatWithRect>& floats, unsigned& numCleanFloats) 1143 RootInlineBox* RenderBlock::determineStartPosition(bool& firstLine, bool& fullLayout, bool& previousLineBrokeCleanly, 1144 InlineBidiResolver& resolver, Vector<FloatWithRect>& floats, unsigned& numCleanFloats) 1158 1145 { 1159 1146 RootInlineBox* curr = 0; … … 1386 1373 } 1387 1374 1388 static inline bool skipNonBreakingSpace(const InlineIterator& it )1375 static inline bool skipNonBreakingSpace(const InlineIterator& it, bool isLineEmpty, bool previousLineBrokeCleanly) 1389 1376 { 1390 1377 if (it.obj->style()->nbspMode() != SPACE || it.current() != noBreakSpace) … … 1402 1389 } 1403 1390 1404 static inline bool shouldCollapseWhiteSpace(const RenderStyle* style )1391 static inline bool shouldCollapseWhiteSpace(const RenderStyle* style, bool isLineEmpty, bool previousLineBrokeCleanly) 1405 1392 { 1406 1393 return style->collapseWhiteSpace() || (style->whiteSpace() == PRE_WRAP && (!isLineEmpty || !previousLineBrokeCleanly)); … … 1425 1412 } 1426 1413 1427 static inline bool requiresLineBox(const InlineIterator& it )1414 static inline bool requiresLineBox(const InlineIterator& it, bool isLineEmpty, bool previousLineBrokeCleanly) 1428 1415 { 1429 1416 if (it.obj->isFloatingOrPositioned()) … … 1433 1420 return false; 1434 1421 1435 if (!shouldCollapseWhiteSpace(it.obj->style() ) || it.obj->isBR())1422 if (!shouldCollapseWhiteSpace(it.obj->style(), isLineEmpty, previousLineBrokeCleanly) || it.obj->isBR()) 1436 1423 return true; 1437 1424 1438 1425 UChar current = it.current(); 1439 return current != ' ' && current != '\t' && current != softHyphen && (current != '\n' || shouldPreserveNewline(it.obj)) && !skipNonBreakingSpace(it); 1440 } 1441 1442 bool RenderBlock::generatesLineBoxesForInlineChild(RenderObject* inlineObj) 1426 return current != ' ' && current != '\t' && current != softHyphen && (current != '\n' || shouldPreserveNewline(it.obj)) 1427 && !skipNonBreakingSpace(it, isLineEmpty, previousLineBrokeCleanly); 1428 } 1429 1430 bool RenderBlock::generatesLineBoxesForInlineChild(RenderObject* inlineObj, bool isLineEmpty, bool previousLineBrokeCleanly) 1443 1431 { 1444 1432 ASSERT(inlineObj->parent() == this); 1445 1433 1446 1434 InlineIterator it(this, inlineObj, 0); 1447 while (!it.atEnd() && !requiresLineBox(it ))1435 while (!it.atEnd() && !requiresLineBox(it, isLineEmpty, previousLineBrokeCleanly)) 1448 1436 it.increment(); 1449 1437 … … 1457 1445 // NB. this function will insert any floating elements that would otherwise 1458 1446 // be skipped but it will not position them. 1459 void RenderBlock::skipTrailingWhitespace(InlineIterator& iterator )1460 { 1461 while (!iterator.atEnd() && !requiresLineBox(iterator )) {1447 void RenderBlock::skipTrailingWhitespace(InlineIterator& iterator, bool isLineEmpty, bool previousLineBrokeCleanly) 1448 { 1449 while (!iterator.atEnd() && !requiresLineBox(iterator, isLineEmpty, previousLineBrokeCleanly)) { 1462 1450 RenderObject* object = iterator.obj; 1463 1451 if (object->isFloating()) { … … 1490 1478 } 1491 1479 1492 int RenderBlock::skipLeadingWhitespace(InlineBidiResolver& resolver, bool firstLine )1480 int RenderBlock::skipLeadingWhitespace(InlineBidiResolver& resolver, bool firstLine, bool isLineEmpty, bool previousLineBrokeCleanly) 1493 1481 { 1494 1482 int availableWidth = lineWidth(height(), firstLine); 1495 while (!resolver.position().atEnd() && !requiresLineBox(resolver.position() )) {1483 while (!resolver.position().atEnd() && !requiresLineBox(resolver.position(), isLineEmpty, previousLineBrokeCleanly)) { 1496 1484 RenderObject* object = resolver.position().obj; 1497 1485 if (object->isFloating()) { … … 1530 1518 // This is currently just used for list markers and inline flows that have line boxes. Neither should 1531 1519 // have an effect on whitespace at the start of the line. 1532 static bool shouldSkipWhitespaceAfterStartObject(RenderBlock* block, RenderObject* o )1520 static bool shouldSkipWhitespaceAfterStartObject(RenderBlock* block, RenderObject* o, LineMidpointState& lineMidpointState) 1533 1521 { 1534 1522 RenderObject* next = bidiNext(block, o); … … 1537 1525 UChar nextChar = nextText->characters()[0]; 1538 1526 if (nextText->style()->isCollapsibleWhiteSpace(nextChar)) { 1539 addMidpoint( InlineIterator(0, o, 0));1527 addMidpoint(lineMidpointState, InlineIterator(0, o, 0)); 1540 1528 return true; 1541 1529 } … … 1576 1564 } 1577 1565 1578 InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool firstLine, EClear* clear) 1566 InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool firstLine, bool& isLineEmpty, bool& previousLineBrokeCleanly, 1567 EClear* clear) 1579 1568 { 1580 1569 ASSERT(resolver.position().block == this); 1581 1570 1582 1571 bool appliedStartWidth = resolver.position().pos > 0; 1583 1584 int width = skipLeadingWhitespace(resolver, firstLine); 1572 LineMidpointState& lineMidpointState = resolver.midpointState(); 1573 1574 int width = skipLeadingWhitespace(resolver, firstLine, isLineEmpty, previousLineBrokeCleanly); 1585 1575 1586 1576 int w = 0; … … 1707 1697 ignoreStart.pos = 0; 1708 1698 if (ignoringSpaces) { 1709 addMidpoint( ignoreStart); // Stop ignoring spaces.1710 addMidpoint( ignoreStart); // Start ignoring again.1699 addMidpoint(lineMidpointState, ignoreStart); // Stop ignoring spaces. 1700 addMidpoint(lineMidpointState, ignoreStart); // Start ignoring again. 1711 1701 } 1712 1702 … … 1727 1717 if (ignoringSpaces) { 1728 1718 trailingSpaceObject = 0; 1729 addMidpoint( InlineIterator(0, o, 0)); // Stop ignoring spaces.1730 addMidpoint( InlineIterator(0, o, 0)); // Start ignoring again.1719 addMidpoint(lineMidpointState, InlineIterator(0, o, 0)); // Stop ignoring spaces. 1720 addMidpoint(lineMidpointState, InlineIterator(0, o, 0)); // Start ignoring again. 1731 1721 } else if (style()->collapseWhiteSpace() && resolver.position().obj == o 1732 && shouldSkipWhitespaceAfterStartObject(this, o )) {1722 && shouldSkipWhitespaceAfterStartObject(this, o, lineMidpointState)) { 1733 1723 // Like with list markers, we start ignoring spaces to make sure that any 1734 1724 // additional spaces we see will be discarded. … … 1754 1744 1755 1745 if (ignoringSpaces) 1756 addMidpoint( InlineIterator(0, o, 0));1746 addMidpoint(lineMidpointState, InlineIterator(0, o, 0)); 1757 1747 1758 1748 isLineEmpty = false; … … 1765 1755 // item, then this is all moot. -dwh 1766 1756 if (o->isListMarker() && !static_cast<RenderListMarker*>(o)->isInside()) { 1767 if (style()->collapseWhiteSpace() && shouldSkipWhitespaceAfterStartObject(this, o )) {1757 if (style()->collapseWhiteSpace() && shouldSkipWhitespaceAfterStartObject(this, o, lineMidpointState)) { 1768 1758 // Like with inline flows, we start ignoring spaces to make sure that any 1769 1759 // additional spaces we see will be discarded. … … 1828 1818 beforeSoftHyphen = InlineIterator(0, last, last->isText() ? toRenderText(last)->textLength() - 1 : 0); 1829 1819 // Two consecutive soft hyphens. Avoid overlapping midpoints. 1830 if (sNumMidpoints && smidpoints->at(sNumMidpoints - 1).obj == o && smidpoints->at(sNumMidpoints - 1).pos == pos) 1831 sNumMidpoints--; 1820 if (lineMidpointState.m_numMidpoints && lineMidpointState.m_midpoints[lineMidpointState.m_numMidpoints - 1].obj == o && 1821 lineMidpointState.m_midpoints[lineMidpointState.m_numMidpoints - 1].pos == pos) 1822 lineMidpointState.m_numMidpoints--; 1832 1823 else 1833 addMidpoint( beforeSoftHyphen);1824 addMidpoint(lineMidpointState, beforeSoftHyphen); 1834 1825 1835 1826 // Add the width up to but not including the hyphen. … … 1843 1834 InlineIterator afterSoftHyphen(0, o, pos); 1844 1835 afterSoftHyphen.increment(); 1845 addMidpoint( afterSoftHyphen);1836 addMidpoint(lineMidpointState, afterSoftHyphen); 1846 1837 } 1847 1838 … … 1874 1865 lastSpaceWordSpacing = 0; 1875 1866 lastSpace = pos; // e.g., "Foo goo", don't add in any of the ignored spaces. 1876 addMidpoint( InlineIterator(0, o, pos));1867 addMidpoint(lineMidpointState, InlineIterator(0, o, pos)); 1877 1868 stoppedIgnoringSpaces = true; 1878 1869 } else { … … 1912 1903 lBreak.pos = pos; 1913 1904 lBreak.nextBreakablePosition = nextBreakable; 1914 skipTrailingWhitespace(lBreak );1905 skipTrailingWhitespace(lBreak, isLineEmpty, previousLineBrokeCleanly); 1915 1906 } 1916 1907 } … … 1919 1910 if (!stoppedIgnoringSpaces && pos > 0) { 1920 1911 // We need to stop right before the newline and then start up again. 1921 addMidpoint( InlineIterator(0, o, pos - 1)); // Stop1922 addMidpoint( InlineIterator(0, o, pos)); // Start1912 addMidpoint(lineMidpointState, InlineIterator(0, o, pos - 1)); // Stop 1913 addMidpoint(lineMidpointState, InlineIterator(0, o, pos)); // Start 1923 1914 } 1924 1915 lBreak.increment(); … … 1938 1929 if (!stoppedIgnoringSpaces && pos > 0) { 1939 1930 // We need to stop right before the newline and then start up again. 1940 addMidpoint( InlineIterator(0, o, pos - 1)); // Stop1941 addMidpoint( InlineIterator(0, o, pos)); // Start1931 addMidpoint(lineMidpointState, InlineIterator(0, o, pos - 1)); // Stop 1932 addMidpoint(lineMidpointState, InlineIterator(0, o, pos)); // Start 1942 1933 } 1943 1934 lBreak.obj = o; … … 1985 1976 // spaces. Create a midpoint to terminate the run 1986 1977 // before the second space. 1987 addMidpoint( ignoreStart);1978 addMidpoint(lineMidpointState, ignoreStart); 1988 1979 } 1989 1980 } … … 1994 1985 lastSpaceWordSpacing = applyWordSpacing ? wordSpacing : 0; 1995 1986 lastSpace = pos; // e.g., "Foo goo", don't add in any of the ignored spaces. 1996 addMidpoint( InlineIterator(0, o, pos));1987 addMidpoint(lineMidpointState, InlineIterator(0, o, pos)); 1997 1988 } 1998 1989 … … 2146 2137 2147 2138 // Sanity check our midpoints. 2148 checkMidpoints(l Break);2139 checkMidpoints(lineMidpointState, lBreak); 2149 2140 2150 2141 if (trailingSpaceObject) { … … 2152 2143 // to be the actual endpoint. In both cases we just decrease our pos by 1 level to 2153 2144 // exclude the space, allowing it to - in effect - collapse into the newline. 2154 if ( sNumMidpoints%2==1) {2155 InlineIterator* midpoints = smidpoints->data();2156 midpoints[ sNumMidpoints-1].pos--;2145 if (lineMidpointState.m_numMidpoints % 2) { 2146 InlineIterator* midpoints = lineMidpointState.m_midpoints.data(); 2147 midpoints[lineMidpointState.m_numMidpoints - 1].pos--; 2157 2148 } 2158 2149 //else if (lBreak.pos > 0) … … 2164 2155 unsigned pos = length >= 2 ? length - 2 : UINT_MAX; 2165 2156 InlineIterator endMid(0, trailingSpaceObject, pos); 2166 addMidpoint( endMid);2157 addMidpoint(lineMidpointState, endMid); 2167 2158 } 2168 2159 } … … 2180 2171 // For soft hyphens on line breaks, we have to chop out the midpoints that made us 2181 2172 // ignore the hyphen so that it will render at the end of the line. 2182 UChar c = toRenderText(lBreak.obj)->characters()[lBreak.pos -1];2173 UChar c = toRenderText(lBreak.obj)->characters()[lBreak.pos - 1]; 2183 2174 if (c == softHyphen) 2184 chopMidpointsAt(l Break.obj, lBreak.pos-2);2175 chopMidpointsAt(lineMidpointState, lBreak.obj, lBreak.pos - 2); 2185 2176 } 2186 2177
Note: See TracChangeset
for help on using the changeset viewer.