Title: [97378] trunk
Revision
97378
Author
rob...@webkit.org
Date
2011-10-13 12:04:43 -0700 (Thu, 13 Oct 2011)

Log Message

CSS 2.1 failure: inline-replaced-height-008.htm
https://bugs.webkit.org/show_bug.cgi?id=69273

Reviewed by Simon Fraser.

Source/WebCore:

Test: css2.1/20110323/inline-block-replaced-height-008.html

Per http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-height,  if 'height' has computed value of
'auto', the replaced element has an intrinsic ratio and its used width is known or resolved, then
the used value of 'height' is determined by the equation (used width) / (intrinsic ratio).

* rendering/RenderImage.cpp:
(WebCore::RenderImage::computeReplacedLogicalHeight):
* rendering/RenderReplaced.h:

LayoutTests:

* css2.1/20110323/floating-replaced-height-008.htm: Added.
* css2.1/20110323/inline-block-replaced-height-008.htm: Added.
* css2.1/20110323/inline-replaced-height-008.htm: Added.
* css2.1/20110323/support/60x60-green.png: Added
* platform/chromium-linux/css2.1/20110323/floating-replaced-height-008-expected.png: Added.
* platform/chromium-linux/css2.1/20110323/floating-replaced-height-008-expected.txt: Added.
* platform/chromium-linux/css2.1/20110323/inline-block-replaced-height-008-expected.png: Added.
* platform/chromium-linux/css2.1/20110323/inline-block-replaced-height-008-expected.txt: Added.
* platform/chromium-linux/css2.1/20110323/inline-replaced-height-008-expected.png: Added.
* platform/chromium-linux/css2.1/20110323/inline-replaced-height-008-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (97377 => 97378)


--- trunk/LayoutTests/ChangeLog	2011-10-13 19:02:03 UTC (rev 97377)
+++ trunk/LayoutTests/ChangeLog	2011-10-13 19:04:43 UTC (rev 97378)
@@ -1,3 +1,21 @@
+2011-10-03  Robert Hogan  <rob...@webkit.org>
+
+        CSS 2.1 failure: inline-replaced-height-008.htm
+        https://bugs.webkit.org/show_bug.cgi?id=69273
+
+        Reviewed by Simon Fraser.
+
+        * css2.1/20110323/floating-replaced-height-008.htm: Added.
+        * css2.1/20110323/inline-block-replaced-height-008.htm: Added.
+        * css2.1/20110323/inline-replaced-height-008.htm: Added.
+        * css2.1/20110323/support/60x60-green.png: Added
+        * platform/chromium-linux/css2.1/20110323/floating-replaced-height-008-expected.png: Added.
+        * platform/chromium-linux/css2.1/20110323/floating-replaced-height-008-expected.txt: Added.
+        * platform/chromium-linux/css2.1/20110323/inline-block-replaced-height-008-expected.png: Added.
+        * platform/chromium-linux/css2.1/20110323/inline-block-replaced-height-008-expected.txt: Added.
+        * platform/chromium-linux/css2.1/20110323/inline-replaced-height-008-expected.png: Added.
+        * platform/chromium-linux/css2.1/20110323/inline-replaced-height-008-expected.txt: Added.
+
 2011-10-13  Adam Klein  <ad...@chromium.org>
 
         Unreviewed, skip MutationObserver tests on wincairo.

Added: trunk/LayoutTests/css2.1/20110323/floating-replaced-height-008.htm (0 => 97378)


--- trunk/LayoutTests/css2.1/20110323/floating-replaced-height-008.htm	                        (rev 0)
+++ trunk/LayoutTests/css2.1/20110323/floating-replaced-height-008.htm	2011-10-13 19:04:43 UTC (rev 97378)
@@ -0,0 +1,38 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+
+ <head>
+
+  <title>CSS Test: Floating replaced elements - specified width, height in percentages and intrinsic ratio</title>
+
+  <link rel="author" title="Gérard Talbot" href=""
+  <link rel="help" href="" title="10.6.2 Inline replaced elements, block-level replaced elements in normal flow, 'inline-block' replaced elements in normal flow and floating replaced elements">
+  <link rel="bookmark" href="" title="Bug 274790: object specified with width and height percentages and with intrinsic ratio">
+  <meta http-equiv="Content-Style-Type" content="text/css">
+  <meta content="image" name="flags">
+  <meta content="When 'height: 1%' (or any other percentage) applies to a floating replaced element and when the height of its containing block is not specified explicitly (i.e., it depends on content height), then such height computes to 'auto'. Then, if such floating replaced element has an intrinsic ratio and its used width is known or resolved, then the used value of 'height' is determined by the equation (used width) / (intrinsic ratio)." name="assert">
+
+  <style type="text/css">
+  img {float: left;}
+  </style>
+
+ </head>
+
+ <body>
+
+  <p>There should be <strong>5 filled green squares</strong> with the same width and the <strong>same height</strong>. The 5 filled green squares should be <strong>identical</strong> to each other. This should still remain true even after a window resize.</p>
+
+  <div>
+   <img src="" width="15%" alt="FAIL: image download must be enabled"><img src="" width="5" height="5" alt="FAIL: image download must be enabled">
+  
+   <img src="" width="15%" height="1%" alt="FAIL: image download must be enabled"><img src="" width="5" height="5" alt="FAIL: image download must be enabled">
+  
+   <img src="" style="width: 15%;" alt="FAIL: image download must be enabled"><img src="" width="5" height="5" alt="FAIL: image download must be enabled">
+  
+   <img src="" style="width: 15%; height: auto;" alt="FAIL: image download must be enabled"><img src="" width="5" height="5" alt="FAIL: image download must be enabled">
+  
+   <img src="" style="width: 15%; height: 1%;" alt="FAIL: image download must be enabled">
+  </div>
+
+ </body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/css2.1/20110323/floating-replaced-height-008.htm
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/css2.1/20110323/inline-block-replaced-height-008.htm (0 => 97378)


--- trunk/LayoutTests/css2.1/20110323/inline-block-replaced-height-008.htm	                        (rev 0)
+++ trunk/LayoutTests/css2.1/20110323/inline-block-replaced-height-008.htm	2011-10-13 19:04:43 UTC (rev 97378)
@@ -0,0 +1,34 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+
+ <head>
+
+  <title>CSS Test: 'inline-block' replaced elements in normal flow - specified width, height in percentages and intrinsic ratio</title>
+
+  <link rel="author" title="Gérard Talbot" href=""
+  <link rel="help" href="" title="10.6.2 Inline replaced elements, block-level replaced elements in normal flow, 'inline-block' replaced elements in normal flow and floating replaced elements">
+  <link rel="bookmark" href="" title="Bug 274790: object specified with width and height percentages and with intrinsic ratio">
+  <meta http-equiv="Content-Style-Type" content="text/css">
+  <meta content="image" name="flags">
+  <meta content="When 'height: 1%' (or any other percentage) applies to an 'inline-block' replaced element and when the height of its containing block is not specified explicitly (i.e., it depends on content height), then such height computes to 'auto'. Then, if such inline-block replaced element has an intrinsic ratio and its used width is known or resolved, then the used value of 'height' is determined by the equation (used width) / (intrinsic ratio)." name="assert">
+
+ </head>
+
+ <body>
+
+  <p>There should be <strong>5 filled green squares</strong> with the same width and the <strong>same height</strong>. The 5 filled green squares should be <strong>identical</strong> to each other. This should still remain true even after a window resize.</p>
+
+  <div>
+   <object data="" type="image/png" width="15%">FAIL: image download must be enabled</object>
+
+   <object data="" type="image/png" width="15%" height="1%">FAIL: image download must be enabled</object> 
+  
+   <object data="" type="image/png" style="width: 15%;">FAIL: image download must be enabled</object>
+  
+   <object data="" type="image/png" style="width: 15%; height: auto;">FAIL: image download must be enabled</object> 
+  
+   <object data="" type="image/png" style="width: 15%; height: 1%;">FAIL: image download must be enabled</object>
+  </div>
+
+ </body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/css2.1/20110323/inline-block-replaced-height-008.htm
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/css2.1/20110323/inline-replaced-height-008.htm (0 => 97378)


