Title: [104169] trunk
Revision
104169
Author
[email protected]
Date
2012-01-05 09:29:54 -0800 (Thu, 05 Jan 2012)

Log Message

getComputedStyle for background is not implemented.
https://bugs.webkit.org/show_bug.cgi?id=75539

Reviewed by Tony Chang.

Source/WebCore: 

Implement getComputedStyle for background.

Test: fast/css/getComputedStyle/getComputedStyle-background-shorthand.html

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

LayoutTests: 

Add new tests to make sure we return the correct values.

* fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt: Added.
* fast/css/getComputedStyle/getComputedStyle-background-shorthand.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (104168 => 104169)


--- trunk/LayoutTests/ChangeLog	2012-01-05 17:02:21 UTC (rev 104168)
+++ trunk/LayoutTests/ChangeLog	2012-01-05 17:29:54 UTC (rev 104169)
@@ -1,3 +1,15 @@
+2012-01-05  Alexis Menard  <[email protected]>
+
+        getComputedStyle for background is not implemented.
+        https://bugs.webkit.org/show_bug.cgi?id=75539
+
+        Reviewed by Tony Chang.
+
+        Add new tests to make sure we return the correct values.
+
+        * fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt: Added.
+        * fast/css/getComputedStyle/getComputedStyle-background-shorthand.html: Added.
+
 2012-01-05  Philippe Normand  <[email protected]>
 
         Unreviewed, GTK test_expectations update.

Added: trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt (0 => 104169)


--- trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-background-shorthand-expected.txt	2012-01-05 17:29:54 UTC (rev 104169)
@@ -0,0 +1,93 @@
+Test to make sure background shorthand properties returns CSSValueList properly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS computedStyle.getPropertyValue('background') is 'rgb(255, 0, 0) none repeat scroll 0% 0%'
+PASS computedStyle.getPropertyCSSValue('background').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('background').cssText is 'rgb(255, 0, 0) none repeat scroll 0% 0%'
+PASS computedStyle.getPropertyCSSValue('background').length is 5
+PASS computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
+PASS computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('background').item(1).getStringValue() is 'none'
+PASS computedStyle.getPropertyCSSValue('background').item(2).getStringValue() is 'repeat'
+PASS computedStyle.getPropertyCSSValue('background').item(3).getStringValue() is 'scroll'
+PASS computedStyle.getPropertyCSSValue('background').item(4).toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('background').item(4).item(0).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE) is 0
+PASS computedStyle.getPropertyCSSValue('background').item(4).item(1).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE) is 0
+PASS checkComputedStyleValue() is true
+PASS computedStyle.getPropertyValue('background') is 'rgb(255, 0, 0) url(dummy://test.png) repeat scroll 0% 0%'
+PASS computedStyle.getPropertyCSSValue('background').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('background').cssText is 'rgb(255, 0, 0) url(dummy://test.png) repeat scroll 0% 0%'
+PASS computedStyle.getPropertyCSSValue('background').length is 5
+PASS computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
+PASS computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('background').item(1).getStringValue() is 'dummy://test.png'
+PASS computedStyle.getPropertyCSSValue('background').item(2).getStringValue() is 'repeat'
+PASS computedStyle.getPropertyCSSValue('background').item(3).getStringValue() is 'scroll'
+PASS computedStyle.getPropertyCSSValue('background').item(4).toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('background').item(4).item(0).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE) is 0
+PASS computedStyle.getPropertyCSSValue('background').item(4).item(1).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE) is 0
+PASS checkComputedStyleValue() is true
+PASS computedStyle.getPropertyValue('background') is 'rgb(255, 0, 0) url(dummy://test.png) no-repeat scroll 0% 0%'
+PASS computedStyle.getPropertyCSSValue('background').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('background').cssText is 'rgb(255, 0, 0) url(dummy://test.png) no-repeat scroll 0% 0%'
+PASS computedStyle.getPropertyCSSValue('background').length is 5
+PASS computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
+PASS computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('background').item(1).getStringValue() is 'dummy://test.png'
+PASS computedStyle.getPropertyCSSValue('background').item(2).getStringValue() is 'no-repeat'
+PASS computedStyle.getPropertyCSSValue('background').item(3).getStringValue() is 'scroll'
+PASS computedStyle.getPropertyCSSValue('background').item(4).toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('background').item(4).item(0).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE) is 0
+PASS computedStyle.getPropertyCSSValue('background').item(4).item(1).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE) is 0
+PASS checkComputedStyleValue() is true
+PASS computedStyle.getPropertyValue('background') is 'rgb(255, 0, 0) url(dummy://test.png) no-repeat fixed 0% 0%'
+PASS computedStyle.getPropertyCSSValue('background').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('background').cssText is 'rgb(255, 0, 0) url(dummy://test.png) no-repeat fixed 0% 0%'
+PASS computedStyle.getPropertyCSSValue('background').length is 5
+PASS computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
+PASS computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('background').item(1).getStringValue() is 'dummy://test.png'
+PASS computedStyle.getPropertyCSSValue('background').item(2).getStringValue() is 'no-repeat'
+PASS computedStyle.getPropertyCSSValue('background').item(3).getStringValue() is 'fixed'
+PASS computedStyle.getPropertyCSSValue('background').item(4).toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('background').item(4).item(0).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE) is 0
+PASS computedStyle.getPropertyCSSValue('background').item(4).item(1).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE) is 0
+PASS checkComputedStyleValue() is true
+PASS computedStyle.getPropertyValue('background') is 'rgb(255, 0, 0) url(dummy://test.png) no-repeat fixed 100% 100%'
+PASS computedStyle.getPropertyCSSValue('background').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('background').cssText is 'rgb(255, 0, 0) url(dummy://test.png) no-repeat fixed 100% 100%'
+PASS computedStyle.getPropertyCSSValue('background').length is 5
+PASS computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
+PASS computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('background').item(1).getStringValue() is 'dummy://test.png'
+PASS computedStyle.getPropertyCSSValue('background').item(2).getStringValue() is 'no-repeat'
+PASS computedStyle.getPropertyCSSValue('background').item(3).getStringValue() is 'fixed'
+PASS computedStyle.getPropertyCSSValue('background').item(4).toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('background').item(4).item(0).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE) is 100
+PASS computedStyle.getPropertyCSSValue('background').item(4).item(1).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE) is 100
+PASS checkComputedStyleValue() is true
+PASS computedStyle.getPropertyValue('background') is 'rgb(0, 128, 0) url(dummy://test.png) repeat fixed 45% 50%'
+PASS computedStyle.getPropertyCSSValue('background').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('background').cssText is 'rgb(0, 128, 0) url(dummy://test.png) repeat fixed 45% 50%'
+PASS computedStyle.getPropertyCSSValue('background').length is 5
+PASS computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 128
+PASS computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('background').item(1).getStringValue() is 'dummy://test.png'
+PASS computedStyle.getPropertyCSSValue('background').item(2).getStringValue() is 'repeat'
+PASS computedStyle.getPropertyCSSValue('background').item(3).getStringValue() is 'fixed'
+PASS computedStyle.getPropertyCSSValue('background').item(4).toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('background').item(4).item(0).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE) is 45
+PASS computedStyle.getPropertyCSSValue('background').item(4).item(1).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE) is 50
+PASS checkComputedStyleValue() is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-background-shorthand.html (0 => 104169)


--- trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-background-shorthand.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-background-shorthand.html	2012-01-05 17:29:54 UTC (rev 104169)
@@ -0,0 +1,129 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+</head>
+<body>
+<script>
+
+description("Test to make sure background shorthand properties returns CSSValueList properly.")
+
+var testContainer = document.createElement("div");
+testContainer.contentEditable = true;
+document.body.appendChild(testContainer);
+
+testContainer.innerHTML = '<div id="test">hello</div>';
+
+e = document.getElementById('test');
+computedStyle = window.getComputedStyle(e, null);
+
+function checkComputedStyleValue() {
+    var before = window.getComputedStyle(e, null).getPropertyValue('background');
+    e.style.background = '';
+    e.style.background = ""
+    return (window.getComputedStyle(e, null).getPropertyValue('background') == before);
+}
+
+e.style.background = ""
+shouldBe("computedStyle.getPropertyValue('background')", "'rgb(255, 0, 0) none repeat scroll 0% 0%'");
+shouldBe("computedStyle.getPropertyCSSValue('background').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('background').cssText", "'rgb(255, 0, 0) none repeat scroll 0% 0%'");
+shouldBe("computedStyle.getPropertyCSSValue('background').length", "5");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "255");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(1).getStringValue()", "'none'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(2).getStringValue()", "'repeat'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(3).getStringValue()", "'scroll'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(4).toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(4).item(0).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(4).item(1).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE)", "0");
+shouldBe("checkComputedStyleValue()", "true");
+
+e.style.backgroundImage = "url(dummy://test.png)";
+shouldBe("computedStyle.getPropertyValue('background')", "'rgb(255, 0, 0) url(dummy://test.png) repeat scroll 0% 0%'");
+shouldBe("computedStyle.getPropertyCSSValue('background').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('background').cssText", "'rgb(255, 0, 0) url(dummy://test.png) repeat scroll 0% 0%'");
+shouldBe("computedStyle.getPropertyCSSValue('background').length", "5");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "255");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(1).getStringValue()", "'dummy://test.png'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(2).getStringValue()", "'repeat'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(3).getStringValue()", "'scroll'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(4).toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(4).item(0).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(4).item(1).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE)", "0");
+shouldBe("checkComputedStyleValue()", "true");
+
+e.style.backgroundRepeat = "no-repeat";
+shouldBe("computedStyle.getPropertyValue('background')", "'rgb(255, 0, 0) url(dummy://test.png) no-repeat scroll 0% 0%'");
+shouldBe("computedStyle.getPropertyCSSValue('background').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('background').cssText", "'rgb(255, 0, 0) url(dummy://test.png) no-repeat scroll 0% 0%'");
+shouldBe("computedStyle.getPropertyCSSValue('background').length", "5");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "255");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(1).getStringValue()", "'dummy://test.png'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(2).getStringValue()", "'no-repeat'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(3).getStringValue()", "'scroll'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(4).toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(4).item(0).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(4).item(1).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE)", "0");
+shouldBe("checkComputedStyleValue()", "true");
+
+e.style.backgroundAttachment = "fixed";
+shouldBe("computedStyle.getPropertyValue('background')", "'rgb(255, 0, 0) url(dummy://test.png) no-repeat fixed 0% 0%'");
+shouldBe("computedStyle.getPropertyCSSValue('background').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('background').cssText", "'rgb(255, 0, 0) url(dummy://test.png) no-repeat fixed 0% 0%'");
+shouldBe("computedStyle.getPropertyCSSValue('background').length", "5");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "255");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(1).getStringValue()", "'dummy://test.png'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(2).getStringValue()", "'no-repeat'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(3).getStringValue()", "'fixed'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(4).toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(4).item(0).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(4).item(1).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE)", "0");
+shouldBe("checkComputedStyleValue()", "true");
+
+e.style.backgroundPosition = "right bottom";
+shouldBe("computedStyle.getPropertyValue('background')", "'rgb(255, 0, 0) url(dummy://test.png) no-repeat fixed 100% 100%'");
+shouldBe("computedStyle.getPropertyCSSValue('background').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('background').cssText", "'rgb(255, 0, 0) url(dummy://test.png) no-repeat fixed 100% 100%'");
+shouldBe("computedStyle.getPropertyCSSValue('background').length", "5");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "255");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(1).getStringValue()", "'dummy://test.png'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(2).getStringValue()", "'no-repeat'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(3).getStringValue()", "'fixed'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(4).toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(4).item(0).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE)", "100");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(4).item(1).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE)", "100");
+shouldBe("checkComputedStyleValue()", "true");
+
+e.style.background = "" green 45% repeat fixed";
+shouldBe("computedStyle.getPropertyValue('background')", "'rgb(0, 128, 0) url(dummy://test.png) repeat fixed 45% 50%'");
+shouldBe("computedStyle.getPropertyCSSValue('background').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('background').cssText", "'rgb(0, 128, 0) url(dummy://test.png) repeat fixed 45% 50%'");
+shouldBe("computedStyle.getPropertyCSSValue('background').length", "5");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "128");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(0).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(1).getStringValue()", "'dummy://test.png'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(2).getStringValue()", "'repeat'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(3).getStringValue()", "'fixed'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(4).toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(4).item(0).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE)", "45");
+shouldBe("computedStyle.getPropertyCSSValue('background').item(4).item(1).getFloatValue(CSSPrimitiveValue.CSS_PERCENTAGE)", "50");
+shouldBe("checkComputedStyleValue()", "true");
+
+document.body.removeChild(testContainer);
+
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (104168 => 104169)


