Bug 1372488 - Make counter style 'disc' not overridable. r=dbaron

MozReview-Commit-ID: 11ZpZtRQSUF

--HG--
extra : rebase_source : 25f95280f530d786ec8dbc30a5f5228e96000d99
This commit is contained in:
Xidorn Quan 2017-06-13 16:00:37 +10:00
parent a2b77a58e3
commit 8213987f36
8 changed files with 14 additions and 16 deletions

View File

@ -15,8 +15,6 @@
<ul class="triangle"><li></ul>
<ul class="triangle"><li></ul>
<ul class="triangle"><li></ul>
<ul class="triangle"><li></ul>
<ul class="triangle"><li></ul>
<ul class="hiragana"><li></ul>
<ul class="katakana"><li></ul>
<ul class="hiragana-iroha"><li></ul>
@ -30,7 +28,6 @@
<ol class="triangle"><li></ol>
<ol class="triangle"><li></ol>
<ol class="triangle"><li></ol>
<ol class="triangle"><li></ol>
<ol class="hiragana"><li></ol>
<ol class="katakana"><li></ol>
<ol class="hiragana-iroha"><li></ol>
@ -44,7 +41,6 @@
<li class="triangle">
<li class="triangle">
<li class="triangle">
<li class="triangle">
<li class="hiragana">
<li class="katakana">
<li class="hiragana-iroha">

View File

@ -28,8 +28,6 @@
system: extends katakana-iroha;
}
</style>
<ul><li></ul>
<ul type="disc"><li></ul>
<ul type="circle"><li></ul>
<ul type="round"><li></ul>
<ul type="square"><li></ul>
@ -43,7 +41,6 @@
<ul type="upper-alpha"><li></ul>
<ol><li></ol>
<ol type="disc"><li></ol>
<ol type="circle"><li></ol>
<ol type="round"><li></ol>
<ol type="square"><li></ol>
@ -57,7 +54,6 @@
<ol type="upper-alpha"><li></ol>
<ul>
<li type="disc">
<li type="circle">
<li type="round">
<li type="square">

View File

@ -3,5 +3,6 @@
<ol>
<li style="list-style-type: none">foo
<li style="list-style-type: decimal">bar
<li style="list-style-type: disc">baz
<li style="list-style-type: cjk-decimal">
</ol>

View File

@ -7,6 +7,9 @@
@counter-style decimal {
system: extends upper-roman;
}
@counter-style disc {
system: extends decimal;
}
@counter-style hebrew {
system: extends cjk-decimal;
}
@ -14,5 +17,6 @@
<ol>
<li style="list-style-type: none">foo
<li style="list-style-type: decimal">bar
<li style="list-style-type: disc">baz
<li style="list-style-type: hebrew">
</ol>

View File

@ -1977,6 +1977,7 @@ CounterStyleManager::CounterStyleManager(nsPresContext* aPresContext)
// Insert the static styles into cache table
mStyles.Put(nsGkAtoms::none, GetNoneStyle());
mStyles.Put(nsGkAtoms::decimal, GetDecimalStyle());
mStyles.Put(nsGkAtoms::disc, GetDiscStyle());
}
CounterStyleManager::~CounterStyleManager()

View File

@ -320,8 +320,8 @@ public:
bool IsInitial() const
{
// only 'none' and 'decimal'
return mStyles.Count() == 2;
// only 'none', 'decimal', and 'disc'
return mStyles.Count() == 3;
}
// Returns the counter style object for the given name from the style
@ -342,6 +342,10 @@ public:
{
return GetBuiltinStyle(NS_STYLE_LIST_STYLE_DECIMAL);
}
static CounterStyle* GetDiscStyle()
{
return GetBuiltinStyle(NS_STYLE_LIST_STYLE_DISC);
}
// This method will scan all existing counter styles generated by this
// manager, and remove or mark data dirty accordingly. It returns true

View File

@ -4938,6 +4938,7 @@ CSSParserImpl::ParseCounterStyleName(bool aForDefinition)
static const nsCSSKeyword kReservedNames[] = {
eCSSKeyword_none,
eCSSKeyword_decimal,
eCSSKeyword_disc,
eCSSKeyword_UNKNOWN
};

View File

@ -602,12 +602,7 @@ nsStyleList::nsStyleList(const nsPresContext* aContext)
: mListStylePosition(NS_STYLE_LIST_STYLE_POSITION_OUTSIDE)
{
MOZ_COUNT_CTOR(nsStyleList);
if (aContext->StyleSet()->IsServo()) {
mCounterStyle = do_AddRef(nsGkAtoms::disc);
} else {
mCounterStyle = aContext->
CounterStyleManager()->BuildCounterStyle(nsGkAtoms::disc);
}
mCounterStyle = CounterStyleManager::GetDiscStyle();
SetQuotesInitial();
}