Bug 1028512 - Remove {lower,upper}-{roman,alpha} from CSS keywords. r=jfkthame
authorXidorn Quan <quanxunzhen@gmail.com>
Sun, 22 Jun 2014 13:28:51 +0100
changeset 189934 e0d435b1340e83a46eaa93ba1eb1758860e57ccc
parent 189933 93cd05e483cdaae67bdec1ffdb96c4245fe2b11a
child 189935 2b483618e693efaab3fa7e3f67ddb64ec41ad505
push id45205
push userjkew@mozilla.com
push dateSun, 22 Jun 2014 12:29:31 +0000
treeherdermozilla-inbound@e0d435b1340e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1028512
milestone33.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
Bug 1028512 - Remove {lower,upper}-{roman,alpha} from CSS keywords. r=jfkthame
layout/style/CounterStyleManager.cpp
layout/style/nsCSSKeywordList.h
layout/style/nsCSSProps.cpp
layout/style/nsRuleNode.cpp
layout/style/nsStyleConsts.h
layout/svg/crashtests/1028512.svg
layout/svg/crashtests/crashtests.list
--- a/layout/style/CounterStyleManager.cpp
+++ b/layout/style/CounterStyleManager.cpp
@@ -1863,21 +1863,16 @@ CounterStyleManager::BuildCounterStyle(c
 
 /* static */ CounterStyle*
 CounterStyleManager::GetBuiltinStyle(int32_t aStyle)
 {
   NS_ABORT_IF_FALSE(0 <= aStyle && aStyle < NS_STYLE_LIST_STYLE__MAX,
                     "Require a valid builtin style constant");
   NS_ABORT_IF_FALSE(!gBuiltinStyleTable[aStyle].IsDependentStyle(),
                     "Cannot get dependent builtin style");
-  NS_ASSERTION(aStyle != NS_STYLE_LIST_STYLE_LOWER_ROMAN &&
-               aStyle != NS_STYLE_LIST_STYLE_UPPER_ROMAN &&
-               aStyle != NS_STYLE_LIST_STYLE_LOWER_ALPHA &&
-               aStyle != NS_STYLE_LIST_STYLE_UPPER_ALPHA,
-               "lower/upper-roman/alpha should be custom counter style");
   return &gBuiltinStyleTable[aStyle];
 }
 
 struct InvalidateOldStyleData
 {
   explicit InvalidateOldStyleData(nsPresContext* aPresContext)
     : mPresContext(aPresContext),
       mChanged(false)
--- a/layout/style/nsCSSKeywordList.h
+++ b/layout/style/nsCSSKeywordList.h
@@ -329,18 +329,16 @@ CSS_KEY(lighten, lighten)
 CSS_KEY(lighter, lighter)
 CSS_KEY(line-through, line_through)
 CSS_KEY(linear, linear)
 CSS_KEY(lining-nums, lining_nums)
 CSS_KEY(list-item, list_item)
 CSS_KEY(local, local)
 CSS_KEY(logical, logical)
 CSS_KEY(looped, looped)
-CSS_KEY(lower-alpha, lower_alpha)
-CSS_KEY(lower-roman, lower_roman)
 CSS_KEY(lowercase, lowercase)
 CSS_KEY(ltr, ltr)
 CSS_KEY(luminance, luminance)
 CSS_KEY(luminosity, luminosity)
 CSS_KEY(manipulation, manipulation)
 CSS_KEY(manual, manual)
 CSS_KEY(margin-box, margin_box)
 CSS_KEY(markers, markers)
@@ -536,18 +534,16 @@ CSS_KEY(translatez, translatez)
 CSS_KEY(transparent, transparent) // for nsComputedDOMStyle only
 CSS_KEY(tri-state, tri_state)
 CSS_KEY(true, true)
 CSS_KEY(ultra-condensed, ultra_condensed)
 CSS_KEY(ultra-expanded, ultra_expanded)
 CSS_KEY(underline, underline)
 CSS_KEY(unicase, unicase)
 CSS_KEY(unset, unset)
-CSS_KEY(upper-alpha, upper_alpha)
-CSS_KEY(upper-roman, upper_roman)
 CSS_KEY(uppercase, uppercase)
 CSS_KEY(upright, upright)
 CSS_KEY(vertical, vertical)
 CSS_KEY(vertical-lr, vertical_lr)
 CSS_KEY(vertical-rl, vertical_rl)
 CSS_KEY(vertical-text, vertical_text)
 CSS_KEY(visible, visible)
 CSS_KEY(visiblefill, visiblefill)
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -1366,21 +1366,16 @@ const KTableValue nsCSSProps::kListStyle
   eCSSKeyword_none, NS_STYLE_LIST_STYLE_NONE,
   eCSSKeyword_decimal, NS_STYLE_LIST_STYLE_DECIMAL,
   // the following graphic styles are processed in a different way.
   eCSSKeyword_disc, NS_STYLE_LIST_STYLE_DISC,
   eCSSKeyword_circle, NS_STYLE_LIST_STYLE_CIRCLE,
   eCSSKeyword_square, NS_STYLE_LIST_STYLE_SQUARE,
   eCSSKeyword_disclosure_closed, NS_STYLE_LIST_STYLE_DISCLOSURE_CLOSED,
   eCSSKeyword_disclosure_open, NS_STYLE_LIST_STYLE_DISCLOSURE_OPEN,
-  // {lower,upper}-{roman,alpha} are also used by html attribute map.
-  eCSSKeyword_lower_roman, NS_STYLE_LIST_STYLE_LOWER_ROMAN,
-  eCSSKeyword_upper_roman, NS_STYLE_LIST_STYLE_UPPER_ROMAN,
-  eCSSKeyword_lower_alpha, NS_STYLE_LIST_STYLE_LOWER_ALPHA,
-  eCSSKeyword_upper_alpha, NS_STYLE_LIST_STYLE_UPPER_ALPHA,
   // the following counter styles require specific algorithms to generate.
   eCSSKeyword_hebrew, NS_STYLE_LIST_STYLE_HEBREW,
   eCSSKeyword_japanese_informal, NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL,
   eCSSKeyword_japanese_formal, NS_STYLE_LIST_STYLE_JAPANESE_FORMAL,
   eCSSKeyword_korean_hangul_formal, NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL,
   eCSSKeyword_korean_hanja_informal, NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL,
   eCSSKeyword_korean_hanja_formal, NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL,
   eCSSKeyword_simp_chinese_informal, NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL,
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -7031,25 +7031,42 @@ nsRuleNode::ComputeListData(void* aStart
       list->SetListStyleType(NS_LITERAL_STRING("disc"), mPresContext);
       break;
     case eCSSUnit_Ident: {
       nsString typeIdent;
       typeValue->GetStringValue(typeIdent);
       list->SetListStyleType(typeIdent, mPresContext);
       break;
     }
-    case eCSSUnit_Enumerated:
+    case eCSSUnit_Enumerated: {
       // For compatibility with html attribute map.
       // This branch should never be called for value from CSS.
-      list->SetListStyleType(
-          NS_ConvertASCIItoUTF16(
-              nsCSSProps::ValueToKeyword(
-                  typeValue->GetIntValue(), nsCSSProps::kListStyleKTable)),
-          mPresContext);
+      int32_t intValue = typeValue->GetIntValue();
+      nsAutoString name;
+      switch (intValue) {
+        case NS_STYLE_LIST_STYLE_LOWER_ROMAN:
+          name.AssignLiteral(MOZ_UTF16("lower-roman"));
+          break;
+        case NS_STYLE_LIST_STYLE_UPPER_ROMAN:
+          name.AssignLiteral(MOZ_UTF16("upper-roman"));
+          break;
+        case NS_STYLE_LIST_STYLE_LOWER_ALPHA:
+          name.AssignLiteral(MOZ_UTF16("lower-alpha"));
+          break;
+        case NS_STYLE_LIST_STYLE_UPPER_ALPHA:
+          name.AssignLiteral(MOZ_UTF16("upper-alpha"));
+          break;
+        default:
+          CopyASCIItoUTF16(nsCSSProps::ValueToKeyword(
+                  intValue, nsCSSProps::kListStyleKTable), name);
+          break;
+      }
+      list->SetListStyleType(name, mPresContext);
       break;
+    }
     case eCSSUnit_Null:
       break;
     default:
       NS_NOTREACHED("Unexpected value unit");
   }
 
   // list-style-image: url, none, inherit
   const nsCSSValue* imageValue = aRuleData->ValueForListStyleImage();
--- a/layout/style/nsStyleConsts.h
+++ b/layout/style/nsStyleConsts.h
@@ -635,34 +635,36 @@ static inline mozilla::css::Side operato
 
 // See nsStyleList
 #define NS_STYLE_LIST_STYLE_CUSTOM                -1 // for @counter-style
 #define NS_STYLE_LIST_STYLE_NONE                  0
 #define NS_STYLE_LIST_STYLE_DISC                  1
 #define NS_STYLE_LIST_STYLE_CIRCLE                2
 #define NS_STYLE_LIST_STYLE_SQUARE                3
 #define NS_STYLE_LIST_STYLE_DECIMAL               4
-#define NS_STYLE_LIST_STYLE_LOWER_ROMAN           5
-#define NS_STYLE_LIST_STYLE_UPPER_ROMAN           6
-#define NS_STYLE_LIST_STYLE_LOWER_ALPHA           7
-#define NS_STYLE_LIST_STYLE_UPPER_ALPHA           8
-#define NS_STYLE_LIST_STYLE_HEBREW                9
-#define NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL     10
-#define NS_STYLE_LIST_STYLE_JAPANESE_FORMAL       11
-#define NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL  12
-#define NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL 13
-#define NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL   14
-#define NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL 15
-#define NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL   16
-#define NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL 17
-#define NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL   18
-#define NS_STYLE_LIST_STYLE_ETHIOPIC_NUMERIC      19
-#define NS_STYLE_LIST_STYLE_DISCLOSURE_CLOSED     20
-#define NS_STYLE_LIST_STYLE_DISCLOSURE_OPEN       21
-#define NS_STYLE_LIST_STYLE__MAX                  22
+#define NS_STYLE_LIST_STYLE_HEBREW                5
+#define NS_STYLE_LIST_STYLE_JAPANESE_INFORMAL     6
+#define NS_STYLE_LIST_STYLE_JAPANESE_FORMAL       7
+#define NS_STYLE_LIST_STYLE_KOREAN_HANGUL_FORMAL  8
+#define NS_STYLE_LIST_STYLE_KOREAN_HANJA_INFORMAL 9
+#define NS_STYLE_LIST_STYLE_KOREAN_HANJA_FORMAL   10
+#define NS_STYLE_LIST_STYLE_SIMP_CHINESE_INFORMAL 11
+#define NS_STYLE_LIST_STYLE_SIMP_CHINESE_FORMAL   12
+#define NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL 13
+#define NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL   14
+#define NS_STYLE_LIST_STYLE_ETHIOPIC_NUMERIC      15
+#define NS_STYLE_LIST_STYLE_DISCLOSURE_CLOSED     16
+#define NS_STYLE_LIST_STYLE_DISCLOSURE_OPEN       17
+#define NS_STYLE_LIST_STYLE__MAX                  18
+// These styles are handled as custom styles defined in counterstyles.css.
+// They are preserved here only for html attribute map.
+#define NS_STYLE_LIST_STYLE_LOWER_ROMAN           100
+#define NS_STYLE_LIST_STYLE_UPPER_ROMAN           101
+#define NS_STYLE_LIST_STYLE_LOWER_ALPHA           102
+#define NS_STYLE_LIST_STYLE_UPPER_ALPHA           103
 
 // See nsStyleList
 #define NS_STYLE_LIST_STYLE_POSITION_INSIDE     0
 #define NS_STYLE_LIST_STYLE_POSITION_OUTSIDE    1
 
 // See nsStyleMargin
 #define NS_STYLE_MARGIN_SIZE_AUTO               0
 
new file mode 100644
--- /dev/null
+++ b/layout/svg/crashtests/1028512.svg
@@ -0,0 +1,15 @@
+<!-- {lower,upper}-{roman,alpha} in svg -->
+<svg xmlns="http://www.w3.org/2000/svg">
+<script>
+<![CDATA[
+
+function boom()
+{
+    document.documentElement.style.transition = "2s";
+    document.documentElement.style.listStyleType = "lower-roman";
+}
+
+window.addEventListener("load", boom, false);
+
+]]>
+</script></svg>
--- a/layout/svg/crashtests/crashtests.list
+++ b/layout/svg/crashtests/crashtests.list
@@ -180,9 +180,10 @@ load 919371-1.xhtml
 load 952270-1.svg
 load 963086-1.svg
 load 975773-1.svg
 load 974746-1.svg
 load 979407-1.svg
 load 979407-2.svg
 load 993443.svg
 load 1016145.svg
+load 1028512.svg