Title: [101787] trunk
Revision
101787
Author
[email protected]
Date
2011-12-02 05:32:47 -0800 (Fri, 02 Dec 2011)

Log Message

Inline non-replaced elements are reported to have zero width and height
https://bugs.webkit.org/show_bug.cgi?id=61117

Reviewed by Antti Koivisto.

Source/WebCore:

According to http://www.w3.org/TR/CSS21/visudet.html, the "width" and "height" properties
do not apply for inline non-replaced elements and should have their initial value of "auto"
as their computed values.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):

LayoutTests:

* fast/dom/beforeload/image-object-before-load-innerHTML.html:
* fast/dom/beforeload/image-object-before-load.html:
* platform/chromium-win/svg/css/getComputedStyle-basic-expected.txt:
* svg/css/getComputedStyle-basic-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (101786 => 101787)


--- trunk/LayoutTests/ChangeLog	2011-12-02 12:58:24 UTC (rev 101786)
+++ trunk/LayoutTests/ChangeLog	2011-12-02 13:32:47 UTC (rev 101787)
@@ -1,3 +1,15 @@
+2011-11-28  Alexander Pavlov  <[email protected]>
+
+        Inline non-replaced elements are reported to have zero width and height
+        https://bugs.webkit.org/show_bug.cgi?id=61117
+
+        Reviewed by Antti Koivisto.
+
+        * fast/dom/beforeload/image-object-before-load-innerHTML.html:
+        * fast/dom/beforeload/image-object-before-load.html:
+        * platform/chromium-win/svg/css/getComputedStyle-basic-expected.txt:
+        * svg/css/getComputedStyle-basic-expected.txt:
+
 2011-12-02  Philippe Normand  <[email protected]>
 
         Unreviewed, GTK rebaseline.

Modified: trunk/LayoutTests/fast/dom/beforeload/image-object-before-load-innerHTML.html (101786 => 101787)


--- trunk/LayoutTests/fast/dom/beforeload/image-object-before-load-innerHTML.html	2011-12-02 12:58:24 UTC (rev 101786)
+++ trunk/LayoutTests/fast/dom/beforeload/image-object-before-load-innerHTML.html	2011-12-02 13:32:47 UTC (rev 101787)
@@ -14,7 +14,7 @@
         function checkObject()
         {
             var style = getComputedStyle(document.getElementsByTagName("object")[0], null);
-            if (style.width != "0px" || style.height != "0px")
+            if (style.width != "auto" || style.height != "auto")
                 print("FAIL", "red");
 
             if (window.layoutTestController)

Modified: trunk/LayoutTests/fast/dom/beforeload/image-object-before-load.html (101786 => 101787)


--- trunk/LayoutTests/fast/dom/beforeload/image-object-before-load.html	2011-12-02 12:58:24 UTC (rev 101786)
+++ trunk/LayoutTests/fast/dom/beforeload/image-object-before-load.html	2011-12-02 13:32:47 UTC (rev 101787)
@@ -14,7 +14,7 @@
         function checkObject()
         {
             var style = getComputedStyle(document.getElementsByTagName("object")[0], null);
-            if (style.width != "0px" || style.height != "0px")
+            if (style.width != "auto" || style.height != "auto")
                 print("FAIL", "red");
 
             if (window.layoutTestController)

Modified: trunk/LayoutTests/platform/chromium-win/svg/css/getComputedStyle-basic-expected.txt (101786 => 101787)


--- trunk/LayoutTests/platform/chromium-win/svg/css/getComputedStyle-basic-expected.txt	2011-12-02 12:58:24 UTC (rev 101786)
+++ trunk/LayoutTests/platform/chromium-win/svg/css/getComputedStyle-basic-expected.txt	2011-12-02 13:32:47 UTC (rev 101787)
@@ -92,7 +92,7 @@
 rect: style.getPropertyCSSValue(font-variant) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(font-weight) : normal
 rect: style.getPropertyCSSValue(font-weight) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(height) : 0px
+rect: style.getPropertyValue(height) : auto
 rect: style.getPropertyCSSValue(height) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(image-rendering) : auto
 rect: style.getPropertyCSSValue(image-rendering) : [object CSSPrimitiveValue]
@@ -190,7 +190,7 @@
 rect: style.getPropertyCSSValue(white-space) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(widows) : 2
 rect: style.getPropertyCSSValue(widows) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(width) : 0px
+rect: style.getPropertyValue(width) : auto
 rect: style.getPropertyCSSValue(width) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(word-break) : normal
 rect: style.getPropertyCSSValue(word-break) : [object CSSPrimitiveValue]
@@ -596,7 +596,7 @@
 g: style.getPropertyCSSValue(font-variant) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(font-weight) : normal
 g: style.getPropertyCSSValue(font-weight) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(height) : 0px
+g: style.getPropertyValue(height) : auto
 g: style.getPropertyCSSValue(height) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(image-rendering) : auto
 g: style.getPropertyCSSValue(image-rendering) : [object CSSPrimitiveValue]
@@ -694,7 +694,7 @@
 g: style.getPropertyCSSValue(white-space) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(widows) : 2
 g: style.getPropertyCSSValue(widows) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(width) : 0px
+g: style.getPropertyValue(width) : auto
 g: style.getPropertyCSSValue(width) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(word-break) : normal
 g: style.getPropertyCSSValue(word-break) : [object CSSPrimitiveValue]

Modified: trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt (101786 => 101787)


--- trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt	2011-12-02 12:58:24 UTC (rev 101786)
+++ trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt	2011-12-02 13:32:47 UTC (rev 101787)
@@ -92,7 +92,7 @@
 rect: style.getPropertyCSSValue(font-variant) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(font-weight) : normal
 rect: style.getPropertyCSSValue(font-weight) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(height) : 0px
+rect: style.getPropertyValue(height) : auto
 rect: style.getPropertyCSSValue(height) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(image-rendering) : auto
 rect: style.getPropertyCSSValue(image-rendering) : [object CSSPrimitiveValue]
@@ -190,7 +190,7 @@
 rect: style.getPropertyCSSValue(white-space) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(widows) : 2
 rect: style.getPropertyCSSValue(widows) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(width) : 0px
+rect: style.getPropertyValue(width) : auto
 rect: style.getPropertyCSSValue(width) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(word-break) : normal
 rect: style.getPropertyCSSValue(word-break) : [object CSSPrimitiveValue]
@@ -596,7 +596,7 @@
 g: style.getPropertyCSSValue(font-variant) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(font-weight) : normal
 g: style.getPropertyCSSValue(font-weight) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(height) : 0px
+g: style.getPropertyValue(height) : auto
 g: style.getPropertyCSSValue(height) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(image-rendering) : auto
 g: style.getPropertyCSSValue(image-rendering) : [object CSSPrimitiveValue]
@@ -694,7 +694,7 @@
 g: style.getPropertyCSSValue(white-space) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(widows) : 2
 g: style.getPropertyCSSValue(widows) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(width) : 0px
+g: style.getPropertyValue(width) : auto
 g: style.getPropertyCSSValue(width) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(word-break) : normal
 g: style.getPropertyCSSValue(word-break) : [object CSSPrimitiveValue]

Modified: trunk/Source/WebCore/ChangeLog (101786 => 101787)


--- trunk/Source/WebCore/ChangeLog	2011-12-02 12:58:24 UTC (rev 101786)
+++ trunk/Source/WebCore/ChangeLog	2011-12-02 13:32:47 UTC (rev 101787)
@@ -1,3 +1,17 @@
+2011-11-28  Alexander Pavlov  <[email protected]>
+
+        Inline non-replaced elements are reported to have zero width and height
+        https://bugs.webkit.org/show_bug.cgi?id=61117
+
+        Reviewed by Antti Koivisto.
+
+        According to http://www.w3.org/TR/CSS21/visudet.html, the "width" and "height" properties
+        do not apply for inline non-replaced elements and should have their initial value of "auto"
+        as their computed values.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+
 2011-12-02  Sami Kyostila  <[email protected]>
 
         [chromium] Make CCInputHandler scrolling stateful

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (101786 => 101787)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-12-02 12:58:24 UTC (rev 101786)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-12-02 13:32:47 UTC (rev 101787)
@@ -1524,8 +1524,13 @@
         }
 #endif
         case CSSPropertyHeight:
-            if (renderer)
+            if (renderer) {
+                // According to http://www.w3.org/TR/CSS2/visudet.html#the-height-property,
+                // the "height" property does not apply for non-replaced inline elements.
+                if (!renderer->isReplaced() && renderer->isInline())
+                    return primitiveValueCache->createIdentifierValue(CSSValueAuto);
                 return zoomAdjustedPixelValue(sizingBox(renderer).height(), style.get(), primitiveValueCache);
+            }
             return zoomAdjustedPixelValueForLength(style->height(), style.get(), primitiveValueCache);
         case CSSPropertyWebkitHighlight:
             if (style->highlight() == nullAtom)
@@ -1774,8 +1779,13 @@
         case CSSPropertyWidows:
             return primitiveValueCache->createValue(style->widows(), CSSPrimitiveValue::CSS_NUMBER);
         case CSSPropertyWidth:
-            if (renderer)
+            if (renderer) {
+                // According to http://www.w3.org/TR/CSS2/visudet.html#the-width-property,
+                // the "width" property does not apply for non-replaced inline elements.
+                if (!renderer->isReplaced() && renderer->isInline())
+                    return primitiveValueCache->createIdentifierValue(CSSValueAuto);
                 return zoomAdjustedPixelValue(sizingBox(renderer).width(), style.get(), primitiveValueCache);
+            }
             return zoomAdjustedPixelValueForLength(style->width(), style.get(), primitiveValueCache);
         case CSSPropertyWordBreak:
             return primitiveValueCache->createValue(style->wordBreak());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to