Commit 25beac6d authored by mitz@apple.com's avatar mitz@apple.com

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
parent 00aa164f
2008-02-24 Dan Bernstein <mitz@apple.com>
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.
2008-02-24 Darin Adler <darin@apple.com>
Reviewed by Sam.
<!DOCTYPE html>
<html>
<head>
<style>
div.container { width: 350px; height: 175px; position: relative; }
div.green { position: absolute; width: 100px; height: 100px; top: 50px; background-color: green; }
div.line { vertical-align: bottom; display: inline-block; height: 50px; width: 200px; }
div.wide { height: 100px; width: 200px; }
div.narrow { height: 100px; width: 100px; background-color: red; }
div.right { float: right; }
div.left { float: left; }
</style>
</head>
<body>
<div class="container">
<div class="green" style="left: 50px;"></div>
<div class="line"></div>
<div class="wide right"></div>
<div class="narrow right"></div>
</div>
<div class="container">
<div class="green" style="right: 0;"></div>
<div class="line"></div>
<div class="wide left"></div>
<div class="narrow right"></div>
</div>
<div class="container">
<div class="green" style="right: 50px;"></div>
<div class="line"></div>
<div class="wide left"></div>
<div class="narrow left"></div>
</div>
</body>
</html>
e0a7d84079909fd39b806b8d666e0328
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x541
RenderBlock {HTML} at (0,0) size 800x541
RenderBody {BODY} at (8,8) size 784x525
layer at (8,8) size 350x175
RenderBlock (relative positioned) {DIV} at (0,0) size 350x175
RenderBlock {DIV} at (0,0) size 200x50
RenderText {#text} at (0,0) size 0x0
RenderBlock (floating) {DIV} at (150,50) size 200x100
RenderText {#text} at (0,0) size 0x0
RenderBlock (floating) {DIV} at (50,50) size 100x100 [bgcolor=#FF0000]
RenderText {#text} at (0,0) size 0x0
layer at (58,58) size 100x100
RenderBlock (positioned) {DIV} at (50,50) size 100x100 [bgcolor=#008000]
layer at (8,183) size 350x175
RenderBlock (relative positioned) {DIV} at (0,175) size 350x175
RenderBlock {DIV} at (0,0) size 200x50
RenderText {#text} at (0,0) size 0x0
RenderBlock (floating) {DIV} at (0,50) size 200x100
RenderText {#text} at (0,0) size 0x0
RenderBlock (floating) {DIV} at (250,50) size 100x100 [bgcolor=#FF0000]
RenderText {#text} at (0,0) size 0x0
layer at (258,233) size 100x100
RenderBlock (positioned) {DIV} at (250,50) size 100x100 [bgcolor=#008000]
layer at (8,358) size 350x175
RenderBlock (relative positioned) {DIV} at (0,350) size 350x175
RenderBlock {DIV} at (0,0) size 200x50
RenderText {#text} at (0,0) size 0x0
RenderBlock (floating) {DIV} at (0,50) size 200x100
RenderText {#text} at (0,0) size 0x0
RenderBlock (floating) {DIV} at (200,50) size 100x100 [bgcolor=#FF0000]
RenderText {#text} at (0,0) size 0x0
layer at (208,408) size 100x100
RenderBlock (positioned) {DIV} at (200,50) size 100x100 [bgcolor=#008000]
2008-02-24 Dan Bernstein <mitz@apple.com>
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.
2008-02-24 Darin Adler <darin@apple.com>
Reviewed by Sam.
......@@ -1407,9 +1407,10 @@ BidiIterator RenderBlock::findNextLineBreak(BidiIterator &start, BidiState &bidi
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 @@ BidiIterator RenderBlock::findNextLineBreak(BidiIterator &start, BidiState &bidi
// 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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment