WebCore: <rdar://problem/7141522> Incorrect layout of product table at henry.com
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Aug 2009 21:44:42 +0000 (21:44 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Aug 2009 21:44:42 +0000 (21:44 +0000)
Reviewed by Dave Hyatt.

Test: fast/block/basic/quirk-percent-height-table-cell.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::calcPercentageHeight): Tweak the quirk that allows
percentage-height children of auto-height blocks to look for an ancestor
with non-auto height and compute their height based on it. The change is
that if that ancestor is a table cell, it is ignored and the percent
height computes to zero (just like in strict mode). This matches Firefox
and IE.

LayoutTests: Test and updated results for
<rdar://problem/7141522> Incorrect layout of product table at henry.com

Patch by Dan Bernstein <mitz@apple.com> on 2009-08-19
Reviewed by Dave Hyatt.

* fast/block/basic/quirk-percent-height-table-cell-expected.checksum: Added.
* fast/block/basic/quirk-percent-height-table-cell-expected.png: Added.
* fast/block/basic/quirk-percent-height-table-cell-expected.txt: Added.
* fast/block/basic/quirk-percent-height-table-cell.html: Added.
* fast/replaced/table-percent-height-text-controls-expected.txt:
* fast/replaced/table-percent-height-text-controls.html:

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

LayoutTests/ChangeLog
LayoutTests/fast/block/basic/quirk-percent-height-table-cell-expected.checksum [new file with mode: 0644]
LayoutTests/fast/block/basic/quirk-percent-height-table-cell-expected.png [new file with mode: 0644]
LayoutTests/fast/block/basic/quirk-percent-height-table-cell-expected.txt [new file with mode: 0644]
LayoutTests/fast/block/basic/quirk-percent-height-table-cell.html [new file with mode: 0644]
LayoutTests/fast/replaced/table-percent-height-text-controls-expected.txt
LayoutTests/fast/replaced/table-percent-height-text-controls.html
WebCore/ChangeLog
WebCore/rendering/RenderBox.cpp

index adf47cae19b25cc7951b5c18a3c1ca479d7c0760..1bd761b7d5bbbe06f4970b22840e885e9e7fff1a 100644 (file)
@@ -1,3 +1,17 @@
+2009-08-19  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        Test and updated results for
+        <rdar://problem/7141522> Incorrect layout of product table at henry.com
+
+        * fast/block/basic/quirk-percent-height-table-cell-expected.checksum: Added.
+        * fast/block/basic/quirk-percent-height-table-cell-expected.png: Added.
+        * fast/block/basic/quirk-percent-height-table-cell-expected.txt: Added.
+        * fast/block/basic/quirk-percent-height-table-cell.html: Added.
+        * fast/replaced/table-percent-height-text-controls-expected.txt:
+        * fast/replaced/table-percent-height-text-controls.html:
+
 2009-08-19  Eric Carlson  <eric.carlson@apple.com>
 
         Reviewed by NOBODY (Build fix).
