Changeset 159032 in webkit
- Timestamp:
- Nov 10, 2013 3:32:48 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r159030 r159032 1 2013-11-10 Antti Koivisto <antti@apple.com> 2 3 Use start/end instead of textOffset/textLength for simple text runs 4 https://bugs.webkit.org/show_bug.cgi?id=124130 5 6 Reviewed by Oliver Hunt. 7 8 The code reads better this way. 9 10 * rendering/SimpleLineLayout.cpp: 11 (WebCore::SimpleLineLayout::createTextRuns): 12 * rendering/SimpleLineLayout.h: 13 (WebCore::SimpleLineLayout::Run::Run): 14 * rendering/SimpleLineLayoutFunctions.h: 15 (WebCore::SimpleLineLayout::findTextCaretMinimumOffset): 16 (WebCore::SimpleLineLayout::findTextCaretMaximumOffset): 17 (WebCore::SimpleLineLayout::containsTextCaretOffset): 18 (WebCore::SimpleLineLayout::isTextRendered): 19 * rendering/SimpleLineLayoutResolver.h: 20 (WebCore::SimpleLineLayout::RunResolver::Run::text): 21 1 22 2013-11-10 Antti Koivisto <antti@apple.com> 2 23 -
trunk/Source/WebCore/rendering/SimpleLineLayout.cpp
r159030 r159032 311 311 lineRuns.append(Run(lineEnd, lineRuns.last().right)); 312 312 lineRuns.last().right = lineRuns.last().left; 313 lineRuns.last(). textLength =1;313 lineRuns.last().end = lineEnd + 1; 314 314 lineEnd = wordEnd; 315 315 break; … … 344 344 if (whitespaceEnd < textLength && text[whitespaceEnd] == '\n') 345 345 ++whitespaceEnd; 346 lineRuns.last(). textLength = whitespaceEnd - lineRuns.last().textOffset;346 lineRuns.last().end = whitespaceEnd; 347 347 lineRuns.last().right = lineWidth.availableWidth(); 348 348 lineEnd = whitespaceEnd; … … 356 356 ASSERT(wordIsPrecededByWhitespace); 357 357 // Include space to the end of the previous run. 358 lineRuns.last(). textLength++;358 lineRuns.last().end++; 359 359 lineRuns.last().right += spaceWidth; 360 360 // Start a new run on the same line. … … 365 365 366 366 lineRuns.last().right = lineWidth.committedWidth(); 367 lineRuns.last(). textLength = wordEnd - lineRuns.last().textOffset;367 lineRuns.last().end = wordEnd; 368 368 369 369 lineEnd = wordEnd; -
trunk/Source/WebCore/rendering/SimpleLineLayout.h
r158268 r159032 45 45 struct Run { 46 46 Run() { } 47 Run(unsigned textOffset, float left)48 : textOffset(textOffset)49 , textLength(0)47 Run(unsigned start, float left) 48 : start(start) 49 , end(start) 50 50 , isEndOfLine(false) 51 51 , left(left) … … 53 53 { } 54 54 55 unsigned textOffset;56 unsigned textLength: 31;55 unsigned start; 56 unsigned end : 31; 57 57 unsigned isEndOfLine : 1; 58 58 float left; -
trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.h
r158268 r159032 85 85 if (!layout.runCount()) 86 86 return 0; 87 return layout.runAt(0). textOffset;87 return layout.runAt(0).start; 88 88 } 89 89 … … 93 93 return renderer.textLength(); 94 94 auto& last = layout.runAt(layout.runCount() - 1); 95 return last. textOffset + last.textLength;95 return last.end; 96 96 } 97 97 … … 100 100 for (unsigned i = 0; i < layout.runCount(); ++i) { 101 101 auto& run = layout.runAt(i); 102 if (offset < run. textOffset)102 if (offset < run.start) 103 103 return false; 104 if (offset <= run. textOffset + run.textLength)104 if (offset <= run.end) 105 105 return true; 106 106 } … … 111 111 { 112 112 for (unsigned i = 0; i < layout.runCount(); ++i) { 113 if (layout.runAt(i).textLength) 113 auto& run = layout.runAt(i); 114 if (run.end > run.start) 114 115 return true; 115 116 } -
trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.h
r158268 r159032 149 149 auto& resolver = m_iterator.resolver(); 150 150 auto& run = m_iterator.simpleRun(); 151 return resolver.m_string.substringSharingImpl(run. textOffset, run.textLength);151 return resolver.m_string.substringSharingImpl(run.start, run.end - run.start); 152 152 } 153 153
Note: See TracChangeset
for help on using the changeset viewer.