Changeset 30530 in webkit
- Timestamp:
- Feb 23, 2008 8:00:21 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r30519 r30530 1 2008-02-23 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Dave Hyatt. 4 5 - test that non-autowrapping text clear floats 6 7 * fast/text/whitespace/nowrap-clear-float.html: Added. 8 * platform/mac-leopard/fast/text/whitespace: Added. 9 * platform/mac-leopard/fast/text/whitespace/nowrap-clear-float-expected.checksum: Added. 10 * platform/mac-leopard/fast/text/whitespace/nowrap-clear-float-expected.png: Added. 11 * platform/mac/fast/text/whitespace/nowrap-clear-float-expected.txt: Added. 12 1 13 2008-02-23 Dan Bernstein <mitz@apple.com> 2 14 -
trunk/WebCore/ChangeLog
r30529 r30530 1 2008-02-23 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Dave Hyatt. 4 5 - make non-autowrapping text clear floats 6 7 Test: fast/text/whitespace/nowrap-clear-float.html 8 9 * rendering/RenderBlock.cpp: 10 (WebCore::RenderBlock::nextFloatBottomBelow): Renamed nearestFloat() to 11 this and changed to avoid comparing bottom to 0 in each iteration. 12 (WebCore::RenderBlock::getClearDelta): Updated comment for the rename. 13 * rendering/RenderBlock.h: 14 * rendering/bidi.cpp: 15 (WebCore::RenderBlock::fitBelowFloats): Added. Factored out of 16 findNextLineBreak() and simplified. 17 (WebCore::RenderBlock::findNextLineBreak): Changed to call 18 fitBelowFloats(). Fixed the bug by trying to fit below floats in the 19 case of non-wrapping text. Removed some redundancy. 20 1 21 2008-02-23 Sam Weinig <sam@webkit.org> 2 22 -
trunk/WebCore/rendering/RenderBlock.cpp
r30415 r30530 2364 2364 } 2365 2365 2366 int 2367 RenderBlock::nearestFloatBottom(int height) const 2368 { 2369 if (!m_floatingObjects) return 0; 2370 int bottom = 0; 2366 int RenderBlock::nextFloatBottomBelow(int height) const 2367 { 2368 if (!m_floatingObjects) 2369 return 0; 2370 2371 int bottom = INT_MAX; 2371 2372 FloatingObject* r; 2372 2373 DeprecatedPtrListIterator<FloatingObject> it(*m_floatingObjects); 2373 for ( ; (r = it.current()); ++it ) 2374 if (r->endY>height && (r->endY<bottom || bottom==0)) 2375 bottom=r->endY; 2376 return max(bottom, height); 2374 for ( ; (r = it.current()); ++it) { 2375 if (r->endY > height) 2376 bottom = min(r->endY, bottom); 2377 } 2378 2379 return bottom == INT_MAX ? 0 : bottom; 2377 2380 } 2378 2381 … … 2817 2820 // We also clear floats if we are too big to sit on the same line as a float (and wish to avoid floats by default). 2818 2821 // FIXME: Note that the remaining space checks aren't quite accurate, since you should be able to clear only some floats (the minimum # needed 2819 // to fit) and not all (we should be using ne arestFloatBottomand looping).2822 // to fit) and not all (we should be using nextFloatBottomBelow and looping). 2820 2823 // Do not allow tables to wrap in quirks or even in almost strict mode 2821 2824 // (ebay on the PLT, finance.yahoo.com in the real world, versiontracker.com forces even almost strict mode not to work) -
trunk/WebCore/rendering/RenderBlock.h
r30415 r30530 137 137 bool generatesLineBoxesForInlineChild(RenderObject*); 138 138 int skipWhitespace(BidiIterator&, BidiState&); 139 void fitBelowFloats(int widthToFit, int& availableWidth); 139 140 BidiIterator findNextLineBreak(BidiIterator& start, BidiState& info); 140 141 RootInlineBox* constructLine(const BidiIterator& start, const BidiIterator& end); … … 179 180 int addOverhangingFloats(RenderBlock* child, int xoffset, int yoffset, bool makeChildPaintOtherFloats); 180 181 181 int ne arestFloatBottom(int height) const;182 int nextFloatBottomBelow(int) const; 182 183 int floatBottom() const; 183 184 inline int leftBottom(); -
trunk/WebCore/rendering/bidi.cpp
r30460 r30530 1350 1350 } 1351 1351 1352 void RenderBlock::fitBelowFloats(int widthToFit, int& availableWidth) 1353 { 1354 ASSERT(widthToFit > availableWidth); 1355 1356 int floatBottom; 1357 int lastFloatBottom = m_height; 1358 int newLineWidth = availableWidth; 1359 while (true) { 1360 floatBottom = nextFloatBottomBelow(lastFloatBottom); 1361 if (!floatBottom) 1362 break; 1363 1364 newLineWidth = lineWidth(floatBottom); 1365 lastFloatBottom = floatBottom; 1366 if (newLineWidth >= widthToFit) 1367 break; 1368 } 1369 1370 if (newLineWidth > availableWidth) { 1371 m_height = lastFloatBottom; 1372 availableWidth = newLineWidth; 1373 } 1374 } 1375 1352 1376 BidiIterator RenderBlock::findNextLineBreak(BidiIterator &start, BidiState &bidi) 1353 1377 { … … 1653 1677 applyWordSpacing = wordSpacing && currentCharacterIsSpace && !previousCharacterIsSpace; 1654 1678 1655 if (autoWrap && w + tmpW > width && !w) { 1656 int fb = nearestFloatBottom(m_height); 1657 int newLineWidth = lineWidth(fb); 1658 // See if |tmpW| will fit on the new line. As long as it does not, 1659 // keep adjusting our float bottom until we find some room. 1660 int lastFloatBottom = m_height; 1661 while (lastFloatBottom < fb && tmpW > newLineWidth) { 1662 lastFloatBottom = fb; 1663 fb = nearestFloatBottom(fb); 1664 newLineWidth = lineWidth(fb); 1665 } 1666 1667 if (!w && m_height < fb && width < newLineWidth) { 1668 m_height = fb; 1669 width = newLineWidth; 1670 } 1671 } 1672 1679 if (!w && autoWrap && tmpW > width) 1680 fitBelowFloats(tmpW, width); 1681 1673 1682 if (autoWrap || breakWords) { 1674 1683 // If we break only after white-space, consider the current character … … 1823 1832 } else if (nextText->isWordBreak()) 1824 1833 checkForBreak = true; 1825 bool willFitOnLine = (w + tmpW <= width); 1834 bool willFitOnLine = w + tmpW <= width; 1835 if (!willFitOnLine && !w) { 1836 fitBelowFloats(tmpW, width); 1837 willFitOnLine = tmpW <= width; 1838 } 1826 1839 bool canPlaceOnLine = willFitOnLine || !autoWrapWasEverTrueOnLine; 1827 1840 if (canPlaceOnLine && checkForBreak) { … … 1839 1852 if (currentCharacterIsSpace && !ignoringSpaces && o->style()->collapseWhiteSpace()) 1840 1853 trailingSpaceObject = 0; 1841 1842 int fb = nearestFloatBottom(m_height); 1843 int newLineWidth = lineWidth(fb); 1844 // See if |tmpW| will fit on the new line. As long as it does not, 1845 // keep adjusting our float bottom until we find some room. 1846 int lastFloatBottom = m_height; 1847 while (lastFloatBottom < fb && tmpW > newLineWidth) { 1848 lastFloatBottom = fb; 1849 fb = nearestFloatBottom(fb); 1850 newLineWidth = lineWidth(fb); 1851 } 1852 if (!w && m_height < fb && width < newLineWidth) { 1853 m_height = fb; 1854 width = newLineWidth; 1855 } 1854 1855 if (w) 1856 goto end; 1857 1858 fitBelowFloats(tmpW, width); 1856 1859 1857 1860 // |width| may have been adjusted because we got shoved down past a float (thus
Note: See TracChangeset
for help on using the changeset viewer.