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
+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).
--- /dev/null
+4274a91a85e9e3bf64a8eacf7d53c47d
\ No newline at end of file
--- /dev/null
+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]
--- /dev/null
+<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>
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
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');
+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.
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
// 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);
}
// 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.