<rdar://problem/7460655> REGRESSION (r47255): Content shifted down at software.opensu...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Dec 2009 03:05:50 +0000 (03:05 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Dec 2009 03:05:50 +0000 (03:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=32382

Reviewed by Darin Adler.

WebCore:

Test: fast/block/float/in-margin.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::getClearDelta): Floats that do not intrude into the line (because
they are in the margin) do not need to be cleared.

LayoutTests:

* fast/block/float/in-margin.html: Added.
* platform/mac/fast/block/float/in-margin-expected.checksum: Added.
* platform/mac/fast/block/float/in-margin-expected.png: Added.
* platform/mac/fast/block/float/in-margin-expected.txt: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52127 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/block/float/in-margin.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/float/in-margin-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/float/in-margin-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/block/float/in-margin-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderBlock.cpp

index 29306fde8466ee5ac3f1bb1e08dd3ece3ffda3cc..fe0effc3b233a231bc56ca22691ef1b79efd4353 100644 (file)
@@ -1,3 +1,15 @@
+2009-12-14  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Darin Adler.
+
+        <rdar://problem/7460655> REGRESSION (r47255): Content shifted down at software.opensuse.org
+        https://bugs.webkit.org/show_bug.cgi?id=32382
+
+        * fast/block/float/in-margin.html: Added.
+        * platform/mac/fast/block/float/in-margin-expected.checksum: Added.
+        * platform/mac/fast/block/float/in-margin-expected.png: Added.
+        * platform/mac/fast/block/float/in-margin-expected.txt: Added.
+
 2009-12-14  Enrica Casucci  <enrica@apple.com>
 
         Reviewed by John Sullivan.
diff --git a/LayoutTests/fast/block/float/in-margin.html b/LayoutTests/fast/block/float/in-margin.html
new file mode 100644 (file)
index 0000000..0a5563f
--- /dev/null
@@ -0,0 +1,6 @@
+<div style="width: 400px;">
+    <div style="width: 100px; float: left; height: 100px;"></div>
+     <div style="margin-left: 300px; background-color: red;">
+         <div style="background-color: green; overflow: hidden; width: 110%; height: 110px;"></div>
+     </div>
+</div>
diff --git a/LayoutTests/platform/mac/fast/block/float/in-margin-expected.checksum b/LayoutTests/platform/mac/fast/block/float/in-margin-expected.checksum
new file mode 100644 (file)
index 0000000..537490e
--- /dev/null
@@ -0,0 +1 @@
+86351b92bffcd9b203c46fb9dc7d430c
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/block/float/in-margin-expected.png b/LayoutTests/platform/mac/fast/block/float/in-margin-expected.png
new file mode 100644 (file)
index 0000000..1623c24
Binary files /dev/null and b/LayoutTests/platform/mac/fast/block/float/in-margin-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/block/float/in-margin-expected.txt b/LayoutTests/platform/mac/fast/block/float/in-margin-expected.txt
new file mode 100644 (file)
index 0000000..54d9c61
--- /dev/null
@@ -0,0 +1,10 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {DIV} at (0,0) size 400x110
+        RenderBlock (floating) {DIV} at (0,0) size 100x100
+        RenderBlock {DIV} at (300,0) size 100x110 [bgcolor=#FF0000]
+layer at (308,8) size 110x110
+  RenderBlock {DIV} at (0,0) size 110x110 [bgcolor=#008000]
index 013e0fef811abe765412a758a0997559156f35a5..a262b4e6f4062a3cb18404da4bcb9425e6f7013e 100644 (file)
@@ -1,3 +1,16 @@
+2009-12-14  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Darin Adler.
+
+        <rdar://problem/7460655> REGRESSION (r47255): Content shifted down at software.opensuse.org
+        https://bugs.webkit.org/show_bug.cgi?id=32382
+
+        Test: fast/block/float/in-margin.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::getClearDelta): Floats that do not intrude into the line (because
+        they are in the margin) do not need to be cleared.
+
 2009-12-14  Enrica Casucci  <enrica@apple.com>
 
         Reviewed by John Sullivan.
index 3faac5c26b783c13be5d48aaf4350519a0644728..0b2345adfe3044c0e51fe4acf3453e4d0cf8cb3d 100644 (file)
@@ -3195,14 +3195,18 @@ int RenderBlock::getClearDelta(RenderBox* child, int yPos)
     // to fit) and not all (we should be using nextFloatBottomBelow and looping).
     int result = clearSet ? max(0, bottom - yPos) : 0;
     if (!result && child->avoidsFloats()) {
-        int oldYPos = child->y();
-        int oldWidth = child->width();
-        child->setY(yPos);
-        child->calcWidth();
-        if (child->width() > lineWidth(yPos, false) && child->minPrefWidth() <= availableWidth())
-            result = max(0, floatBottom() - yPos);
-        child->setY(oldYPos);
-        child->setWidth(oldWidth);
+        int widthAtCurrentHeight = lineWidth(yPos, false);
+        int availableWidth = this->availableWidth();
+        if (widthAtCurrentHeight < availableWidth) {
+            int oldYPos = child->y();
+            int oldWidth = child->width();
+            child->setY(yPos);
+            child->calcWidth();
+            if (child->width() > widthAtCurrentHeight && child->minPrefWidth() <= availableWidth)
+                result = max(0, floatBottom() - yPos);
+            child->setY(oldYPos);
+            child->setWidth(oldWidth);
+        }
     }
     return result;
 }