diff --git a/LayoutTests/fast/block/basic/quirk-percent-height-table-cell-expected.checksum b/LayoutTests/fast/block/basic/quirk-percent-height-table-cell-expected.checksum
new file mode 100644 (file)
index 0000000..da0925b
--- /dev/null
@@ -0,0 +1 @@
+4274a91a85e9e3bf64a8eacf7d53c47d
\ No newline at end of file
diff --git a/LayoutTests/fast/block/basic/quirk-percent-height-table-cell-expected.png b/LayoutTests/fast/block/basic/quirk-percent-height-table-cell-expected.png
new file mode 100644 (file)
index 0000000..3ef5592
Binary files /dev/null and b/LayoutTests/fast/block/basic/quirk-percent-height-table-cell-expected.png differ
diff --git a/LayoutTests/fast/block/basic/quirk-percent-height-table-cell-expected.txt b/LayoutTests/fast/block/basic/quirk-percent-height-table-cell-expected.txt
new file mode 100644 (file)
index 0000000..a3ea067
--- /dev/null
@@ -0,0 +1,17 @@
+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
+      RenderTable {TABLE} at (0,0) size 120x426 [border: (1px outset #808080)]
+        RenderTableSection {TBODY} at (1,1) size 118x424
+          RenderTableRow {TR} at (0,2) size 118x420
+            RenderTableCell {TD} at (2,-48) size 114x520 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              RenderBlock {DIV} at (2,2) size 20x100 [bgcolor=#FFFF00]
+              RenderTable {TABLE} at (2,102) size 110x416 [border: (1px outset #808080)]
+                RenderTableSection {TBODY} at (1,1) size 108x414
+                  RenderTableRow {TR} at (0,2) size 108x410
+                    RenderTableCell {TD} at (2,52) size 104x310 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                      RenderBlock {DIV} at (2,2) size 100x6
+                        RenderBlock {DIV} at (0,0) size 100x6 [border: (3px solid #0000FF)]
+                      RenderBlock {DIV} at (2,8) size 100x300 [bgcolor=#008000]
diff --git a/LayoutTests/fast/block/basic/quirk-percent-height-table-cell.html b/LayoutTests/fast/block/basic/quirk-percent-height-table-cell.html
new file mode 100644 (file)
index 0000000..553000a
--- /dev/null
@@ -0,0 +1,17 @@
+<table border="">
+    <tr>    
+        <td style="height: 200px;">
+            <div style="height: 100px; background-color: yellow; width: 20px;"></div>
+            <table border="" style="height: 100%;">
+                <tr>
+                    <td>
+                        <div>
+                            <div style="height: 100%; border: solid blue;"></div>
+                        </div>
+                        <div style="height: 300px; background-color: green; width: 100px;"></div>
+                    </td>
+                </tr>
+            </table>
+        </td>
+    </tr>
+</table>
index 172ffbf728d1eda88ef27541ce8f7f0cc2697612..c83090aaeabfe5c83b7fae989f9851c8c1bde01c 100644 (file)
@@ -20,9 +20,9 @@ PASS MAC/WIN input-text-75 height = 8px. Expects: MAC 8px, WIN 8px
 PASS MAC input-text-100 width = 128px. Expects: MAC 128px, WIN 152px
 PASS MAC/WIN input-text-100 height = 13px. Expects: MAC 13px, WIN 13px
 PASS MAC isindex-75 width = 122px. Expects: MAC 122px, WIN 146px
-PASS MAC/WIN isindex-75 height = 35px. Expects: MAC 35px, WIN 35px
+PASS MAC/WIN isindex-75 height = 13px. Expects: MAC 13px, WIN 13px
 PASS MAC isindex-100 width = 122px. Expects: MAC 122px, WIN 146px
-PASS MAC/WIN isindex-100 height = 49px. Expects: MAC 49px, WIN 49px
+PASS MAC/WIN isindex-100 height = 13px. Expects: MAC 13px, WIN 13px
 PASS MAC textarea-75 width = 129px. Expects: MAC 129px, WIN 161px
 FAIL. Doesn't match any platform's results. textarea-75 height = 18px. Expects: MAC 19px, WIN 19px
 PASS MAC textarea-100 width = 129px. Expects: MAC 129px, WIN 161px
index 8fad2c45bbc585e510ff65eebe83820025fe7cb7..d807ae1f536fadbc23d068dfce3469fe4c59f49c 100644 (file)
@@ -57,9 +57,9 @@ function test()
     printMetrics('input-text-100', 'height', '13px', '13px');
 
     printMetrics('isindex-75', 'width', '122px', '146px');
-    printMetrics('isindex-75', 'height', '35px', '35px');
+    printMetrics('isindex-75', 'height', '13px', '13px');
     printMetrics('isindex-100', 'width', '122px', '146px');
-    printMetrics('isindex-100', 'height', '49px', '49px');
+    printMetrics('isindex-100', 'height', '13px', '13px');
 
     printMetrics('textarea-75', 'width', '129px', '161px');
     printMetrics('textarea-75', 'height', '19px', '19px');
index ea7f365c097209b12f826a3327aba65f4f6c59d4..4367830cb9510edac5335f9ccdcdd1feb4a8ead2 100644 (file)
@@ -1,3 +1,19 @@
+2009-08-19  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        <rdar://problem/7141522> Incorrect layout of product table at henry.com
+
+        Test: fast/block/basic/quirk-percent-height-table-cell.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::calcPercentageHeight): Tweak the quirk that allows
+        percentage-height children of auto-height blocks to look for an ancestor
+        with non-auto height and compute their height based on it. The change is
+        that if that ancestor is a table cell, it is ignored and the percent
+        height computes to zero (just like in strict mode). This matches Firefox
+        and IE.
+
 2009-08-19  Jungshik Shin  <jshin@chromium.org>
 
         Reviewed by Eric Seidel.
index d713146dc1e30bce1c44a068f1340faf01f659a0..8a38769fc950d55ccf8fd757e395a9a34d0fac1d 100644 (file)
@@ -1479,7 +1479,7 @@ int RenderBox::calcHeightUsing(const Length& h)
 int RenderBox::calcPercentageHeight(const Length& height)
 {
     int result = -1;
-    bool includeBorderPadding = isTable();
+    bool skippedAutoHeightContainingBlock = false;
     RenderBlock* cb = containingBlock();
     if (style()->htmlHacks()) {
         // In quirks mode, blocks with auto height are skipped, and we keep looking for an enclosing
@@ -1487,6 +1487,7 @@ int RenderBox::calcPercentageHeight(const Length& height)
         // specification, which states that percentage heights just revert to auto if the containing
         // block has an auto height.
         while (!cb->isRenderView() && !cb->isBody() && !cb->isTableCell() && !cb->isPositioned() && cb->style()->height().isAuto()) {
+            skippedAutoHeightContainingBlock = true;
             cb = cb->containingBlock();
             cb->addPercentHeightDescendant(this);
         }
@@ -1496,25 +1497,29 @@ int RenderBox::calcPercentageHeight(const Length& height)
     // explicitly specified that can be used for any percentage computations.
     bool isPositionedWithSpecifiedHeight = cb->isPositioned() && (!cb->style()->height().isAuto() || (!cb->style()->top().isAuto() && !cb->style()->bottom().isAuto()));
 
+    bool includeBorderPadding = isTable();
+
     // Table cells violate what the CSS spec says to do with heights.  Basically we
     // don't care if the cell specified a height or not.  We just always make ourselves
     // be a percentage of the cell's current content height.
     if (cb->isTableCell()) {
-        result = cb->overrideSize();
-        if (result == -1) {
-            // Normally we would let the cell size intrinsically, but scrolling overflow has to be
-            // treated differently, since WinIE lets scrolled overflow regions shrink as needed.
-            // While we can't get all cases right, we can at least detect when the cell has a specified
-            // height or when the table has a specified height.  In these cases we want to initially have
-            // no size and allow the flexing of the table or the cell to its specified height to cause us
-            // to grow to fill the space.  This could end up being wrong in some cases, but it is
-            // preferable to the alternative (sizing intrinsically and making the row end up too big).
-            RenderTableCell* cell = toRenderTableCell(cb);
-            if (scrollsOverflowY() && (!cell->style()->height().isAuto() || !cell->table()->style()->height().isAuto()))
-                return 0;
-            return -1;
+        if (!skippedAutoHeightContainingBlock) {
+            result = cb->overrideSize();
+            if (result == -1) {
+                // Normally we would let the cell size intrinsically, but scrolling overflow has to be
+                // treated differently, since WinIE lets scrolled overflow regions shrink as needed.
+                // While we can't get all cases right, we can at least detect when the cell has a specified
+                // height or when the table has a specified height.  In these cases we want to initially have
+                // no size and allow the flexing of the table or the cell to its specified height to cause us
+                // to grow to fill the space.  This could end up being wrong in some cases, but it is
+                // preferable to the alternative (sizing intrinsically and making the row end up too big).
+                RenderTableCell* cell = toRenderTableCell(cb);
+                if (scrollsOverflowY() && (!cell->style()->height().isAuto() || !cell->table()->style()->height().isAuto()))
+                    return 0;
+                return -1;
+            }
+            includeBorderPadding = true;
         }
-        includeBorderPadding = true;
     }
     // Otherwise we only use our percentage height if our containing block had a specified
     // height.