Changeset 83038 in webkit
- Timestamp:
- Apr 6, 2011 5:12:58 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r83037 r83038 1 2011-04-06 Levi Weintraub <leviw@chromium.org> 2 3 Reviewed by Ryosuke Niwa. 4 5 Add member functions for determining line/paragraph separation to InlineIterator 6 https://bugs.webkit.org/show_bug.cgi?id=57938 7 8 Adding atTextParagraphSeparator and atParagraphSeparator inline convenience functions to 9 InlineIterator, where it makes far more sense for them to be. Also moving 10 shouldPreserveNewline to RenderObject and renaming it preservesNewline. 11 12 No new tests as this provides no new functionality. 13 14 * rendering/InlineIterator.h: 15 (WebCore::InlineIterator::atTextParagraphSeparator): 16 (WebCore::InlineIterator::atParagraphSeparator): 17 * rendering/RenderBlockLineLayout.cpp: 18 (WebCore::RenderBlock::requiresLineBox): 19 (WebCore::RenderBlock::findNextLineBreak): 20 * rendering/RenderObject.h: 21 (WebCore::RenderObject::preservesNewline): 22 1 23 2011-04-05 Alexander Pavlov <apavlov@chromium.org> 2 24 -
trunk/Source/WebCore/rendering/InlineIterator.h
r82793 r83038 68 68 void increment(InlineBidiResolver* = 0); 69 69 bool atEnd() const; 70 71 inline bool atTextParagraphSeparator() 72 { 73 return m_obj && m_obj->preservesNewline() && m_obj->isText() && toRenderText(m_obj)->textLength() 74 && !toRenderText(m_obj)->isWordBreak() && toRenderText(m_obj)->characters()[m_pos] == '\n'; 75 } 76 77 inline bool atParagraphSeparator() 78 { 79 return (m_obj && m_obj->isBR()) || atTextParagraphSeparator(); 80 } 70 81 71 82 UChar current() const; -
trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp
r82947 r83038 1389 1389 } 1390 1390 1391 static inline bool shouldPreserveNewline(RenderObject* object)1392 {1393 #if ENABLE(SVG)1394 if (object->isSVGInlineText())1395 return false;1396 #endif1397 1398 return object->style()->preserveNewline();1399 }1400 1401 1391 static bool inlineFlowRequiresLineBox(RenderInline* flow) 1402 1392 { … … 1419 1409 1420 1410 UChar current = it.current(); 1421 return current != ' ' && current != '\t' && current != softHyphen && (current != '\n' || shouldPreserveNewline(it.m_obj))1411 return current != ' ' && current != '\t' && current != softHyphen && (current != '\n' || it.m_obj->preservesNewline()) 1422 1412 && !skipNonBreakingSpace(it, isLineEmpty, previousLineBrokeCleanly); 1423 1413 } … … 1915 1905 goto end; 1916 1906 } 1917 if (lBreak. m_obj && shouldPreserveNewline(lBreak.m_obj) && lBreak.m_obj->isText() && toRenderText(lBreak.m_obj)->textLength() && !toRenderText(lBreak.m_obj)->isWordBreak() && toRenderText(lBreak.m_obj)->characters()[lBreak.m_pos] == '\n') {1907 if (lBreak.atTextParagraphSeparator()) { 1918 1908 if (!stoppedIgnoringSpaces && pos > 0) { 1919 1909 // We need to stop right before the newline and then start up again. … … 2056 2046 if (nextText->textLength()) { 2057 2047 UChar c = nextText->characters()[0]; 2058 if (c == ' ' || c == '\t' || (c == '\n' && ! shouldPreserveNewline(next)))2048 if (c == ' ' || c == '\t' || (c == '\n' && !next->preservesNewline())) 2059 2049 // If the next item on the line is text, and if we did not end with 2060 2050 // a space, then the next text run continues our word (and so it needs to -
trunk/Source/WebCore/rendering/RenderObject.h
r82778 r83038 434 434 bool hasMask() const { return style() && style()->hasMask(); } 435 435 436 inline bool preservesNewline() const; 436 437 void drawLineForBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2, BoxSide, 437 438 Color, EBorderStyle, int adjbw1, int adjbw2); … … 1038 1039 } 1039 1040 1041 inline bool RenderObject::preservesNewline() const 1042 { 1043 #if ENABLE(SVG) 1044 if (isSVGInlineText()) 1045 return false; 1046 #endif 1047 1048 return style()->preserveNewline(); 1049 } 1050 1040 1051 inline void makeMatrixRenderable(TransformationMatrix& matrix, bool has3DRendering) 1041 1052 {
Note: See TracChangeset
for help on using the changeset viewer.