Bug 922669 - Part 2: Use a different operator to represent the element -> pseudo-element relationship in selectors. r=bz

This commit is contained in:
Cameron McCormack 2013-11-28 17:46:38 +11:00
Родитель 417805594e
Коммит 836792bdcf
3 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -550,7 +550,7 @@ nsCSSSelector::ToString(nsAString& aString, nsCSSStyleSheet* aSheet,
const nsCSSSelector *next = stack.ElementAt(index - 1); const nsCSSSelector *next = stack.ElementAt(index - 1);
PRUnichar oper = s->mOperator; PRUnichar oper = s->mOperator;
if (next->IsPseudoElement()) { if (next->IsPseudoElement()) {
NS_ASSERTION(oper == PRUnichar('>'), NS_ASSERTION(oper == PRUnichar(':'),
"improperly chained pseudo element"); "improperly chained pseudo element");
} else { } else {
NS_ASSERTION(oper != PRUnichar(0), NS_ASSERTION(oper != PRUnichar(0),

Просмотреть файл

@ -4218,12 +4218,12 @@ CSSParserImpl::ParseSelector(nsCSSSelectorList* aList,
&pseudoElementType); &pseudoElementType);
if (pseudoElement && if (pseudoElement &&
pseudoElementType != nsCSSPseudoElements::ePseudo_AnonBox) { pseudoElementType != nsCSSPseudoElements::ePseudo_AnonBox) {
// Pseudo-elements other than anonymous boxes are represented as // Pseudo-elements other than anonymous boxes are represented with
// direct children ('>' combinator) of the rest of the selector. // a special ':' combinator.
aList->mWeight += selector->CalcWeight(); aList->mWeight += selector->CalcWeight();
selector = aList->AddSelector('>'); selector = aList->AddSelector(':');
selector->mLowercaseTag.swap(pseudoElement); selector->mLowercaseTag.swap(pseudoElement);
selector->mClassList = pseudoElementArgs.forget(); selector->mClassList = pseudoElementArgs.forget();

Просмотреть файл

@ -2990,7 +2990,7 @@ AddRule(RuleSelectorPair* aRuleInfo, RuleCascadeData* aCascade)
} }
NS_ASSERTION(aRuleInfo->mSelector->mNext, NS_ASSERTION(aRuleInfo->mSelector->mNext,
"Must have mNext; parser screwed up"); "Must have mNext; parser screwed up");
NS_ASSERTION(aRuleInfo->mSelector->mNext->mOperator == '>', NS_ASSERTION(aRuleInfo->mSelector->mNext->mOperator == ':',
"Unexpected mNext combinator"); "Unexpected mNext combinator");
aRuleInfo->mSelector = aRuleInfo->mSelector->mNext; aRuleInfo->mSelector = aRuleInfo->mSelector->mNext;
ruleHash->AppendRule(*aRuleInfo); ruleHash->AppendRule(*aRuleInfo);