--- trunk/LayoutTests/css2.1/20110323/inline-replaced-height-008.htm	                        (rev 0)
+++ trunk/LayoutTests/css2.1/20110323/inline-replaced-height-008.htm	2011-10-13 19:04:43 UTC (rev 97378)
@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+
+ <head>
+
+  <title>CSS Test: Inline replaced elements in normal flow - specified width, height in percentages and intrinsic ratio</title>
+
+  <link rel="author" title="Gérard Talbot" href=""
+  <link rel="help" href="" title="10.6.2 Inline replaced elements, block-level replaced elements in normal flow, 'inline-block' replaced elements in normal flow and floating replaced elements">
+  <meta http-equiv="Content-Style-Type" content="text/css">
+  <meta content="image" name="flags">
+  <meta content="When 'height: 1%' (or any other percentage) applies to an inline replaced element and when the height of its containing block is not specified explicitly (i.e., it depends on content height), then such height computes to 'auto'. Then, if such inline replaced element has an intrinsic ratio and its used width is known or resolved, then the used value of 'height' is determined by the equation (used width) / (intrinsic ratio)." name="assert">
+
+ </head>
+
+ <body>
+
+  <p>There should be <strong>5 filled green squares</strong> with the same width and the <strong>same height</strong>. The 5 filled green squares should be <strong>identical</strong> to each other. This should still remain true even after a window resize.</p>
+
+  <div>
+   <img src="" width="15%" alt="FAIL: image download must be enabled"> 
+
+   <img src="" width="15%" height="1%" alt="FAIL: image download must be enabled">
+   
+   <img src="" style="width: 15%;" alt="FAIL: image download must be enabled">
+   
+   <img src="" style="width: 15%; height: auto;" alt="FAIL: image download must be enabled">
+   
+   <img src="" style="width: 15%; height: 1%;" alt="FAIL: image download must be enabled">
+  </div>
+
+ </body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/css2.1/20110323/inline-replaced-height-008.htm
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/css2.1/20110323/support/60x60-green.png


(Binary files differ)
Property changes on: trunk/LayoutTests/css2.1/20110323/support/60x60-green.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/chromium-linux/css2.1/20110323/floating-replaced-height-008-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/chromium-linux/css2.1/20110323/floating-replaced-height-008-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/chromium-linux/css2.1/20110323/floating-replaced-height-008-expected.txt (0 => 97378)


