Commit 484ecfeb authored by hyatt@apple.com's avatar hyatt@apple.com

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

        
Reviewed by Simon Fraser.

Percentage heights should skip anonymous containing blocks when computing the used value.

Added fast/block/basic/percentage-height-inside-anonymous-block.html

Source/WebCore: 

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computePercentageLogicalHeight):

LayoutTests: 

* fast/block/basic/percent-height-inside-anonymous-block.html: Added.
* platform/mac/fast/block/basic/percent-height-inside-anonymous-block-expected.checksum: Added.
* platform/mac/fast/block/basic/percent-height-inside-anonymous-block-expected.png: Added.
* platform/mac/fast/block/basic/percent-height-inside-anonymous-block-expected.txt: Added.



git-svn-id: svn://svn.chromium.org/blink/trunk@80786 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 40c30571
2011-03-10 David Hyatt <hyatt@apple.com>
Reviewed by Simon Fraser.
https://bugs.webkit.org/show_bug.cgi?id=47151
Percentage heights should skip anonymous containing blocks when computing the used value.
Added fast/block/basic/percentage-height-inside-anonymous-block.html
* fast/block/basic/percent-height-inside-anonymous-block.html: Added.
* platform/mac/fast/block/basic/percent-height-inside-anonymous-block-expected.checksum: Added.
* platform/mac/fast/block/basic/percent-height-inside-anonymous-block-expected.png: Added.
* platform/mac/fast/block/basic/percent-height-inside-anonymous-block-expected.txt: Added.
2011-01-25 Martin Robinson <mrobinson@igalia.com>
Reviewed by Xan Lopez.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="reference" href="support/ref-green-box-100x100.xht">
<title>CSS Test: Percent heights inside anonymous blocks</title>
<link rel="author" title="Boris Zbarsky" href="mailto:bzbarsky@mit.edu">
<link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#anonymous-block-level">
<link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#containing-block-details">
<link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#the-height-property">
<meta name="assert" content="Anonymous block boxes are ignored when resolving percentage values that would refer to it: the closest non-anonymous ancestor box is used instead.">
<style type="text/css">
#parent { height: 200px; position: relative; }
#child { float: left; height: 50%; width: 100px; background: green; position: relative }
#background { position: absolute; top: 0; left: 0; width: 100px; height: 100px; background: red }
</style>
</head>
<body>
<p>There must be a green square below and no red.</p>
<div id="parent">
<div id="background"></div>
<div id="child"></div>&nbsp;<div></div>
</div>
</body>
</html>
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x258
RenderBlock {HTML} at (0,0) size 800x258
RenderBody {BODY} at (8,16) size 784x234
RenderBlock {P} at (0,0) size 784x18
RenderText {#text} at (0,0) size 303x18
text run at (0,0) width 303: "There must be a green square below and no red."
layer at (8,50) size 784x200
RenderBlock (relative positioned) {DIV} at (0,34) size 784x200
RenderBlock (anonymous) at (0,0) size 784x18
RenderText {#text} at (100,0) size 4x18
text run at (100,0) width 4: " "
RenderBlock {DIV} at (0,18) size 784x0
layer at (8,50) size 100x100
RenderBlock (positioned) {DIV} at (0,0) size 100x100 [bgcolor=#FF0000]
layer at (8,50) size 100x100
RenderBlock (floating) {DIV} at (0,0) size 100x100 [bgcolor=#008000]
2011-03-10 David Hyatt <hyatt@apple.com>
Reviewed by Simon Fraser.
https://bugs.webkit.org/show_bug.cgi?id=47151
Percentage heights should skip anonymous containing blocks when computing the used value.
Added fast/block/basic/percentage-height-inside-anonymous-block.html
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computePercentageLogicalHeight):
2011-03-10 Nat Duca <nduca@chromium.org>
Reviewed by James Robinson.
......
......@@ -1814,18 +1814,20 @@ int RenderBox::computeLogicalHeightUsing(const Length& h)
int RenderBox::computePercentageLogicalHeight(const Length& height)
{
int result = -1;
// In quirks mode, blocks with auto height are skipped, and we keep looking for an enclosing
// block that may have a specified height and then use it. In strict mode, this violates the
// specification, which states that percentage heights just revert to auto if the containing
// block has an auto height. We still skip anonymous containing blocks in both modes, though, and look
// only at explicit containers.
bool skippedAutoHeightContainingBlock = false;
RenderBlock* cb = containingBlock();
if (document()->inQuirksMode()) {
// In quirks mode, blocks with auto height are skipped, and we keep looking for an enclosing
// block that may have a specified height and then use it. In strict mode, this violates the
// 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()->logicalHeight().isAuto()) {
skippedAutoHeightContainingBlock = true;
cb = cb->containingBlock();
cb->addPercentHeightDescendant(this);
}
while (!cb->isRenderView() && !cb->isBody() && !cb->isTableCell() && !cb->isPositioned() && cb->style()->logicalHeight().isAuto()) {
if (!document()->inQuirksMode() && !cb->isAnonymousBlock())
break;
skippedAutoHeightContainingBlock = true;
cb = cb->containingBlock();
cb->addPercentHeightDescendant(this);
}
// A positioned element that specified both top/bottom or that specifies height should be treated as though it has a height
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment