Bug 1016063. Don't include the fake classnames XUL tree pseudo-elements have when calculating style rule specificity. r=heycam

This commit is contained in:
Boris Zbarsky 2014-06-03 11:38:38 -04:00
Родитель 0a69a27027
Коммит 88aef1f5fa
1 изменённых файлов: 20 добавлений и 4 удалений

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

@ -473,10 +473,19 @@ int32_t nsCSSSelector::CalcWeightWithoutNegations() const
{
int32_t weight = 0;
MOZ_ASSERT(!IsPseudoElement() ||
mPseudoType >= nsCSSPseudoElements::ePseudo_PseudoElementCount ||
(!mIDList && !mClassList && !mAttrList),
"if pseudo-elements can have ID, class or attribute selectors "
#ifdef MOZ_XUL
MOZ_ASSERT(!(IsPseudoElement() &&
PseudoType() != nsCSSPseudoElements::ePseudo_XULTree &&
mClassList),
"If non-XUL-tree pseudo-elements can have class selectors "
"after them, specificity calculation must be updated");
#else
MOZ_ASSERT(!(IsPseudoElement() && mClassList),
"If pseudo-elements can have class selectors "
"after them, specificity calculation must be updated");
#endif
MOZ_ASSERT(!(IsPseudoElement() && (mIDList || mAttrList)),
"If pseudo-elements can have id or attribute selectors "
"after them, specificity calculation must be updated");
if (nullptr != mCasedTag) {
@ -488,6 +497,13 @@ int32_t nsCSSSelector::CalcWeightWithoutNegations() const
list = list->mNext;
}
list = mClassList;
#ifdef MOZ_XUL
// XUL tree pseudo-elements abuse mClassList to store some private
// data; ignore that.
if (PseudoType() == nsCSSPseudoElements::ePseudo_XULTree) {
list = nullptr;
}
#endif
while (nullptr != list) {
weight += 0x000100;
list = list->mNext;