Changeset 85737 in webkit
- Timestamp:
- May 4, 2011 6:03:32 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r85736 r85737 1 2011-05-04 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 Cleanup conditionals in findNextLineBreak 6 https://bugs.webkit.org/show_bug.cgi?id=60117 7 8 Simplified conditional statements in findNextLineBreak. 9 10 * rendering/RenderBlockLineLayout.cpp: 11 (WebCore::RenderBlock::findNextLineBreak): 12 1 13 2011-05-04 Luke Macpherson <macpherson@chromium.org> 2 14 -
trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp
r85732 r85737 1889 1889 } 1890 1890 1891 if (current.m_obj->isFloatingOrPositioned()) { 1892 // add to special objects... 1893 if (current.m_obj->isFloating()) { 1894 RenderBox* floatBox = toRenderBox(current.m_obj); 1895 FloatingObject* f = insertFloatingObject(floatBox); 1896 // check if it fits in the current line. 1897 // If it does, position it now, otherwise, position 1898 // it after moving to next line (in newLine() func) 1899 if (floatsFitOnLine && width.fitsOnLine(logicalWidthForFloat(f))) { 1900 positionNewFloatOnLine(f, lastFloatFromPreviousLine, width); 1901 if (lBreak.m_obj == current.m_obj) { 1902 ASSERT(!lBreak.m_pos); 1903 lBreak.increment(); 1904 } 1905 } else 1906 floatsFitOnLine = false; 1907 } else if (current.m_obj->isPositioned()) { 1908 // If our original display wasn't an inline type, then we can 1909 // go ahead and determine our static inline position now. 1910 RenderBox* box = toRenderBox(current.m_obj); 1911 bool isInlineType = box->style()->isOriginalDisplayInlineType(); 1912 if (!isInlineType) 1913 box->layer()->setStaticInlinePosition(borderAndPaddingStart()); 1914 else { 1915 // If our original display was an INLINE type, then we can go ahead 1916 // and determine our static y position now. 1917 box->layer()->setStaticBlockPosition(logicalHeight()); 1891 if (current.m_obj->isFloating()) { 1892 RenderBox* floatBox = toRenderBox(current.m_obj); 1893 FloatingObject* f = insertFloatingObject(floatBox); 1894 // check if it fits in the current line. 1895 // If it does, position it now, otherwise, position 1896 // it after moving to next line (in newLine() func) 1897 if (floatsFitOnLine && width.fitsOnLine(logicalWidthForFloat(f))) { 1898 positionNewFloatOnLine(f, lastFloatFromPreviousLine, width); 1899 if (lBreak.m_obj == current.m_obj) { 1900 ASSERT(!lBreak.m_pos); 1901 lBreak.increment(); 1918 1902 } 1919 1920 // If we're ignoring spaces, we have to stop and include this object and 1921 // then start ignoring spaces again. 1922 if (isInlineType || current.m_obj->container()->isRenderInline()) { 1923 if (ignoringSpaces) { 1924 ignoreStart.m_obj = current.m_obj; 1925 ignoreStart.m_pos = 0; 1926 addMidpoint(lineMidpointState, ignoreStart); // Stop ignoring spaces. 1927 addMidpoint(lineMidpointState, ignoreStart); // Start ignoring again. 1928 } 1929 trailingObjects.appendBoxIfNeeded(box); 1930 } else 1931 positionedBoxes.append(box); 1932 } 1903 } else 1904 floatsFitOnLine = false; 1905 } else if (current.m_obj->isPositioned()) { 1906 // If our original display wasn't an inline type, then we can 1907 // go ahead and determine our static inline position now. 1908 RenderBox* box = toRenderBox(current.m_obj); 1909 bool isInlineType = box->style()->isOriginalDisplayInlineType(); 1910 if (!isInlineType) 1911 box->layer()->setStaticInlinePosition(borderAndPaddingStart()); 1912 else { 1913 // If our original display was an INLINE type, then we can go ahead 1914 // and determine our static y position now. 1915 box->layer()->setStaticBlockPosition(logicalHeight()); 1916 } 1917 1918 // If we're ignoring spaces, we have to stop and include this object and 1919 // then start ignoring spaces again. 1920 if (isInlineType || current.m_obj->container()->isRenderInline()) { 1921 if (ignoringSpaces) { 1922 ignoreStart.m_obj = current.m_obj; 1923 ignoreStart.m_pos = 0; 1924 addMidpoint(lineMidpointState, ignoreStart); // Stop ignoring spaces. 1925 addMidpoint(lineMidpointState, ignoreStart); // Start ignoring again. 1926 } 1927 trailingObjects.appendBoxIfNeeded(box); 1928 } else 1929 positionedBoxes.append(box); 1933 1930 } else if (current.m_obj->isRenderInline()) { 1934 1931 // Right now, we should only encounter empty inlines here. … … 2238 2235 tryHyphenating(t, f, style->locale(), style->hyphenationLimitBefore(), style->hyphenationLimitAfter(), lastSpace, current.m_pos, width.currentWidth() - additionalTmpW, width.availableWidth(), isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, current.m_nextBreakablePosition, hyphenated); 2239 2236 2240 if (!hyphenated && 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)2237 if (!hyphenated && lBreak.previousInSameNode() == softHyphen && style->hyphens() != HyphensNone) 2241 2238 hyphenated = true; 2242 2239 … … 2250 2247 if (width.committedWidth() && !width.fitsOnLine() && lBreak.m_obj && currWS == NOWRAP) 2251 2248 checkForBreak = true; 2252 else if (next && current.m_obj->isText() && next->isText() && !next->isBR()) { 2253 if (autoWrap || (next->style()->autoWrap())) { 2254 if (currentCharacterIsSpace) 2249 else if (next && current.m_obj->isText() && next->isText() && !next->isBR() && (autoWrap || (next->style()->autoWrap()))) { 2250 if (currentCharacterIsSpace) 2251 checkForBreak = true; 2252 else { 2253 RenderText* nextText = toRenderText(next); 2254 if (nextText->textLength()) { 2255 UChar c = nextText->characters()[0]; 2256 checkForBreak = (c == ' ' || c == '\t' || (c == '\n' && !next->preservesNewline())); 2257 // If the next item on the line is text, and if we did not end with 2258 // a space, then the next text run continues our word (and so it needs to 2259 // keep adding to |tmpW|. Just update and continue. 2260 } else if (nextText->isWordBreak()) 2255 2261 checkForBreak = true; 2256 else { 2257 checkForBreak = false; 2258 RenderText* nextText = toRenderText(next); 2259 if (nextText->textLength()) { 2260 UChar c = nextText->characters()[0]; 2261 if (c == ' ' || c == '\t' || (c == '\n' && !next->preservesNewline())) 2262 // If the next item on the line is text, and if we did not end with 2263 // a space, then the next text run continues our word (and so it needs to 2264 // keep adding to |tmpW|. Just update and continue. 2265 checkForBreak = true; 2266 } else if (nextText->isWordBreak()) 2267 checkForBreak = true; 2268 2269 if (!width.fitsOnLine() && !width.committedWidth()) 2270 width.fitBelowFloats(); 2271 2272 bool canPlaceOnLine = width.fitsOnLine() || !autoWrapWasEverTrueOnLine; 2273 if (canPlaceOnLine && checkForBreak) { 2274 width.commit(); 2275 lBreak.moveToStartOf(next); 2276 } 2262 2263 if (!width.fitsOnLine() && !width.committedWidth()) 2264 width.fitBelowFloats(); 2265 2266 bool canPlaceOnLine = width.fitsOnLine() || !autoWrapWasEverTrueOnLine; 2267 if (canPlaceOnLine && checkForBreak) { 2268 width.commit(); 2269 lBreak.moveToStartOf(next); 2277 2270 } 2278 2271 }
Note: See TracChangeset
for help on using the changeset viewer.