Remove NS_STYLE_LIST_STYLE_OLD_* constants to fix computed list-style-type style resulting from type attribute on lists. (Bug 665857) r=bzbarsky
authorL. David Baron <dbaron@dbaron.org>
Wed, 29 Jun 2011 14:39:21 -0700
changeset 72019 e74c4c9f1c1c60ac4ee9efd2504eb638958f02b9
parent 72018 32b2002252dcc4d40d2cbc9e1c01ddd3b6fbd53c
child 72020 927e4e8b3926ccf1b6caf7dbbea589fd83064076
push id319
push userdbaron@mozilla.com
push dateWed, 29 Jun 2011 21:42:35 +0000
treeherdermozilla-inbound@e74c4c9f1c1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs665857
milestone7.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Remove NS_STYLE_LIST_STYLE_OLD_* constants to fix computed list-style-type style resulting from type attribute on lists. (Bug 665857) r=bzbarsky
content/html/content/src/nsHTMLLIElement.cpp
content/html/content/src/nsHTMLOListElement.cpp
layout/base/nsStyleConsts.h
layout/generic/nsBulletFrame.cpp
layout/style/test/Makefile.in
layout/style/test/test_html_attribute_computed_values.html
--- a/content/html/content/src/nsHTMLLIElement.cpp
+++ b/content/html/content/src/nsHTMLLIElement.cpp
@@ -103,30 +103,31 @@ NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLA
 
 
 NS_IMPL_ELEMENT_CLONE(nsHTMLLIElement)
 
 
 NS_IMPL_STRING_ATTR(nsHTMLLIElement, Type, type)
 NS_IMPL_INT_ATTR(nsHTMLLIElement, Value, value)
 
-
+// values that are handled case-insensitively
 static const nsAttrValue::EnumTable kUnorderedListItemTypeTable[] = {
   { "disc", NS_STYLE_LIST_STYLE_DISC },
   { "circle", NS_STYLE_LIST_STYLE_CIRCLE },
   { "round", NS_STYLE_LIST_STYLE_CIRCLE },
   { "square", NS_STYLE_LIST_STYLE_SQUARE },
   { 0 }
 };
 
