LayoutTests:
authoradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Jun 2006 06:16:28 +0000 (06:16 +0000)
committeradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Jun 2006 06:16:28 +0000 (06:16 +0000)
        Reviewed by Hyatt.

        - tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=9100
          Absolutely positioned replaced elements with all non-auto
          values are rendered incorrectly

        * fast/replaced/absolute-position-with-auto-height-and-top-and-bottom.html: Added.
        * fast/replaced/absolute-position-with-auto-width-and-left-and-right.html: Added.

WebCore:

        Reviewed by Hyatt.

        - fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=9100
          Absolutely positioned replaced elements with all non-auto
          values are rendered incorrectly

        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::calcAbsoluteHorizontalReplaced): Add support for case when all values are specified.
        (WebCore::RenderBox::calcAbsoluteVerticalReplaced): ditto

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

LayoutTests/ChangeLog
LayoutTests/fast/replaced/absolute-position-with-auto-height-and-top-and-bottom-expected.checksum [new file with mode: 0644]
LayoutTests/fast/replaced/absolute-position-with-auto-height-and-top-and-bottom-expected.png [new file with mode: 0644]
LayoutTests/fast/replaced/absolute-position-with-auto-height-and-top-and-bottom-expected.txt [new file with mode: 0644]
LayoutTests/fast/replaced/absolute-position-with-auto-height-and-top-and-bottom.html [new file with mode: 0644]
LayoutTests/fast/replaced/absolute-position-with-auto-width-and-left-and-right-expected.checksum [new file with mode: 0644]
LayoutTests/fast/replaced/absolute-position-with-auto-width-and-left-and-right-expected.png [new file with mode: 0644]
LayoutTests/fast/replaced/absolute-position-with-auto-width-and-left-and-right-expected.txt [new file with mode: 0644]
LayoutTests/fast/replaced/absolute-position-with-auto-width-and-left-and-right.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderBox.cpp

index 0922d5e45f59e48615eae8c653c5afa5d942fe8d..64e3ed12b2e7ac88bb66b276c39c76aaed3c264e 100644 (file)
@@ -1,3 +1,14 @@
+2006-05-31  Sam Weinig  <sam.weinig@gmail.com>
+
+        Reviewed by Hyatt.
+
+        - tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=9100
+          Absolutely positioned replaced elements with all non-auto
+          values are rendered incorrectly
+
+        * fast/replaced/absolute-position-with-auto-height-and-top-and-bottom.html: Added.
+        * fast/replaced/absolute-position-with-auto-width-and-left-and-right.html: Added.
+
 2006-05-31  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Reviewed by Hyatt.
