Remove NS_STYLE_LIST_STYLE_OLD_* constants to fix computed list-style-type style resulting from type attribute on lists. (Bug 665857) r=bzbarsky

This commit is contained in:
L. David Baron 2011-06-29 14:39:21 -07:00
parent 4f2850eae4
commit 2dd9a8ab37
6 changed files with 99 additions and 32 deletions

View File

@ -108,7 +108,7 @@ 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 },
@ -117,11 +117,12 @@ static const nsAttrValue::EnumTable kUnorderedListItemTypeTable[] = {
{ 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 }
};

View File

@ -148,7 +148,7 @@ 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 },
@ -163,12 +163,12 @@ nsAttrValue::EnumTable kListTypeTable[] = {
{ 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 }
};

View File

@ -557,11 +557,6 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
#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

View File

@ -335,16 +335,11 @@ nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt,
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:
@ -1062,7 +1057,6 @@ nsBulletFrame::AppendCounterText(PRInt32 aListStyleType,
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);
@ -1073,23 +1067,19 @@ nsBulletFrame::AppendCounterText(PRInt32 aListStyleType,
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;
@ -1371,15 +1361,10 @@ nsBulletFrame::GetDesiredSize(nsPresContext* aCX,
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:

View File

@ -139,6 +139,7 @@ _TEST_FILES = test_acid3_test46.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 \

View File

@ -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>