Bug 602341 part 7. Fix serialization of tree selectors. r=dbaron

This commit is contained in:
Boris Zbarsky 2011-03-23 17:25:42 -04:00
Родитель 0f015ac610
Коммит 75c69c02b6
1 изменённых файлов: 57 добавлений и 61 удалений

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

@ -684,6 +684,22 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations
// Append each class in the linked list
if (mClassList) {
if (isPseudoElement) {
#ifdef MOZ_XUL
NS_ABORT_IF_FALSE(nsCSSAnonBoxes::IsTreePseudoElement(mLowercaseTag),
"must be tree pseudo-element");
aString.Append(PRUnichar('('));
for (nsAtomList* list = mClassList; list; list = list->mNext) {
nsStyleUtil::AppendEscapedCSSIdent(nsDependentAtomString(list->mAtom), aString);
aString.Append(PRUnichar(','));
}
// replace the final comma with a close-paren
aString.Replace(aString.Length() - 1, 1, PRUnichar(')'));
#else
NS_ERROR("Can't happen");
#endif
} else {
nsAtomList* list = mClassList;
while (list != nsnull) {
list->mAtom->ToString(temp);
@ -692,6 +708,7 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations
list = list->mNext;
}
}
}
// Append each attribute selector in the linked list
if (mAttrList) {
@ -747,26 +764,6 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations
}
// Append each pseudo-class in the linked list
if (isPseudoElement) {
#ifdef MOZ_XUL
if (mPseudoClassList) {
NS_ABORT_IF_FALSE(nsCSSAnonBoxes::IsTreePseudoElement(mLowercaseTag),
"must be tree pseudo-element");
aString.Append(PRUnichar('('));
for (nsPseudoClassList* list = mPseudoClassList; list;
list = list->mNext) {
nsCSSPseudoClasses::PseudoTypeToString(list->mType, temp);
nsStyleUtil::AppendEscapedCSSIdent(temp, aString);
NS_ABORT_IF_FALSE(!list->u.mMemory, "data not expected");
aString.Append(PRUnichar(','));
}
// replace the final comma with a close-paren
aString.Replace(aString.Length() - 1, 1, PRUnichar(')'));
}
#else
NS_ABORT_IF_FALSE(!mPseudoClassList, "unexpected pseudo-class list");
#endif
} else {
for (nsPseudoClassList* list = mPseudoClassList; list; list = list->mNext) {
nsCSSPseudoClasses::PseudoTypeToString(list->mType, temp);
// This should not be escaped since (a) the pseudo-class string
@ -807,7 +804,6 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations
aString.Append(PRUnichar(')'));
}
}
}
}
PRBool