LayoutTests:
authoraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Nov 2006 20:51:39 +0000 (20:51 +0000)
committeraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Nov 2006 20:51:39 +0000 (20:51 +0000)
        Reviewed by Geoff.

        New test to keep the mistake I made in r17680 from happening again.

        * fast/block/margin-collapse/negative-margins-expected.checksum: Added.
        * fast/block/margin-collapse/negative-margins-expected.png: Added.
        * fast/block/margin-collapse/negative-margins-expected.txt: Added.
        * fast/block/margin-collapse/negative-margins.html: Added.

WebCore:

        Reviewed by Geoff.

        Fix the change in behavior I caused in r17680 with my build fix.

        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::maxTopMargin):
        (WebCore::RenderObject::maxBottomMargin):

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

LayoutTests/ChangeLog
LayoutTests/fast/block/margin-collapse/negative-margins-expected.checksum [new file with mode: 0644]
LayoutTests/fast/block/margin-collapse/negative-margins-expected.png [new file with mode: 0644]
LayoutTests/fast/block/margin-collapse/negative-margins-expected.txt [new file with mode: 0644]
LayoutTests/fast/block/margin-collapse/negative-margins.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderObject.cpp

index c15802f7886b001f6fc94c93df3e9cc2fd277bc9..cb7de5c58b0fcf758b3909ed9fbdc7b00fed8a59 100644 (file)
@@ -1,3 +1,14 @@
+2006-11-09  Adam Roben  <aroben@apple.com>
+
+        Reviewed by Geoff.
+
+        New test to keep the mistake I made in r17680 from happening again.
+
+        * fast/block/margin-collapse/negative-margins-expected.checksum: Added.
+        * fast/block/margin-collapse/negative-margins-expected.png: Added.
+        * fast/block/margin-collapse/negative-margins-expected.txt: Added.
+        * fast/block/margin-collapse/negative-margins.html: Added.
+
 2006-11-08  Darin Adler  <darin@apple.com>
 
         Reviewed by Anders.
diff --git a/LayoutTests/fast/block/margin-collapse/negative-margins-expected.checksum b/LayoutTests/fast/block/margin-collapse/negative-margins-expected.checksum
new file mode 100644 (file)
index 0000000..adada19
--- /dev/null
@@ -0,0 +1 @@
+ccc8223381acf6d036c411cbced55dfd
\ No newline at end of file
diff --git a/LayoutTests/fast/block/margin-collapse/negative-margins-expected.png b/LayoutTests/fast/block/margin-collapse/negative-margins-expected.png
new file mode 100644 (file)
index 0000000..0d1eac3
Binary files /dev/null and b/LayoutTests/fast/block/margin-collapse/negative-margins-expected.png differ
diff --git a/LayoutTests/fast/block/margin-collapse/negative-margins-expected.txt b/LayoutTests/fast/block/margin-collapse/negative-margins-expected.txt
new file mode 100644 (file)
index 0000000..513b1dd
--- /dev/null
@@ -0,0 +1,11 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x90
+  RenderBlock {HTML} at (0,0) size 800x90
+    RenderBody {BODY} at (8,16) size 784x66
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 193x18
+          text run at (0,0) width 193: "There should be no red below."
+      RenderBlock {DIV} at (0,34) size 80x32 [bgcolor=#FF0000]
+        RenderBlock {DIV} at (0,0) size 80x16 [bgcolor=#0000FF]
+        RenderImage {IMG} at (0,16) size 80x16 [bgcolor=#FFFF00]
diff --git a/LayoutTests/fast/block/margin-collapse/negative-margins.html b/LayoutTests/fast/block/margin-collapse/negative-margins.html
new file mode 100644 (file)
index 0000000..bfacd8b
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html lang="en">
+ <head>
+  <title>Margin Collapsing: negative margins (easy)</title>
+  <style type="text/css">
+  #container { background: red; width: 5em; height: 2em; }
+  #control { background: blue; width: 5em; height: 1em; margin-bottom: 1em; }
+  #test { background: yellow; width: 5em; height: 1em; margin-top: -1em; display: block; }
+  </style>
+ </head>
+ <body>
+  <p>There should be no red below.</p>
+  <div id="container">
+    <div id="control"></div>
+    <img id="test">
+  </div>
+ </body>
+</html>
index cf4129441660b082d973359c84f0b46c781e099c..cbe09ebbb29db4bb657e5b463bb77e3ed77a3a2d 100644 (file)
@@ -1,4 +1,14 @@
-2006-11-08  Anders Carlsson  <acarlsson@apple.com>
+2006-11-09  Adam Roben  <aroben@apple.com>
+
+        Reviewed by Geoff.
+
+        Fix the change in behavior I caused in r17680 with my build fix.
+
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::maxTopMargin):
+        (WebCore::RenderObject::maxBottomMargin):
+
+2006-11-09  Anders Carlsson  <acarlsson@apple.com>
 
         Reviewed by Adam, Oliver.
 
index dd1352b001a1acda16575740574518e91197ead7..aef47dab352c5f9e3f1433e61e6db7c841d17248 100644 (file)
@@ -3101,12 +3101,12 @@ InlineBox* RenderObject::inlineBox(int offset, EAffinity affinity)
 
 int RenderObject::maxTopMargin(bool positive) const
 {
-    return positive ? max(0, marginTop()) : min(0, -marginTop());
+    return positive ? max(0, marginTop()) : -min(0, marginTop());
 }
 
 int RenderObject::maxBottomMargin(bool positive) const
 {
-    return positive ? max(0, marginBottom()) : min(0, -marginBottom());
+    return positive ? max(0, marginBottom()) : -min(0, marginBottom());
 }
 
 #ifdef SVG_SUPPORT