+// values that are handled case-sensitively
 static const nsAttrValue::EnumTable kOrderedListItemTypeTable[] = {
-  { "A", NS_STYLE_LIST_STYLE_OLD_UPPER_ALPHA },
-  { "a", NS_STYLE_LIST_STYLE_OLD_LOWER_ALPHA },
-  { "I", NS_STYLE_LIST_STYLE_OLD_UPPER_ROMAN },
-  { "i", NS_STYLE_LIST_STYLE_OLD_LOWER_ROMAN },
+  { "A", NS_STYLE_LIST_STYLE_UPPER_ALPHA },
+  { "a", NS_STYLE_LIST_STYLE_LOWER_ALPHA },
+  { "I", NS_STYLE_LIST_STYLE_UPPER_ROMAN },
+  { "i", NS_STYLE_LIST_STYLE_LOWER_ROMAN },
   { "1", NS_STYLE_LIST_STYLE_DECIMAL },
   { 0 }
 };
 
 PRBool
 nsHTMLLIElement::ParseAttribute(PRInt32 aNamespaceID,
                                 nsIAtom* aAttribute,
                                 const nsAString& aValue,
--- a/content/html/content/src/nsHTMLOListElement.cpp
+++ b/content/html/content/src/nsHTMLOListElement.cpp
@@ -143,37 +143,37 @@ NS_HTML_CONTENT_INTERFACE_MAP_END
 
 NS_IMPL_ELEMENT_CLONE(nsHTMLSharedListElement)
 
 
 NS_IMPL_BOOL_ATTR(nsHTMLSharedListElement, Compact, compact)
 NS_IMPL_INT_ATTR_DEFAULT_VALUE(nsHTMLSharedListElement, Start, start, 1)
 NS_IMPL_STRING_ATTR(nsHTMLSharedListElement, Type, type)
 
-
+// Shared with nsHTMLSharedElement.cpp
 nsAttrValue::EnumTable kListTypeTable[] = {
   { "none", NS_STYLE_LIST_STYLE_NONE },
   { "disc", NS_STYLE_LIST_STYLE_DISC },
   { "circle", NS_STYLE_LIST_STYLE_CIRCLE },
   { "round", NS_STYLE_LIST_STYLE_CIRCLE },
   { "square", NS_STYLE_LIST_STYLE_SQUARE },
   { "decimal", NS_STYLE_LIST_STYLE_DECIMAL },
   { "lower-roman", NS_STYLE_LIST_STYLE_LOWER_ROMAN },
   { "upper-roman", NS_STYLE_LIST_STYLE_UPPER_ROMAN },
   { "lower-alpha", NS_STYLE_LIST_STYLE_LOWER_ALPHA },
   { "upper-alpha", NS_STYLE_LIST_STYLE_UPPER_ALPHA },
   { 0 }
 };
 
-nsAttrValue::EnumTable kOldListTypeTable[] = {
-  { "1", NS_STYLE_LIST_STYLE_OLD_DECIMAL },
-  { "A", NS_STYLE_LIST_STYLE_OLD_UPPER_ALPHA },
-  { "a", NS_STYLE_LIST_STYLE_OLD_LOWER_ALPHA },
-  { "I", NS_STYLE_LIST_STYLE_OLD_UPPER_ROMAN },
-  { "i", NS_STYLE_LIST_STYLE_OLD_LOWER_ROMAN },
+static const nsAttrValue::EnumTable kOldListTypeTable[] = {
+  { "1", NS_STYLE_LIST_STYLE_DECIMAL },
+  { "A", NS_STYLE_LIST_STYLE_UPPER_ALPHA },
+  { "a", NS_STYLE_LIST_STYLE_LOWER_ALPHA },
+  { "I", NS_STYLE_LIST_STYLE_UPPER_ROMAN },
+  { "i", NS_STYLE_LIST_STYLE_LOWER_ROMAN },
   { 0 }
 };
 
 PRBool
 nsHTMLSharedListElement::ParseAttribute(PRInt32 aNamespaceID,
                                         nsIAtom* aAttribute,
                                         const nsAString& aValue,
                                         nsAttrValue& aResult)
--- a/layout/base/nsStyleConsts.h
+++ b/layout/base/nsStyleConsts.h
@@ -552,21 +552,16 @@ static inline mozilla::css::Side operato
 #define NS_STYLE_LIST_STYLE_HEBREW                11
 #define NS_STYLE_LIST_STYLE_ARMENIAN              12
 #define NS_STYLE_LIST_STYLE_GEORGIAN              13
 #define NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC       14
 #define NS_STYLE_LIST_STYLE_HIRAGANA              15
 #define NS_STYLE_LIST_STYLE_KATAKANA              16
 #define NS_STYLE_LIST_STYLE_HIRAGANA_IROHA        17
 #define NS_STYLE_LIST_STYLE_KATAKANA_IROHA        18
-#define NS_STYLE_LIST_STYLE_OLD_LOWER_ROMAN       19
-#define NS_STYLE_LIST_STYLE_OLD_UPPER_ROMAN       20
-#define NS_STYLE_LIST_STYLE_OLD_LOWER_ALPHA       21
-#define NS_STYLE_LIST_STYLE_OLD_UPPER_ALPHA       22
-#define NS_STYLE_LIST_STYLE_OLD_DECIMAL           23
 #define NS_STYLE_LIST_STYLE_MOZ_CJK_HEAVENLY_STEM     24
 #define NS_STYLE_LIST_STYLE_MOZ_CJK_EARTHLY_BRANCH    25
 #define NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_INFORMAL 26
 #define NS_STYLE_LIST_STYLE_MOZ_TRAD_CHINESE_FORMAL   27
 #define NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_INFORMAL 28
 #define NS_STYLE_LIST_STYLE_MOZ_SIMP_CHINESE_FORMAL   29
 #define NS_STYLE_LIST_STYLE_MOZ_JAPANESE_INFORMAL     30
 #define NS_STYLE_LIST_STYLE_MOZ_JAPANESE_FORMAL       31
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -330,26 +330,21 @@ nsBulletFrame::PaintBullet(nsRenderingCo
       snapRect.MoveBy((rect.width - snapRect.width) / 2,
                       (rect.height - snapRect.height) / 2);
       aRenderingContext.FillRect(snapRect.x, snapRect.y,
                                  snapRect.width, snapRect.height);
     }
     break;
 
   case NS_STYLE_LIST_STYLE_DECIMAL:
-  case NS_STYLE_LIST_STYLE_OLD_DECIMAL:
   case NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO:
   case NS_STYLE_LIST_STYLE_LOWER_ROMAN:
   case NS_STYLE_LIST_STYLE_UPPER_ROMAN:
   case NS_STYLE_LIST_STYLE_LOWER_ALPHA:
   case NS_STYLE_LIST_STYLE_UPPER_ALPHA:
-  case NS_STYLE_LIST_STYLE_OLD_LOWER_ROMAN:
-  case NS_STYLE_LIST_STYLE_OLD_UPPER_ROMAN:
-  case NS_STYLE_LIST_STYLE_OLD_LOWER_ALPHA:
-  case NS_STYLE_LIST_STYLE_OLD_UPPER_ALPHA:
   case NS_STYLE_LIST_STYLE_LOWER_GREEK:
   case NS_STYLE_LIST_STYLE_HEBREW:
   case NS_STYLE_LIST_STYLE_ARMENIAN:
   case NS_STYLE_LIST_STYLE_GEORGIAN:
   case NS_STYLE_LIST_STYLE_CJK_IDEOGRAPHIC:
   case NS_STYLE_LIST_STYLE_HIRAGANA:
   case NS_STYLE_LIST_STYLE_KATAKANA:
   case NS_STYLE_LIST_STYLE_HIRAGANA_IROHA:
@@ -1057,44 +1052,39 @@ nsBulletFrame::AppendCounterText(PRInt32
       break;
 
     case NS_STYLE_LIST_STYLE_SQUARE: // used by counters code only
       // XXX We really need to do this the same way we do list bullets.
       result.Append(PRUnichar(0x25FE));
       break;
 
     case NS_STYLE_LIST_STYLE_DECIMAL:
-    case NS_STYLE_LIST_STYLE_OLD_DECIMAL:
     default: // CSS2 say "A users  agent that does not recognize a numbering system
       // should use 'decimal'
       success = DecimalToText(aOrdinal, result);
       break;
 
     case NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO:
       success = DecimalLeadingZeroToText(aOrdinal, result);
       break;
 
     case NS_STYLE_LIST_STYLE_LOWER_ROMAN:
-    case NS_STYLE_LIST_STYLE_OLD_LOWER_ROMAN:
       success = RomanToText(aOrdinal, result,
                             gLowerRomanCharsA, gLowerRomanCharsB);
       break;
     case NS_STYLE_LIST_STYLE_UPPER_ROMAN:
-    case NS_STYLE_LIST_STYLE_OLD_UPPER_ROMAN:
       success = RomanToText(aOrdinal, result,
                             gUpperRomanCharsA, gUpperRomanCharsB);
       break;
 
     case NS_STYLE_LIST_STYLE_LOWER_ALPHA:
-    case NS_STYLE_LIST_STYLE_OLD_LOWER_ALPHA:
       success = CharListToText(aOrdinal, result, gLowerAlphaChars, ALPHA_SIZE);
       break;
 
     case NS_STYLE_LIST_STYLE_UPPER_ALPHA:
-    case NS_STYLE_LIST_STYLE_OLD_UPPER_ALPHA:
       success = CharListToText(aOrdinal, result, gUpperAlphaChars, ALPHA_SIZE);
       break;
 
     case NS_STYLE_LIST_STYLE_KATAKANA:
       success = CharListToText(aOrdinal, result, gKatakanaChars,
                                KATAKANA_CHARS_SIZE);
       break;
 
@@ -1366,25 +1356,20 @@ nsBulletFrame::GetDesiredSize(nsPresCont
       mPadding.bottom = NSToCoordRound(float(ascent) / 8.0f);
       aMetrics.width = mPadding.right + bulletSize;
       aMetrics.ascent = aMetrics.height = mPadding.bottom + bulletSize;
       break;
 
     default:
     case NS_STYLE_LIST_STYLE_DECIMAL_LEADING_ZERO:
     case NS_STYLE_LIST_STYLE_DECIMAL:
-    case NS_STYLE_LIST_STYLE_OLD_DECIMAL:
     case NS_STYLE_LIST_STYLE_LOWER_ROMAN:
     case NS_STYLE_LIST_STYLE_UPPER_ROMAN:
     case NS_STYLE_LIST_STYLE_LOWER_ALPHA:
     case NS_STYLE_LIST_STYLE_UPPER_ALPHA:
-    case NS_STYLE_LIST_STYLE_OLD_LOWER_ROMAN:
-    case NS_STYLE_LIST_STYLE_OLD_UPPER_ROMAN:
-    case NS_STYLE_LIST_STYLE_OLD_LOWER_ALPHA:
-    case NS_STYLE_LIST_STYLE_OLD_UPPER_ALPHA:
     case NS_STYLE_LIST_STYLE_KATAKANA:
     case NS_STYLE_LIST_STYLE_HIRAGANA:
     case NS_STYLE_LIST_STYLE_KATAKANA_IROHA:
     case NS_STYLE_LIST_STYLE_HIRAGANA_IROHA:
     case NS_STYLE_LIST_STYLE_LOWER_GREEK:
     case NS_STYLE_LIST_STYLE_HEBREW: 
     case NS_STYLE_LIST_STYLE_ARMENIAN: 
     case NS_STYLE_LIST_STYLE_GEORGIAN: 
--- a/layout/style/test/Makefile.in
+++ b/layout/style/test/Makefile.in
@@ -134,16 +134,17 @@ GARBAGE += css_properties.js
 		test_computed_style_no_pseudo.html \
 		test_css_cross_domain.html \
 		test_css_eof_handling.html \
 		test_descriptor_storage.html \
 		test_descriptor_syntax_errors.html \
 		test_dont_use_document_colors.html \
 		test_font_face_parser.html \
 		test_garbage_at_end_of_declarations.html \
+		test_html_attribute_computed_values.html \
 		test_ident_escaping.html \
 		test_inherit_computation.html \
 		test_inherit_storage.html \
 		test_initial_computation.html \
 		test_initial_storage.html \
 		test_keyframes_rules.html \
 		test_media_queries.html \
 		test_media_queries_dynamic.html \
new file mode 100644
--- /dev/null
+++ b/layout/style/test/test_html_attribute_computed_values.html
@@ -0,0 +1,85 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=
+-->
+<head>
+  <title>Test for Bug </title>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a>
+<div id="content"></div>
+<pre id="test">
+<script type="application/javascript">
+
+
+var gValues = [
+  {
+     element: "<li type='i'></li>",
+     property: "list-style-type",
+     value: "lower-roman"
+  },
+  {
+     element: "<li type='I'></li>",
+     property: "list-style-type",
+     value: "upper-roman"
+  },
+  {
+     element: "<li type='a'></li>",
+     property: "list-style-type",
+     value: "lower-alpha"
+  },
+  {
+     element: "<li type='A'></li>",
+     property: "list-style-type",
+     value: "upper-alpha"
+  },
+  {
+     element: "<li type='1'></li>",
+     property: "list-style-type",
+     value: "decimal"
+  },
+  {
+     element: "<ol type='i'></ol>",
+     property: "list-style-type",
+     value: "lower-roman"
+  },
+  {
+     element: "<ol type='I'></ol>",
+     property: "list-style-type",
+     value: "upper-roman"
+  },
+  {
+     element: "<ol type='a'></ol>",
+     property: "list-style-type",
+     value: "lower-alpha"
+  },
+  {
+     element: "<ol type='A'></ol>",
+     property: "list-style-type",
+     value: "upper-alpha"
+  },
+  {
+     element: "<ol type='1'></ol>",
+     property: "list-style-type",
+     value: "decimal"
+  },
+];
+
+var content = document.getElementById("content");
+for (var i = 0; i < gValues.length; ++i) {
+  var v = gValues[i];
+
+  content.innerHTML = v.element;
+  is(getComputedStyle(content.firstChild, "").getPropertyValue(v.property),
+     v.value,
+     v.property + " for " + v.element);
+}
+
+</script>
+</pre>
+</body>
+</html>