Skip to content
Permalink
Browse files
REGRESSION(r143102): iframe with percentage height within table with …
…anonymous cell fails.

https://bugs.webkit.org/show_bug.cgi?id=113077

Source/WebCore:

Patch by Zalan Bujtas <zalan@apple.com> on 2013-03-27
Reviewed by Antti Koivisto.

http://www.w3.org/TR/CSS21/visuren.html#anonymous-block-level
"Anonymous block boxes are ignored when resolving percentage values that would refer to it:
the closest non-anonymous ancestor box is used instead."
When figuring out whether auto height needs to be applied on the current box, ignore anonymous
ancestors until the first non-anonymous containing block is found. This matches both
Firefox and Opera behaviour.

Test: fast/replaced/iframe-with-percentage-height-within-table-with-anonymous-table-cell.html

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight): Switch from
isAnonymousBlock() to isAnonymous() to make sure all anonymous boxes are ignored.
Remove isTableCell() check which is a noop as table cell isn't an anonymous block.

LayoutTests:

Patch by Zalan Bujtas <zalan@apple.com> on 2013-03-27
Reviewed by Antti Koivisto.

* fast/replaced/iframe-with-percentage-height-within-table-with-anonymous-table-cell-expected.txt: Added.
* fast/replaced/iframe-with-percentage-height-within-table-with-anonymous-table-cell.html: Added.

Canonical link: https://commits.webkit.org/131762@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@147021 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alanbujtas authored and webkit-commit-queue committed Mar 27, 2013
1 parent 67baa09 commit 2f6757c6f8e6677f3cf8d3564e52a3ef0b153dff
@@ -1,3 +1,13 @@
2013-03-27 Zalan Bujtas <zalan@apple.com>

REGRESSION(r143102): iframe with percentage height within table with anonymous cell fails.
https://bugs.webkit.org/show_bug.cgi?id=113077

Reviewed by Antti Koivisto.

* fast/replaced/iframe-with-percentage-height-within-table-with-anonymous-table-cell-expected.txt: Added.
* fast/replaced/iframe-with-percentage-height-within-table-with-anonymous-table-cell.html: Added.

2013-03-27 Pierre Rossi <pierre.rossi@gmail.com>

[Qt] Add WOFF support when using zlib
@@ -0,0 +1,10 @@
This test checks that iframe with percentage height within anonymous table cell has the correct height (strict mode).

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS getHeight('iframe-100') is window.innerHeight
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,68 @@
<!DOCTYPE html>
<head>
<title>Test for embedded iframe with height: 100% and anonymous table cell parent.</title>
<script src="../js/resources/js-test-pre.js"></script>
<script>
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.dumpAsText();
}

function getComputedStyleForElement(element, cssPropertyName)
{
if (!element) {
return null;
}
if (window.getComputedStyle) {
return window.getComputedStyle(element, '').getPropertyValue(cssPropertyName.replace(/([A-Z])/g, "-$1").toLowerCase());
}
if (element.currentStyle) {
return element.currentStyle[cssPropertyName];
}
return null;
}

function parsePixelValue(str)
{
if (typeof str != "string" || str.length < 3 || str.substr(str.length - 2) != "px") {
testFailed(str + " is unparsable.");
return -1;
}
return parseFloat(str);
}

function getHeight(id)
{
return parsePixelValue(getComputedStyleForElement(document.getElementById(id), 'height'));
}

function test()
{
description("This test checks that iframe with percentage height within anonymous table cell has the correct height (strict mode).");

shouldBe("getHeight('iframe-100')", "window.innerHeight");

isSuccessfullyParsed();

if (window.testRunner) {
testRunner.notifyDone();
}
}
</script>
<style>
html, body {
height: 100%;
}
</style>
</head>
<body onload="test()">
<p id="description"></p>
<div id="console"></div>

<div style="display:table; height: 100%;">
<div style="display:table-row; height: 100%;">
<iframe id="iframe-100" frameborder="0px" style="height: 100%;" src=""></iframe>
</div>
</div>
</body>
</html>
@@ -1,3 +1,24 @@
2013-03-27 Zalan Bujtas <zalan@apple.com>

REGRESSION(r143102): iframe with percentage height within table with anonymous cell fails.
https://bugs.webkit.org/show_bug.cgi?id=113077

Reviewed by Antti Koivisto.

http://www.w3.org/TR/CSS21/visuren.html#anonymous-block-level
"Anonymous block boxes are ignored when resolving percentage values that would refer to it:
the closest non-anonymous ancestor box is used instead."
When figuring out whether auto height needs to be applied on the current box, ignore anonymous
ancestors until the first non-anonymous containing block is found. This matches both
Firefox and Opera behaviour.

Test: fast/replaced/iframe-with-percentage-height-within-table-with-anonymous-table-cell.html

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight): Switch from
isAnonymousBlock() to isAnonymous() to make sure all anonymous boxes are ignored.
Remove isTableCell() check which is a noop as table cell isn't an anonymous block.

2013-03-27 Pierre Rossi <pierre.rossi@gmail.com>

[Qt] Add WOFF support when using zlib
@@ -380,12 +380,11 @@ bool RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight() const
if (!logicalHeightLength.isPercent() || isOutOfFlowPositioned() || document()->inQuirksMode())
return false;

// Anonymous block boxes are ignored when resolving percentage values that would refer to it:
// the closest non-anonymous ancestor box is used instead.
RenderBlock* cb = containingBlock();
while (cb->isAnonymousBlock()) {
if (cb->isTableCell())
return true;
while (cb->isAnonymous())
cb = cb->containingBlock();
}

if (!cb->style()->logicalHeight().isAuto() || (!cb->style()->logicalTop().isAuto() && !cb->style()->logicalBottom().isAuto()))
return false;

0 comments on commit 2f6757c

Please sign in to comment.