Title: [95991] branches/chromium/835
Revision
95991
Author
jsc...@chromium.org
Date
2011-09-26 14:17:30 -0700 (Mon, 26 Sep 2011)

Log Message

Merge 95071 - Fix cssText property of counter-valued CSSPrimitiveValue and avoid uninitialized readBUG=60653
Review URL: http://codereview.chromium.org/8041039

Modified Paths

Added Paths

Diff

Copied: branches/chromium/835/LayoutTests/fast/css/counters/counter-cssText-expected.txt (from rev 95071, trunk/LayoutTests/fast/css/counters/counter-cssText-expected.txt) (0 => 95991)


--- branches/chromium/835/LayoutTests/fast/css/counters/counter-cssText-expected.txt	                        (rev 0)
+++ branches/chromium/835/LayoutTests/fast/css/counters/counter-cssText-expected.txt	2011-09-26 21:17:30 UTC (rev 95991)
@@ -0,0 +1,13 @@
+Test the cssText output of counter-valued CSSPrimitiveValues
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS rules[2].style.cssText is "content: counter(section, decimal); "
+PASS rules[3].style.cssText is "content: counters(section, ':', decimal); "
+PASS rules[4].style.cssText is "content: counter(section, lower-roman); "
+PASS rules[5].style.cssText is "content: counters(section, ',', upper-roman); "
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: branches/chromium/835/LayoutTests/fast/css/counters/counter-cssText.html (from rev 95071, trunk/LayoutTests/fast/css/counters/counter-cssText.html) (0 => 95991)


--- branches/chromium/835/LayoutTests/fast/css/counters/counter-cssText.html	                        (rev 0)
+++ branches/chromium/835/LayoutTests/fast/css/counters/counter-cssText.html	2011-09-26 21:17:30 UTC (rev 95991)
@@ -0,0 +1,39 @@
+<html>
+<head>
+<link rel=stylesheet href=""
+<script src=""
+<style>
+body {
+    counter-reset: section;
+}
+h1 {
+    counter-increment: section;
+}
+h2:before {
+    content: counter(section);
+}
+h2:after {
+    content: counters(section, ":", decimal);
+}
+h3:before {
+    content: counter(section, lower-roman);
+}
+h3:after {
+    content: counters(section, ",", upper-roman);
+}
+</style>
+</head>
+<p id=description></p>
+<div id=console></div>
+<script>
+description("Test the cssText output of counter-valued CSSPrimitiveValues");
+var rules = document.styleSheets[1].cssRules;
+shouldBeEqualToString("rules[2].style.cssText", "content: counter(section, decimal); ");
+shouldBeEqualToString("rules[3].style.cssText", "content: counters(section, ':', decimal); ");
+shouldBeEqualToString("rules[4].style.cssText", "content: counter(section, lower-roman); ");
+shouldBeEqualToString("rules[5].style.cssText", "content: counters(section, ',', upper-roman); ");
+window.successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>

Modified: branches/chromium/835/Source/WebCore/css/CSSPrimitiveValue.cpp (95990 => 95991)


--- branches/chromium/835/Source/WebCore/css/CSSPrimitiveValue.cpp	2011-09-26 21:06:44 UTC (rev 95990)
+++ branches/chromium/835/Source/WebCore/css/CSSPrimitiveValue.cpp	2011-09-26 21:17:30 UTC (rev 95991)
@@ -742,12 +742,22 @@
             text += m_value.string;
             text += ")";
             break;
-        case CSS_COUNTER:
-            text = "counter(";
-            text += String::number(m_value.num);
+        case CSS_COUNTER: {
+            String separator = m_value.counter->separator();
+            text = separator.isEmpty() ? "counter(" : "counters(";
+            text += m_value.counter->identifier();
+            if (!separator.isEmpty()) {
+                text += ", ";
+                text += quoteCSSStringIfNeeded(separator);
+            }
+            const char* listStyleName = getValueName(m_value.counter->listStyleNumber() + CSSValueDisc);
+            if (listStyleName) {
+                text += ", ";
+                text += listStyleName;
+            }
             text += ")";
-            // FIXME: Add list-style and separator
             break;
+        }
         case CSS_RECT: {
             DEFINE_STATIC_LOCAL(const String, rectParen, ("rect("));
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to