getComputedStyle for list-style is not implemented.
authoralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Jan 2012 23:20:43 +0000 (23:20 +0000)
committeralexis.menard@openbossa.org <alexis.menard@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Jan 2012 23:20:43 +0000 (23:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=75443

Reviewed by Tony Chang.

Source/WebCore:

Implement getComputedStyle for list-style.

Test: fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html

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

LayoutTests:

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

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

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

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

index ad7cb98..94b0f36 100644 (file)
@@ -1,3 +1,15 @@
+2012-01-03  Alexis Menard  <alexis.menard@openbossa.org>
+
+        getComputedStyle for list-style is not implemented.
+        https://bugs.webkit.org/show_bug.cgi?id=75443
+
+        Reviewed by Tony Chang.
+
+        Add new tests to make sure we return the correct values.
+
+        * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand-expected.txt: Added.
+        * fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html: Added.
+
 2012-01-03  Tony Chang  <tony@chromium.org>
 
         [chromium] Unreviewed, rebaseline of svg/hixie/text/003.html.  It
diff --git a/LayoutTests/fast/css/getComputedStyle/getComputedStyle-list-style-shorthand-expected.txt b/LayoutTests/fast/css/getComputedStyle/getComputedStyle-list-style-shorthand-expected.txt
new file mode 100644 (file)
index 0000000..4d8de44
--- /dev/null
@@ -0,0 +1,44 @@
+Test to make sure list-style shorthand property returns CSSValueList properly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS computedStyle.getPropertyValue('list-style') is 'circle outside url(dummy://test.png)'
+PASS computedStyle.getPropertyCSSValue('list-style').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('list-style').length is 3
+PASS computedStyle.getPropertyCSSValue('list-style').cssText is 'circle outside url(dummy://test.png)'
+PASS computedStyle.getPropertyCSSValue('list-style').item(0).getStringValue() is 'circle'
+PASS computedStyle.getPropertyCSSValue('list-style').item(1).getStringValue() is 'outside'
+PASS computedStyle.getPropertyCSSValue('list-style').item(2).getStringValue() is 'dummy://test.png'
+PASS computedStyle.getPropertyValue('list-style') is 'disc outside none'
+PASS computedStyle.getPropertyCSSValue('list-style').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('list-style').length is 3
+PASS computedStyle.getPropertyCSSValue('list-style').cssText is 'disc outside none'
+PASS computedStyle.getPropertyCSSValue('list-style').item(0).getStringValue() is 'disc'
+PASS computedStyle.getPropertyCSSValue('list-style').item(1).getStringValue() is 'outside'
+PASS computedStyle.getPropertyCSSValue('list-style').item(2).getStringValue() is 'none'
+PASS computedStyle.getPropertyValue('list-style') is 'circle outside none'
+PASS computedStyle.getPropertyCSSValue('list-style').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('list-style').length is 3
+PASS computedStyle.getPropertyCSSValue('list-style').cssText is 'circle outside none'
+PASS computedStyle.getPropertyCSSValue('list-style').item(0).getStringValue() is 'circle'
+PASS computedStyle.getPropertyCSSValue('list-style').item(1).getStringValue() is 'outside'
+PASS computedStyle.getPropertyCSSValue('list-style').item(2).getStringValue() is 'none'
+PASS computedStyle.getPropertyValue('list-style') is 'none outside none'
+PASS computedStyle.getPropertyCSSValue('list-style').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('list-style').length is 3
+PASS computedStyle.getPropertyCSSValue('list-style').cssText is 'none outside none'
+PASS computedStyle.getPropertyCSSValue('list-style').item(0).getStringValue() is 'none'
+PASS computedStyle.getPropertyCSSValue('list-style').item(1).getStringValue() is 'outside'
+PASS computedStyle.getPropertyCSSValue('list-style').item(2).getStringValue() is 'none'
+PASS computedStyle.getPropertyValue('list-style') is 'circle outside url(dummy://test.png)'
+PASS computedStyle.getPropertyCSSValue('list-style').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('list-style').length is 3
+PASS computedStyle.getPropertyCSSValue('list-style').cssText is 'circle outside url(dummy://test.png)'
+PASS computedStyle.getPropertyCSSValue('list-style').item(0).getStringValue() is 'circle'
+PASS computedStyle.getPropertyCSSValue('list-style').item(1).getStringValue() is 'outside'
+PASS computedStyle.getPropertyCSSValue('list-style').item(2).getStringValue() is 'dummy://test.png'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html b/LayoutTests/fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html
new file mode 100644 (file)
index 0000000..3adda21
--- /dev/null
@@ -0,0 +1,75 @@
+<!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 list-style shorthand property returns CSSValueList properly.")
+
+var testContainer = document.createElement("div");
+testContainer.contentEditable = true;
+document.body.appendChild(testContainer);
+
+testContainer.innerHTML = '<ul id="test"><li>Coffee</li><li>Tea</li><li>Coca Cola</li></ul>';
+
+e = document.getElementById('test');
+computedStyle = window.getComputedStyle(e, null);
+
+e.style.listStyle = "circle outside url(dummy://test.png)";
+shouldBe("computedStyle.getPropertyValue('list-style')", "'circle outside url(dummy://test.png)'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').length", "3");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').cssText", "'circle outside url(dummy://test.png)'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').item(0).getStringValue()", "'circle'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').item(1).getStringValue()", "'outside'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').item(2).getStringValue()", "'dummy://test.png'");
+
+e.style.listStyle = ""
+e.style.listStyle = "a b c";
+shouldBe("computedStyle.getPropertyValue('list-style')", "'disc outside none'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').length", "3");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').cssText", "'disc outside none'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').item(0).getStringValue()", "'disc'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').item(1).getStringValue()", "'outside'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').item(2).getStringValue()", "'none'");
+
+e.style.listStyle = "circle outside";
+shouldBe("computedStyle.getPropertyValue('list-style')", "'circle outside none'")
+shouldBe("computedStyle.getPropertyCSSValue('list-style').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').length", "3");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').cssText", "'circle outside none'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').item(0).getStringValue()", "'circle'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').item(1).getStringValue()", "'outside'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').item(2).getStringValue()", "'none'");
+
+e.style.listStyle = "none";
+shouldBe("computedStyle.getPropertyValue('list-style')", "'none outside none'")
+shouldBe("computedStyle.getPropertyCSSValue('list-style').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').length", "3");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').cssText", "'none outside none'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').item(0).getStringValue()", "'none'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').item(1).getStringValue()", "'outside'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').item(2).getStringValue()", "'none'");
+
+e.style.listStyle = "";
+e.style.listStyleType = "circle";
+e.style.listStylePosition = "outside";
+e.style.listStyleImage = "url(dummy://test.png)";
+shouldBe("computedStyle.getPropertyValue('list-style')", "'circle outside url(dummy://test.png)'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').length", "3");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').cssText", "'circle outside url(dummy://test.png)'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').item(0).getStringValue()", "'circle'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').item(1).getStringValue()", "'outside'");
+shouldBe("computedStyle.getPropertyCSSValue('list-style').item(2).getStringValue()", "'dummy://test.png'");
+
+document.body.removeChild(testContainer);
+
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
index bc5cc8c..637a498 100644 (file)
@@ -1,3 +1,17 @@
+2012-01-03  Alexis Menard  <alexis.menard@openbossa.org>
+
+        getComputedStyle for list-style is not implemented.
+        https://bugs.webkit.org/show_bug.cgi?id=75443
+
+        Reviewed by Tony Chang.
+
+        Implement getComputedStyle for list-style.
+
+        Test: fast/css/getComputedStyle/getComputedStyle-list-style-shorthand.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+
 2012-01-03  Adrienne Walker  <enne@google.com>
 
         [chromium] Remove unneeded content vs. layer space distinction in tiled layers
index b089473..52baf70 100644 (file)
@@ -2186,8 +2186,11 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
                                         CSSPropertyBorderBottomWidth, CSSPropertyBorderLeftWidth };
             return getCSSPropertyValuesForSidesShorthand(properties);
         }
-        case CSSPropertyListStyle:
-            break;
+        case CSSPropertyListStyle: {
+            const int properties[3] = { CSSPropertyListStyleType, CSSPropertyListStylePosition,
+                                        CSSPropertyListStyleImage };
+            return getCSSPropertyValuesForShorthandProperties(properties, WTF_ARRAY_LENGTH(properties));
+        }
         case CSSPropertyMargin: {
             const int properties[4] = { CSSPropertyMarginTop, CSSPropertyMarginRight,
                                         CSSPropertyMarginBottom, CSSPropertyMarginLeft };