WebCore:
Reviewed by Darin Adler.
- fix float positioning when a float that does not fit on the line is
followed by a float that does
Test: fast/block/float/narrow-after-wide.html
* rendering/bidi.cpp:
(WebCore::RenderBlock::findNextLineBreak): Changed to not position any
more floats on the line once a float that does not fit is encountered.
That float should be pushed to the next line, and so should all floats
that follow, regardless of whether they can fit on the current line.
LayoutTests:
Reviewed by Darin Adler.
- test float positioning when a float that does not fit on the line is
followed by a float that does
* fast/block/float/narrow-after-wide.html: Added.
* platform/mac/fast/block/float/narrow-after-wide-expected.checksum: Added.
* platform/mac/fast/block/float/narrow-after-wide-expected.png: Added.
* platform/mac/fast/block/float/narrow-after-wide-expected.txt: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@30551 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/rendering/bidi.cpp b/WebCore/rendering/bidi.cpp
index c9edd5f..dea3075 100644
--- a/WebCore/rendering/bidi.cpp
+++ b/WebCore/rendering/bidi.cpp
@@ -1407,9 +1407,10 @@
previousLineBrokeCleanly = false;
bool autoWrapWasEverTrueOnLine = false;
+ bool floatsFitOnLine = true;
// Firefox and Opera will allow a table cell to grow to fit an image inside it under
- // very specific cirucumstances (in order to match common WinIE renderings).
+ // very specific circumstances (in order to match common WinIE renderings).
// Not supporting the quirk has caused us to mis-render some real sites. (See Bugzilla 10517.)
bool allowImagesToBreak = !style()->htmlHacks() || !isTableCell() || !style()->width().isIntrinsicOrAuto();
@@ -1463,10 +1464,11 @@
// check if it fits in the current line.
// If it does, position it now, otherwise, position
// it after moving to next line (in newLine() func)
- if (o->width() + o->marginLeft() + o->marginRight() + w + tmpW <= width) {
+ if (floatsFitOnLine && o->width() + o->marginLeft() + o->marginRight() + w + tmpW <= width) {
positionNewFloats();
width = lineWidth(m_height);
- }
+ } else
+ floatsFitOnLine = false;
} else if (o->isPositioned()) {
// If our original display wasn't an inline type, then we can
// go ahead and determine our static x position now.