diff --git a/LayoutTests/fast/replaced/absolute-position-with-auto-height-and-top-and-bottom-expected.checksum b/LayoutTests/fast/replaced/absolute-position-with-auto-height-and-top-and-bottom-expected.checksum
new file mode 100644 (file)
index 0000000..4994a59
--- /dev/null
@@ -0,0 +1 @@
+7c2c9a97550ccfa36e26d91d33eccfc9
\ No newline at end of file
diff --git a/LayoutTests/fast/replaced/absolute-position-with-auto-height-and-top-and-bottom-expected.png b/LayoutTests/fast/replaced/absolute-position-with-auto-height-and-top-and-bottom-expected.png
new file mode 100644 (file)
index 0000000..543ba9e
Binary files /dev/null and b/LayoutTests/fast/replaced/absolute-position-with-auto-height-and-top-and-bottom-expected.png differ
diff --git a/LayoutTests/fast/replaced/absolute-position-with-auto-height-and-top-and-bottom-expected.txt b/LayoutTests/fast/replaced/absolute-position-with-auto-height-and-top-and-bottom-expected.txt
new file mode 100644 (file)
index 0000000..23a52b7
--- /dev/null
@@ -0,0 +1,12 @@
+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 {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 643x18
+          text run at (0,0) width 643: "The blue box should be vertically centered in the black box with 25px of white on the top and bottom."
+layer at (8,42) size 104x154
+  RenderBlock (relative positioned) {DIV} at (0,34) size 104x154 [border: (2px solid #000000)]
+layer at (10,69) size 100x100
+  RenderImage {IMG} at (2,27) size 100x100
diff --git a/LayoutTests/fast/replaced/absolute-position-with-auto-height-and-top-and-bottom.html b/LayoutTests/fast/replaced/absolute-position-with-auto-height-and-top-and-bottom.html
new file mode 100644 (file)
index 0000000..298cc1e
--- /dev/null
@@ -0,0 +1,14 @@
+<html>
+<head>
+    <style>
+        #a { position: relative; height: 150px; width: 100px; border: 2px solid black; }
+        #b { position: absolute; top: 25px; height: auto; bottom: 25px; }
+    </style>
+</head>
+<body>
+    <p>The blue box should be vertically centered in the black box with 25px of white on the top and bottom.</p>
+    <div id="a">
+        <img id="b" src="resources/square-blue-100x100.png">
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/fast/replaced/absolute-position-with-auto-width-and-left-and-right-expected.checksum b/LayoutTests/fast/replaced/absolute-position-with-auto-width-and-left-and-right-expected.checksum
new file mode 100644 (file)
index 0000000..9822fca
--- /dev/null
@@ -0,0 +1 @@
+24defc3ccdedcb7938777165b00e5a53
\ No newline at end of file
diff --git a/LayoutTests/fast/replaced/absolute-position-with-auto-width-and-left-and-right-expected.png b/LayoutTests/fast/replaced/absolute-position-with-auto-width-and-left-and-right-expected.png
new file mode 100644 (file)
index 0000000..6d7ad8d
Binary files /dev/null and b/LayoutTests/fast/replaced/absolute-position-with-auto-width-and-left-and-right-expected.png differ
diff --git a/LayoutTests/fast/replaced/absolute-position-with-auto-width-and-left-and-right-expected.txt b/LayoutTests/fast/replaced/absolute-position-with-auto-width-and-left-and-right-expected.txt
new file mode 100644 (file)
index 0000000..2f5072b
--- /dev/null
@@ -0,0 +1,12 @@
+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 {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 645x18
+          text run at (0,0) width 645: "The blue box should be horizontally centered in the black box with 25px of white on the left and right."
+layer at (8,42) size 154x104
+  RenderBlock (relative positioned) {DIV} at (0,34) size 154x104 [border: (2px solid #000000)]
+layer at (35,44) size 100x100
+  RenderImage {IMG} at (27,2) size 100x100
diff --git a/LayoutTests/fast/replaced/absolute-position-with-auto-width-and-left-and-right.html b/LayoutTests/fast/replaced/absolute-position-with-auto-width-and-left-and-right.html
new file mode 100644 (file)
index 0000000..6d87a4d
--- /dev/null
@@ -0,0 +1,14 @@
+<html>
+<head>
+    <style>
+        #a { position: relative; height: 100px; width: 150px; border: 2px solid black; }
+        #b { position: absolute; left: 25px; height: auto; right: 25px; }
+    </style>
+</head>
+<body>
+    <p>The blue box should be horizontally centered in the black box with 25px of white on the left and right.</p>
+    <div id="a">
+        <img id="b" src="resources/square-blue-100x100.png">
+    </div>
+</body>
+</html>
index cca6fff15f83a81b4e1a39857097f2095f5c735c..26d2055f3534232c5d4a6840676ae09374088a64 100644 (file)
@@ -1,3 +1,15 @@
+2006-05-31  Sam Weinig  <sam.weinig@gmail.com>
+
+        Reviewed by Hyatt.
+
+        - fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=9100
+          Absolutely positioned replaced elements with all non-auto
+          values are rendered incorrectly
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::calcAbsoluteHorizontalReplaced): Add support for case when all values are specified.
+        (WebCore::RenderBox::calcAbsoluteVerticalReplaced): ditto
+
 2006-05-31  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Reviewed by Hyatt.
index 9e6856fc587a795b3384ed4e4e249545c04dbf5b..0ac62974c91a7eec75d4de578bc63f79fba77726 100644 (file)
@@ -2070,6 +2070,12 @@ void RenderBox::calcAbsoluteHorizontalReplaced()
 
         // Solve for 'margin-right'
         m_marginRight = availableSpace - (leftValue + rightValue + m_marginLeft);
+    } else {
+        // Nothing is 'auto', just calculate the values.
+        m_marginLeft = marginLeft.calcValue(containerWidth);
+        m_marginRight = marginRight.calcValue(containerWidth);
+        rightValue = right.calcValue(containerWidth);
+        leftValue = left.calcValue(containerWidth);
     }
 
     /*-----------------------------------------------------------------------*\
@@ -2202,7 +2208,14 @@ void RenderBox::calcAbsoluteVerticalReplaced()
 
         // Solve for 'margin-bottom'
         m_marginBottom = availableSpace - (topValue + bottomValue + m_marginTop);
-    }
+    } else {
+        // Nothing is 'auto', just calculate the values.
+        m_marginTop = marginTop.calcValue(containerHeight);
+        m_marginBottom = marginBottom.calcValue(containerHeight);
+        topValue = top.calcValue(containerHeight);
+        // NOTE: It is not necessary to solve for 'bottom' because we don't ever
+        // use the value.
+     }
 
     /*-----------------------------------------------------------------------*\
      * 6. If at this point the values are over-constrained, ignore the value