getComputedStyle for outline is not implemented.
authoralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Jan 2012 12:39:01 +0000 (12:39 +0000)
committeralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Jan 2012 12:39:01 +0000 (12:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=75441

Reviewed by Antonio Gomes.

Source/WebCore:

Implement getComputedStyle for outline.

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

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

LayoutTests:

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

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

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@103934 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/css/getComputedStyle/getComputedStyle-outline-shorthand-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/getComputedStyle/getComputedStyle-outline-shorthand.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp

index 6ac4da8..5323c6a 100644 (file)
@@ -1,3 +1,15 @@
+2012-01-03  Alexis Menard  <alexis.menard@openbossa.org>
+
+        getComputedStyle for outline is not implemented.
+        https://bugs.webkit.org/show_bug.cgi?id=75441
+
+        Reviewed by Antonio Gomes.
+
+        Add new tests to make sure we return the correct values.
+
+        * fast/css/getComputedStyle/getComputedStyle-outline-shorthand-expected.txt: Added.
+        * fast/css/getComputedStyle/getComputedStyle-outline-shorthand.html: Added.
+
 2012-01-03  Alpha Lam  <hclam@chromium.org>
 
         https://bugs.webkit.org/show_bug.cgi?id=75468
diff --git a/LayoutTests/fast/css/getComputedStyle/getComputedStyle-outline-shorthand-expected.txt b/LayoutTests/fast/css/getComputedStyle/getComputedStyle-outline-shorthand-expected.txt
new file mode 100644 (file)
index 0000000..a589d59
--- /dev/null
@@ -0,0 +1,36 @@
+Test to make sure outline shorthand property returns CSSValueList properly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS computedStyle.getPropertyValue('outline') is 'rgb(255, 0, 0) solid 5px'
+PASS computedStyle.getPropertyCSSValue('outline').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('outline').length is 3
+PASS computedStyle.getPropertyCSSValue('outline').cssText is 'rgb(255, 0, 0) solid 5px'
+PASS computedStyle.getPropertyCSSValue('outline').item(0).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
+PASS computedStyle.getPropertyCSSValue('outline').item(0).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('outline').item(0).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('outline').item(1).getStringValue() is 'solid'
+PASS computedStyle.getPropertyCSSValue('outline').item(2).getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 5
+PASS computedStyle.getPropertyValue('outline') is 'rgb(0, 0, 0) solid 32px'
+PASS computedStyle.getPropertyCSSValue('outline').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('outline').length is 3
+PASS computedStyle.getPropertyCSSValue('outline').cssText is 'rgb(0, 0, 0) solid 32px'
+PASS computedStyle.getPropertyCSSValue('outline').item(0).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('outline').item(0).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('outline').item(0).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('outline').item(1).getStringValue() is 'solid'
+PASS computedStyle.getPropertyCSSValue('outline').item(2).getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 32
+PASS computedStyle.getPropertyValue('outline') is 'rgb(255, 0, 0) none 0px'
+PASS computedStyle.getPropertyCSSValue('outline').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('outline').length is 3
+PASS computedStyle.getPropertyCSSValue('outline').cssText is 'rgb(255, 0, 0) none 0px'
+PASS computedStyle.getPropertyCSSValue('outline').item(0).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
+PASS computedStyle.getPropertyCSSValue('outline').item(0).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('outline').item(0).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('outline').item(1).getStringValue() is 'none'
+PASS computedStyle.getPropertyCSSValue('outline').item(2).getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/css/getComputedStyle/getComputedStyle-outline-shorthand.html b/LayoutTests/fast/css/getComputedStyle/getComputedStyle-outline-shorthand.html
new file mode 100644 (file)
index 0000000..7779555
--- /dev/null
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description("Test to make sure outline shorthand property returns CSSValueList properly.")
+
+var testContainer = document.createElement("div");
+testContainer.contentEditable = true;
+document.body.appendChild(testContainer);
+
+testContainer.innerHTML = '<div style="width:100px;height:100px"><div id="test">hello</div></div>';
+
+e = document.getElementById('test');
+computedStyle = window.getComputedStyle(e, null);
+
+e.style.outline = "thick solid red";
+shouldBe("computedStyle.getPropertyValue('outline')", "'rgb(255, 0, 0) solid 5px'");
+shouldBe("computedStyle.getPropertyCSSValue('outline').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('outline').length", "3");
+shouldBe("computedStyle.getPropertyCSSValue('outline').cssText", "'rgb(255, 0, 0) solid 5px'");
+shouldBe("computedStyle.getPropertyCSSValue('outline').item(0).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "255");
+shouldBe("computedStyle.getPropertyCSSValue('outline').item(0).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('outline').item(0).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('outline').item(1).getStringValue()", "'solid'");
+shouldBe("computedStyle.getPropertyCSSValue('outline').item(2).getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "5");
+
+e.style.outline = "2em solid";
+shouldBe("computedStyle.getPropertyValue('outline')", "'rgb(0, 0, 0) solid 32px'");
+shouldBe("computedStyle.getPropertyCSSValue('outline').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('outline').length", "3");
+shouldBe("computedStyle.getPropertyCSSValue('outline').cssText", "'rgb(0, 0, 0) solid 32px'");
+shouldBe("computedStyle.getPropertyCSSValue('outline').item(0).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('outline').item(0).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('outline').item(0).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('outline').item(1).getStringValue()", "'solid'");
+shouldBe("computedStyle.getPropertyCSSValue('outline').item(2).getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "32");
+
+e.style.outline = "4px none red";
+shouldBe("computedStyle.getPropertyValue('outline')", "'rgb(255, 0, 0) none 0px'");
+shouldBe("computedStyle.getPropertyCSSValue('outline').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('outline').length", "3");
+shouldBe("computedStyle.getPropertyCSSValue('outline').cssText", "'rgb(255, 0, 0) none 0px'");
+shouldBe("computedStyle.getPropertyCSSValue('outline').item(0).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "255");
+shouldBe("computedStyle.getPropertyCSSValue('outline').item(0).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('outline').item(0).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('outline').item(1).getStringValue()", "'none'");
+shouldBe("computedStyle.getPropertyCSSValue('outline').item(2).getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+
+document.body.removeChild(testContainer);
+
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
index c98017f..9d19e28 100644 (file)
@@ -1,3 +1,17 @@
+2012-01-03  Alexis Menard  <alexis.menard@openbossa.org>
+
+        getComputedStyle for outline is not implemented.
+        https://bugs.webkit.org/show_bug.cgi?id=75441
+
+        Reviewed by Antonio Gomes.
+
+        Implement getComputedStyle for outline.
+
+        Test: fast/css/getComputedStyle/getComputedStyle-outline-shorthand.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+
 2012-01-03  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Use gdk_screen_get_monitor_workarea() when available for screenAvailableRect()
index 0d1c656..5e5d28c 100644 (file)
@@ -2184,8 +2184,11 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
                                         CSSPropertyMarginBottom, CSSPropertyMarginLeft };
             return getCSSPropertyValuesForShorthandProperties(properties, WTF_ARRAY_LENGTH(properties));
         }
-        case CSSPropertyOutline:
-            break;
+        case CSSPropertyOutline: {
+            const int properties[3] = { CSSPropertyOutlineColor, CSSPropertyOutlineStyle,
+                                        CSSPropertyOutlineWidth };
+            return getCSSPropertyValuesForShorthandProperties(properties, WTF_ARRAY_LENGTH(properties));
+        }
         case CSSPropertyPadding: {
             const int properties[4] = { CSSPropertyPaddingTop, CSSPropertyPaddingRight,
                                         CSSPropertyPaddingBottom, CSSPropertyPaddingLeft };