- Revision
- 91242
- Author
- [email protected]
- Date
- 2011-07-19 01:12:46 -0700 (Tue, 19 Jul 2011)
Log Message
2011-07-19 Nikolas Zimmermann <[email protected]>
REGRESSION (r88913): Preview in Safari's snippet editor has a fixed height instead of filling the entire pane
https://bugs.webkit.org/show_bug.cgi?id=64059
REGRESSION (r88913): <object> has wrong computed height
https://bugs.webkit.org/show_bug.cgi?id=62769
Reviewed by Rob Buis.
Add new layout test in fast/css covering both bugs.
Update svg/zoom/page results (this is a progression, but the test itself remains broken, see comment inline).
* fast/css/replaced-element-implicit-size.html: Added.
* platform/mac/fast/css/replaced-element-implicit-size-expected.png: Added.
* platform/mac/fast/css/replaced-element-implicit-size-expected.txt: Added.
* platform/mac/svg/zoom/page/zoom-svg-through-object-with-text-expected.png:
* platform/mac/svg/zoom/page/zoom-svg-through-object-with-text-expected.txt:
2011-07-19 Nikolas Zimmermann <[email protected]>
REGRESSION (r88913): Preview in Safari's snippet editor has a fixed height instead of filling the entire pane
https://bugs.webkit.org/show_bug.cgi?id=64059
REGRESSION (r88913): <object> has wrong computed height
https://bugs.webkit.org/show_bug.cgi?id=62769
Reviewed by Rob Buis.
Fix misinterpretation of CSS 2.1 - "10.5 Content height: the 'height' property".
It says "If the height of the containing block is not specified explicitelz (i.e. it depends on the
content height), and this element is not absolutely positioned, the value computes to 'auto'".
Checking whether the containing block height depends on the content height is not equal to checking
whether the height property is set on the containing block, there are other ways to implicitly specify
the height by setting top & bottom. Fix that by checking whether the containing block has a height
property or top & bottom set.
While I was at it, make computeReplacedLogicalWidth/Height a bit more explicit to make it easier to compare
the code with the spec quoatations - this doesn't change the functionality only the readability.
Test: fast/css/replaced-element-implicit-size.html
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeReplacedLogicalWidth): Cleanup comment, make code more explicit.
(WebCore::RenderReplaced::logicalHeightIsAuto): Add helper method used by computeReplacedLogicalHeight.
(WebCore::RenderReplaced::computeReplacedLogicalHeight): Fix height=auto detection.
* rendering/RenderReplaced.h:
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (91241 => 91242)
--- trunk/LayoutTests/ChangeLog 2011-07-19 07:38:05 UTC (rev 91241)
+++ trunk/LayoutTests/ChangeLog 2011-07-19 08:12:46 UTC (rev 91242)
@@ -1,3 +1,22 @@
+2011-07-19 Nikolas Zimmermann <[email protected]>
+
+ REGRESSION (r88913): Preview in Safari's snippet editor has a fixed height instead of filling the entire pane
+ https://bugs.webkit.org/show_bug.cgi?id=64059
+
+ REGRESSION (r88913): <object> has wrong computed height
+ https://bugs.webkit.org/show_bug.cgi?id=62769
+
+ Reviewed by Rob Buis.
+
+ Add new layout test in fast/css covering both bugs.
+ Update svg/zoom/page results (this is a progression, but the test itself remains broken, see comment inline).
+
+ * fast/css/replaced-element-implicit-size.html: Added.
+ * platform/mac/fast/css/replaced-element-implicit-size-expected.png: Added.
+ * platform/mac/fast/css/replaced-element-implicit-size-expected.txt: Added.
+ * platform/mac/svg/zoom/page/zoom-svg-through-object-with-text-expected.png:
+ * platform/mac/svg/zoom/page/zoom-svg-through-object-with-text-expected.txt:
+
2011-07-18 Ryosuke Niwa <[email protected]>
Fix Chromium test expectations.
Added: trunk/LayoutTests/fast/css/replaced-element-implicit-size.html (0 => 91242)
--- trunk/LayoutTests/fast/css/replaced-element-implicit-size.html (rev 0)
+++ trunk/LayoutTests/fast/css/replaced-element-implicit-size.html 2011-07-19 08:12:46 UTC (rev 91242)
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<div style="background-color: red; position: absolute; left: 10px; right: 10px; top: 10px; bottom: 10px;">
+ <iframe style="border: none; background-color: green; width: 100%; height: 100%;"></iframe>
+</div>
Added: trunk/LayoutTests/platform/mac/fast/css/replaced-element-implicit-size-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/css/replaced-element-implicit-size-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/platform/mac/fast/css/replaced-element-implicit-size-expected.txt (0 => 91242)
--- trunk/LayoutTests/platform/mac/fast/css/replaced-element-implicit-size-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/css/replaced-element-implicit-size-expected.txt 2011-07-19 08:12:46 UTC (rev 91242)
@@ -0,0 +1,14 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x8
+ RenderBlock {HTML} at (0,0) size 800x8
+ RenderBody {BODY} at (8,8) size 784x0
+layer at (10,10) size 780x580
+ RenderBlock (positioned) {DIV} at (10,10) size 780x580 [bgcolor=#FF0000]
+ RenderPartObject {IFRAME} at (0,0) size 780x580 [bgcolor=#008000]
+ layer at (0,0) size 780x580
+ RenderView at (0,0) size 780x580
+ layer at (0,0) size 780x580
+ RenderBlock {HTML} at (0,0) size 780x580
+ RenderBody {BODY} at (8,8) size 764x564
+ RenderText {#text} at (0,0) size 0x0
Modified: trunk/LayoutTests/platform/mac/svg/zoom/page/zoom-svg-through-object-with-text-expected.png
(Binary files differ)
Modified: trunk/LayoutTests/platform/mac/svg/zoom/page/zoom-svg-through-object-with-text-expected.txt (91241 => 91242)
--- trunk/LayoutTests/platform/mac/svg/zoom/page/zoom-svg-through-object-with-text-expected.txt 2011-07-19 07:38:05 UTC (rev 91241)
+++ trunk/LayoutTests/platform/mac/svg/zoom/page/zoom-svg-through-object-with-text-expected.txt 2011-07-19 08:12:46 UTC (rev 91242)
@@ -7,12 +7,12 @@
layer at (0,0) size 59x13
RenderView at (0,0) size 59x13
layer at (0,0) size 59x13
- RenderSVGRoot {svg} at (0,0) size 59x13
- RenderSVGPath {rect} at (0,0) size 59x13 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=59.00] [height=13.00]
- RenderSVGPath {circle} at (25,2) size 9x9 [fill={[type=SOLID] [color=#0000FF]}] [cx=29.50] [cy=6.50] [r=4.27]
- RenderSVGText {text} at (5,2) size 29x18 contains 1 chunk(s)
- RenderSVGInlineText {#text} at (0,0) size 29x18
- chunk 1 text run 1 at (5.00,16.00) startOffset 0 endOffset 4 width 29.00: "Text"
+ RenderSVGRoot {svg} at (0,0) size 49x13
+ RenderSVGPath {rect} at (0,0) size 49x12 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=59.00] [height=13.00]
+ RenderSVGPath {circle} at (20,1) size 9x9 [fill={[type=SOLID] [color=#0000FF]}] [cx=29.50] [cy=6.50] [r=4.27]
+ RenderSVGText {text} at (5,1) size 31x19 contains 1 chunk(s)
+ RenderSVGInlineText {#text} at (0,0) size 31x19
+ chunk 1 text run 1 at (5.00,16.00) startOffset 0 endOffset 4 width 30.24: "Text"
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
Modified: trunk/Source/WebCore/ChangeLog (91241 => 91242)
--- trunk/Source/WebCore/ChangeLog 2011-07-19 07:38:05 UTC (rev 91241)
+++ trunk/Source/WebCore/ChangeLog 2011-07-19 08:12:46 UTC (rev 91242)
@@ -1,3 +1,33 @@
+2011-07-19 Nikolas Zimmermann <[email protected]>
+
+ REGRESSION (r88913): Preview in Safari's snippet editor has a fixed height instead of filling the entire pane
+ https://bugs.webkit.org/show_bug.cgi?id=64059
+
+ REGRESSION (r88913): <object> has wrong computed height
+ https://bugs.webkit.org/show_bug.cgi?id=62769
+
+ Reviewed by Rob Buis.
+
+ Fix misinterpretation of CSS 2.1 - "10.5 Content height: the 'height' property".
+ It says "If the height of the containing block is not specified explicitelz (i.e. it depends on the
+ content height), and this element is not absolutely positioned, the value computes to 'auto'".
+
+ Checking whether the containing block height depends on the content height is not equal to checking
+ whether the height property is set on the containing block, there are other ways to implicitly specify
+ the height by setting top & bottom. Fix that by checking whether the containing block has a height
+ property or top & bottom set.
+
+ While I was at it, make computeReplacedLogicalWidth/Height a bit more explicit to make it easier to compare
+ the code with the spec quoatations - this doesn't change the functionality only the readability.
+
+ Test: fast/css/replaced-element-implicit-size.html
+
+ * rendering/RenderReplaced.cpp:
+ (WebCore::RenderReplaced::computeReplacedLogicalWidth): Cleanup comment, make code more explicit.
+ (WebCore::RenderReplaced::logicalHeightIsAuto): Add helper method used by computeReplacedLogicalHeight.
+ (WebCore::RenderReplaced::computeReplacedLogicalHeight): Fix height=auto detection.
+ * rendering/RenderReplaced.h:
+
2011-07-18 Ryosuke Niwa <[email protected]>
REGRESSION(91209?): fast/css/custom-font-xheight.html is failing on Leopard
Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (91241 => 91242)
--- trunk/Source/WebCore/rendering/RenderReplaced.cpp 2011-07-19 07:38:05 UTC (rev 91241)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp 2011-07-19 08:12:46 UTC (rev 91242)
@@ -297,27 +297,39 @@
// Otherwise, if 'width' has a computed value of 'auto', and the element has an intrinsic width, then that intrinsic width is the used value of 'width'.
if (hasIntrinsicWidth)
return computeIntrinsicLogicalWidth(contentRenderer, includeMaxWidth);
+
+ // Otherwise, if 'width' has a computed value of 'auto', but none of the conditions above are met, then the used value of 'width' becomes 300px. If 300px is too
+ // wide to fit the device, UAs should use the width of the largest rectangle that has a 2:1 ratio and fits the device instead.
+ return computeReplacedLogicalWidthRespectingMinMaxWidth(cDefaultWidth, includeMaxWidth);
}
- // Otherwise, if 'width' has a computed value of 'auto', but none of the conditions above are met, then the used value of 'width' becomes 300px. If 300px is too
- // wide to fit the device, UAs should use the width of the largest rectangle that has a 2:1 ratio and fits the device instead.
return computeReplacedLogicalWidthRespectingMinMaxWidth(intrinsicLogicalWidth(), includeMaxWidth);
}
+bool RenderReplaced::logicalHeightIsAuto() const
+{
+ Length logicalHeightLength = style()->logicalHeight();
+ if (logicalHeightLength.isAuto())
+ return true;
+
+ // For percentage heights: The percentage is calculated with respect to the height of the generated box's
+ // containing block. If the height of the containing block is not specified explicitly (i.e., it depends
+ // on content height), and this element is not absolutely positioned, the value computes to 'auto'.
+ if (!logicalHeightLength.isPercent() || isPositioned() || document()->inQuirksMode())
+ return false;
+
+ for (RenderBlock* cb = containingBlock(); !cb->isRenderView(); cb = cb->containingBlock()) {
+ if (cb->isTableCell() || (!cb->style()->logicalHeight().isAuto() || (!cb->style()->top().isAuto() && !cb->style()->bottom().isAuto())))
+ return false;
+ }
+
+ return true;
+}
+
LayoutUnit RenderReplaced::computeReplacedLogicalHeight() const
{
// 10.5 Content height: the 'height' property: http://www.w3.org/TR/CSS21/visudet.html#propdef-height
- // If the height of the containing block is not specified explicitly (i.e., it depends on
- // content height), and this element is not absolutely positioned, the value computes to 'auto'.
- bool heightIsAuto = style()->logicalHeight().isAuto();
- if (!document()->inQuirksMode() && !isPositioned() && style()->logicalHeight().isPercent()) {
- if (RenderObject* containingBlock = this->containingBlock()) {
- while (containingBlock->isAnonymous())
- containingBlock = containingBlock->containingBlock();
- heightIsAuto = !containingBlock->style()->logicalHeight().isSpecified();
- }
- }
-
+ bool heightIsAuto = logicalHeightIsAuto();
if (style()->logicalHeight().isSpecified() && !heightIsAuto)
return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(style()->logicalHeight()));
@@ -350,10 +362,12 @@
// Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic height, then that intrinsic height is the used value of 'height'.
if (hasIntrinsicHeight)
return computeIntrinsicLogicalHeight(contentRenderer);
+
+ // Otherwise, if 'height' has a computed value of 'auto', but none of the conditions above are met, then the used value of 'height' must be set to the height
+ // of the largest rectangle that has a 2:1 ratio, has a height not greater than 150px, and has a width not greater than the device width.
+ return computeReplacedLogicalHeightRespectingMinMaxHeight(cDefaultHeight);
}
- // Otherwise, if 'height' has a computed value of 'auto', but none of the conditions above are met, then the used value of 'height' must be set to the height
- // of the largest rectangle that has a 2:1 ratio, has a height not greater than 150px, and has a width not greater than the device width.
return computeReplacedLogicalHeightRespectingMinMaxHeight(intrinsicLogicalHeight());
}
Modified: trunk/Source/WebCore/rendering/RenderReplaced.h (91241 => 91242)
--- trunk/Source/WebCore/rendering/RenderReplaced.h 2011-07-19 07:38:05 UTC (rev 91241)
+++ trunk/Source/WebCore/rendering/RenderReplaced.h 2011-07-19 08:12:46 UTC (rev 91242)
@@ -62,6 +62,7 @@
virtual RenderBox* embeddedContentBox() const { return 0; }
int computeIntrinsicLogicalWidth(RenderBox* contentRenderer, bool includeMaxWidth) const;
int computeIntrinsicLogicalHeight(RenderBox* contentRenderer) const;
+ bool logicalHeightIsAuto() const;
virtual const char* renderName() const { return "RenderReplaced"; }