--- trunk/Source/WebCore/ChangeLog	2012-01-05 17:02:21 UTC (rev 104168)
+++ trunk/Source/WebCore/ChangeLog	2012-01-05 17:29:54 UTC (rev 104169)
@@ -1,3 +1,17 @@
+2012-01-05  Alexis Menard  <[email protected]>
+
+        getComputedStyle for background is not implemented.
+        https://bugs.webkit.org/show_bug.cgi?id=75539
+
+        Reviewed by Tony Chang.
+
+        Implement getComputedStyle for background.
+
+        Test: fast/css/getComputedStyle/getComputedStyle-background-shorthand.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+
 2012-01-05  Ryosuke Niwa  <[email protected]>
 
         DOM Attribute tests on Dromaeo spends 2.7% of time in hasSelectorForAttribute

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (104168 => 104169)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2012-01-05 17:02:21 UTC (rev 104168)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2012-01-05 17:29:54 UTC (rev 104169)
@@ -2136,8 +2136,12 @@
             return valueForFilter(style.get());
 #endif
         /* Shorthand properties, currently not supported see bug 13658*/
-        case CSSPropertyBackground:
-            break;
+        case CSSPropertyBackground: {
+            const int properties[5] = { CSSPropertyBackgroundColor, CSSPropertyBackgroundImage,
+                                        CSSPropertyBackgroundRepeat, CSSPropertyBackgroundAttachment,
+                                        CSSPropertyBackgroundPosition };
+            return getCSSPropertyValuesForShorthandProperties(properties, WTF_ARRAY_LENGTH(properties));
+        }
         case CSSPropertyBorder: {
             RefPtr<CSSValue> value = getPropertyCSSValue(CSSPropertyBorderTop, DoNotUpdateLayout);
             const int properties[3] = { CSSPropertyBorderRight, CSSPropertyBorderBottom,
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to