--- trunk/LayoutTests/platform/chromium-linux/css2.1/20110323/floating-replaced-height-008-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium-linux/css2.1/20110323/floating-replaced-height-008-expected.txt	2011-10-13 19:04:43 UTC (rev 97378)
@@ -0,0 +1,33 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x189
+  RenderBlock {HTML} at (0,0) size 800x189
+    RenderBody {BODY} at (8,16) size 784x40
+      RenderBlock {P} at (0,0) size 784x40
+        RenderText {#text} at (0,0) size 101x19
+          text run at (0,0) width 101: "There should be "
+        RenderInline {STRONG} at (0,0) size 143x19
+          RenderText {#text} at (101,0) size 143x19
+            text run at (101,0) width 143: "5 filled green squares"
+        RenderText {#text} at (244,0) size 175x19
+          text run at (244,0) width 175: " with the same width and the "
+        RenderInline {STRONG} at (0,0) size 80x19
+          RenderText {#text} at (419,0) size 80x19
+            text run at (419,0) width 80: "same height"
+        RenderText {#text} at (499,0) size 228x19
+          text run at (499,0) width 228: ". The 5 filled green squares should be "
+        RenderInline {STRONG} at (0,0) size 56x19
+          RenderText {#text} at (727,0) size 56x19
+            text run at (727,0) width 56: "identical"
+        RenderText {#text} at (0,20) size 417x19
+          text run at (0,20) width 417: "to each other. This should still remain true even after a window resize."
+      RenderBlock {DIV} at (0,56) size 784x0
+        RenderImage {IMG} at (0,0) size 117x117
+        RenderImage {IMG} at (117,0) size 5x5
+        RenderImage {IMG} at (122,0) size 117x117
+        RenderImage {IMG} at (239,0) size 5x5
+        RenderImage {IMG} at (244,0) size 117x117
+        RenderImage {IMG} at (361,0) size 5x5
+        RenderImage {IMG} at (366,0) size 117x117
+        RenderImage {IMG} at (483,0) size 5x5
+        RenderImage {IMG} at (488,0) size 117x117
Property changes on: trunk/LayoutTests/platform/chromium-linux/css2.1/20110323/floating-replaced-height-008-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/platform/chromium-linux/css2.1/20110323/inline-block-replaced-height-008-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/chromium-linux/css2.1/20110323/inline-block-replaced-height-008-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/chromium-linux/css2.1/20110323/inline-block-replaced-height-008-expected.txt (0 => 97378)


--- trunk/LayoutTests/platform/chromium-linux/css2.1/20110323/inline-block-replaced-height-008-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium-linux/css2.1/20110323/inline-block-replaced-height-008-expected.txt	2011-10-13 19:04:43 UTC (rev 97378)
@@ -0,0 +1,38 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x202
+  RenderBlock {HTML} at (0,0) size 800x202
+    RenderBody {BODY} at (8,16) size 784x178
+      RenderBlock {P} at (0,0) size 784x40
+        RenderText {#text} at (0,0) size 101x19
+          text run at (0,0) width 101: "There should be "
+        RenderInline {STRONG} at (0,0) size 143x19
+          RenderText {#text} at (101,0) size 143x19
+            text run at (101,0) width 143: "5 filled green squares"
+        RenderText {#text} at (244,0) size 175x19
+          text run at (244,0) width 175: " with the same width and the "
+        RenderInline {STRONG} at (0,0) size 80x19
+          RenderText {#text} at (419,0) size 80x19
+            text run at (419,0) width 80: "same height"
+        RenderText {#text} at (499,0) size 228x19
+          text run at (499,0) width 228: ". The 5 filled green squares should be "
+        RenderInline {STRONG} at (0,0) size 56x19
+          RenderText {#text} at (727,0) size 56x19
+            text run at (727,0) width 56: "identical"
+        RenderText {#text} at (0,20) size 417x19
+          text run at (0,20) width 417: "to each other. This should still remain true even after a window resize."
+      RenderBlock {DIV} at (0,56) size 784x122
+        RenderImage {OBJECT} at (0,0) size 117x117
+        RenderText {#text} at (117,102) size 4x19
+          text run at (117,102) width 4: " "
+        RenderImage {OBJECT} at (121,0) size 117x117
+        RenderText {#text} at (238,102) size 4x19
+          text run at (238,102) width 4: " "
+        RenderImage {OBJECT} at (242,0) size 117x117
+        RenderText {#text} at (359,102) size 4x19
+          text run at (359,102) width 4: " "
+        RenderImage {OBJECT} at (363,0) size 117x117
+        RenderText {#text} at (480,102) size 4x19
+          text run at (480,102) width 4: " "
+        RenderImage {OBJECT} at (484,0) size 117x117
+        RenderText {#text} at (0,0) size 0x0
Property changes on: trunk/LayoutTests/platform/chromium-linux/css2.1/20110323/inline-block-replaced-height-008-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/platform/chromium-linux/css2.1/20110323/inline-replaced-height-008-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/chromium-linux/css2.1/20110323/inline-replaced-height-008-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/chromium-linux/css2.1/20110323/inline-replaced-height-008-expected.txt (0 => 97378)


--- trunk/LayoutTests/platform/chromium-linux/css2.1/20110323/inline-replaced-height-008-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium-linux/css2.1/20110323/inline-replaced-height-008-expected.txt	2011-10-13 19:04:43 UTC (rev 97378)
@@ -0,0 +1,38 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x202
+  RenderBlock {HTML} at (0,0) size 800x202
+    RenderBody {BODY} at (8,16) size 784x178
+      RenderBlock {P} at (0,0) size 784x40
+        RenderText {#text} at (0,0) size 101x19
+          text run at (0,0) width 101: "There should be "
+        RenderInline {STRONG} at (0,0) size 143x19
+          RenderText {#text} at (101,0) size 143x19
+            text run at (101,0) width 143: "5 filled green squares"
+        RenderText {#text} at (244,0) size 175x19
+          text run at (244,0) width 175: " with the same width and the "
+        RenderInline {STRONG} at (0,0) size 80x19
+          RenderText {#text} at (419,0) size 80x19
+            text run at (419,0) width 80: "same height"
+        RenderText {#text} at (499,0) size 228x19
+          text run at (499,0) width 228: ". The 5 filled green squares should be "
+        RenderInline {STRONG} at (0,0) size 56x19
+          RenderText {#text} at (727,0) size 56x19
+            text run at (727,0) width 56: "identical"
+        RenderText {#text} at (0,20) size 417x19
+          text run at (0,20) width 417: "to each other. This should still remain true even after a window resize."
+      RenderBlock {DIV} at (0,56) size 784x122
+        RenderImage {IMG} at (0,0) size 117x117
+        RenderText {#text} at (117,102) size 4x19
+          text run at (117,102) width 4: " "
+        RenderImage {IMG} at (121,0) size 117x117
+        RenderText {#text} at (238,102) size 4x19
+          text run at (238,102) width 4: " "
+        RenderImage {IMG} at (242,0) size 117x117
+        RenderText {#text} at (359,102) size 4x19
+          text run at (359,102) width 4: " "
+        RenderImage {IMG} at (363,0) size 117x117
+        RenderText {#text} at (480,102) size 4x19
+          text run at (480,102) width 4: " "
+        RenderImage {IMG} at (484,0) size 117x117
+        RenderText {#text} at (0,0) size 0x0
Property changes on: trunk/LayoutTests/platform/chromium-linux/css2.1/20110323/inline-replaced-height-008-expected.txt
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (97377 => 97378)


--- trunk/Source/WebCore/ChangeLog	2011-10-13 19:02:03 UTC (rev 97377)
+++ trunk/Source/WebCore/ChangeLog	2011-10-13 19:04:43 UTC (rev 97378)
@@ -1,3 +1,20 @@
+2011-10-03  Robert Hogan  <rob...@webkit.org>
+
+        CSS 2.1 failure: inline-replaced-height-008.htm
+        https://bugs.webkit.org/show_bug.cgi?id=69273
+
+        Reviewed by Simon Fraser.
+
+        Test: css2.1/20110323/inline-block-replaced-height-008.html
+
+        Per http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-height,  if 'height' has computed value of 
+        'auto', the replaced element has an intrinsic ratio and its used width is known or resolved, then 
+        the used value of 'height' is determined by the equation (used width) / (intrinsic ratio).
+
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::computeReplacedLogicalHeight):
+        * rendering/RenderReplaced.h:
+
 2011-10-13  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r97362.

Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (97377 => 97378)


--- trunk/Source/WebCore/rendering/RenderImage.cpp	2011-10-13 19:02:03 UTC (rev 97377)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp	2011-10-13 19:04:43 UTC (rev 97378)
@@ -537,8 +537,11 @@
 
 LayoutUnit RenderImage::computeReplacedLogicalHeight() const
 {
+    // FIXME: This function should use RenderReplaced::computeReplacedLogicalHeight()
     LayoutUnit logicalHeight;
-    if (isLogicalHeightSpecified())
+    if (logicalHeightIsAuto() && !style()->logicalWidth().isAuto() && intrinsicLogicalWidth() && intrinsicLogicalHeight())
+        logicalHeight = static_cast<LayoutUnit>(availableLogicalWidth() * intrinsicLogicalHeight() / intrinsicLogicalWidth());
+    else if (isLogicalHeightSpecified())
         logicalHeight = computeReplacedLogicalHeightUsing(style()->logicalHeight());
     else if (m_imageResource->usesImageContainerSize()) {
         LayoutSize size = m_imageResource->imageSize(style()->effectiveZoom());

Modified: trunk/Source/WebCore/rendering/RenderReplaced.h (97377 => 97378)


--- trunk/Source/WebCore/rendering/RenderReplaced.h	2011-10-13 19:02:03 UTC (rev 97377)
+++ trunk/Source/WebCore/rendering/RenderReplaced.h	2011-10-13 19:04:43 UTC (rev 97378)
@@ -35,6 +35,8 @@
     virtual LayoutUnit computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
     virtual LayoutUnit computeReplacedLogicalHeight() const;
 
+    bool logicalHeightIsAuto() const;
+
 protected:
     virtual void willBeDestroyed();
 
@@ -62,7 +64,6 @@
     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"; }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to