Fix for 4096878, drop shadow effect not displayed correctly on tbray.org/ongoing...
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Apr 2005 00:42:00 +0000 (00:42 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Apr 2005 00:42:00 +0000 (00:42 +0000)
broken when negative margins were used and did not properly decrease the max width.

        Reviewed by Maciej

        * khtml/rendering/render_block.cpp:
        (khtml::RenderBlock::calcBlockMinMaxWidth):
        * layout-tests/fast/block/float/034-expected.txt: Added.
        * layout-tests/fast/block/float/034.html: Added.
        * layout-tests/fast/block/float/035-expected.txt: Added.
* layout-tests/fast/block/float/035.html: Added.

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

LayoutTests/fast/block/float/034-expected.txt [new file with mode: 0644]
LayoutTests/fast/block/float/034.html [new file with mode: 0644]
LayoutTests/fast/block/float/035-expected.txt [new file with mode: 0644]
LayoutTests/fast/block/float/035.html [new file with mode: 0644]
WebCore/ChangeLog-2005-08-23
WebCore/khtml/rendering/render_block.cpp

diff --git a/LayoutTests/fast/block/float/034-expected.txt b/LayoutTests/fast/block/float/034-expected.txt
new file mode 100644 (file)
index 0000000..69540c7
--- /dev/null
@@ -0,0 +1,7 @@
+layer at (0,0) size 800x600
+  RenderCanvas 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 (floating) {DIV} at (0,0) size 224x524 [border: (10px solid #0000FF)]
+        RenderImage {IMG} at (-290,10) size 504x504 [border: (2px solid #000000)]
diff --git a/LayoutTests/fast/block/float/034.html b/LayoutTests/fast/block/float/034.html
new file mode 100644 (file)
index 0000000..8b4afd2
--- /dev/null
@@ -0,0 +1,29 @@
+
+<html>
+<head><title>ongoing</title>
+<base href="http://tbray.org/ongoing/">
+<style type='text/css'>
+
+.shadowed {
+ float:left;
+ border:10px solid blue;
+
+}
+
+.shadowed img {
+ display: block;
+ margin: 0 0 0 -300px;
+} 
+
+
+
+</style>
+
+</head>
+<body>
+
+<div class='shadowed'>
+<img width=500 height=500 border=2 />
+</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/block/float/035-expected.txt b/LayoutTests/fast/block/float/035-expected.txt
new file mode 100644 (file)
index 0000000..8c6c94f
--- /dev/null
@@ -0,0 +1,8 @@
+layer at (0,0) size 800x600
+  RenderCanvas 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 (floating) {DIV} at (0,0) size 673x520 [border: (10px solid #0000FF)]
+        RenderImage {IMG} at (10,10) size 300x300 [bgcolor=#008000]
+        RenderImage {IMG} at (163,10) size 500x500 [bgcolor=#800080]
diff --git a/LayoutTests/fast/block/float/035.html b/LayoutTests/fast/block/float/035.html
new file mode 100644 (file)
index 0000000..b2d2d4d
--- /dev/null
@@ -0,0 +1,24 @@
+
+<html>
+<head><title>ongoing</title>
+<base href="http://tbray.org/ongoing/">
+<style type='text/css'>
+
+.shadowed {
+ float:left;
+ border:10px solid blue;
+
+}
+
+</style>
+
+</head>
+<body>
+
+<div class='shadowed'>
+<img align=left width=300 height=300 style="background-color:green">
+<img width=500 height=500 style="background-color:purple; display:block; margin-left:-150px"/>
+
+</div>
+</body>
+</html>
\ No newline at end of file
index 7da7c4501d131f2efd2d7ef6c8ecabfd9c223f0a..9229f686bbba8ac4dfde039f43698c4b8e3e2ab5 100644 (file)
@@ -1,3 +1,17 @@
+2005-04-22  David Hyatt  <hyatt@apple.com>
+
+       Fix for 4096878, drop shadow effect not displayed correctly on tbray.org/ongoing/.  Block minmaxwidth was
+       broken when negative margins were used and did not properly decrease the max width.
+       
+        Reviewed by Maciej
+
+        * khtml/rendering/render_block.cpp:
+        (khtml::RenderBlock::calcBlockMinMaxWidth):
+        * layout-tests/fast/block/float/034-expected.txt: Added.
+        * layout-tests/fast/block/float/034.html: Added.
+        * layout-tests/fast/block/float/035-expected.txt: Added.
+       * layout-tests/fast/block/float/035.html: Added.
+       
 2005-04-22  David Hyatt  <hyatt@apple.com>
 
         Remove some dead code from css_valueimpl.  It wasn't used at all.
index f47f89ce80cd577edbcba963d7516fa7eadd3f06..54e207a1d0bd8ddbe258f921a53289ce9e430220 100644 (file)
@@ -3092,12 +3092,10 @@ void RenderBlock::calcBlockMinMaxWidth()
             marginLeft += ml.value;
         else if (ml.type == Percent)
             marginLeft += child->marginLeft();
-        marginLeft = kMax(0, marginLeft);
         if (mr.type == Fixed)
             marginRight += mr.value;
         else if (mr.type == Percent)
             marginRight += child->marginRight();
-        marginRight = kMax(0, marginRight);
         margin = marginLeft + marginRight;
 
         int w = child->minWidth() + margin;
@@ -3112,10 +3110,12 @@ void RenderBlock::calcBlockMinMaxWidth()
         if (!child->isFloating()) {
             if (child->avoidsFloats()) {
                 // Determine a left and right max value based off whether or not the floats can fit in the
-                // margins of the object.
-                int maxLeft = kMax(floatLeftWidth, marginLeft);
-                int maxRight = kMax(floatRightWidth, marginRight);
+                // margins of the object.  For negative margins, we will attempt to overlap the float if the negative margin
+                // is smaller than the float width.
+                int maxLeft = marginLeft > 0 ? kMax(floatLeftWidth, marginLeft) : floatLeftWidth + marginLeft;
+                int maxRight = marginRight > 0 ? kMax(floatRightWidth, marginRight) : floatRightWidth + marginRight;
                 w = child->maxWidth() + maxLeft + maxRight;
+                w = kMax(w, floatLeftWidth + floatRightWidth);
             }
             else
                 m_maxWidth = kMax(floatLeftWidth + floatRightWidth, m_maxWidth);
@@ -3155,7 +3155,11 @@ void RenderBlock::calcBlockMinMaxWidth()
         
         child = child->nextSibling();
     }
-    
+
+    // Always make sure these values are non-negative.
+    m_minWidth = kMax(0, m_minWidth);
+    m_maxWidth = kMax(0, m_maxWidth);
+
     m_maxWidth = kMax(floatLeftWidth + floatRightWidth, m_maxWidth);
 }