Backed out changeset a6e3300a3bac (bug 571347) for causing bug 573255 because the optimization is invalid given :not() selectors.

This commit is contained in:
L. David Baron 2010-06-19 14:16:38 -07:00
Родитель c8d7e9da79
Коммит 4684f3f568
10 изменённых файлов: 7 добавлений и 173 удалений

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

@ -1,6 +0,0 @@
<!DOCTYPE html>
<head>
<body style="color: green">
This should be green
</body>
</head>

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

@ -1,10 +0,0 @@
<!DOCTYPE html>
<head>
<style>
body { color: red; }
.Foo { color: green; }
</style>
<body onload="document.body.className = 'abc Foo'" class="abc">
This should be green
</body>
</head>

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

@ -1,10 +0,0 @@
<!DOCTYPE html>
<head>
<style>
body { color: green; }
.Foo { color: red; }
</style>
<body onload="document.body.className = 'abc foo'" class="Foo">
This should be green
</body>
</head>

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

@ -1,6 +0,0 @@
<!-- Quirks on purpose -->
<head>
<body style="color: green">
This should be green
</body>
</head>

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

@ -1,10 +0,0 @@
<!-- Quirks on purpose -->
<head>
<style>
body { color: red; }
.Foo { color: green; }
</style>
<body onload="document.body.className = 'abc Foo'" class="abc">
This should be green
</body>
</head>

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

@ -1,10 +0,0 @@
<!-- Quirks on purpose -->
<head>
<style>
body { color: green; }
.Foo { color: red; }
</style>
<body onload="document.body.className = 'abc bar'" class="Foo">
This should be green
</body>
</head>

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

@ -1,10 +0,0 @@
<!-- Quirks on purpose -->
<head>
<style>
body { color: red; }
.Foo { color: green; }
</style>
<body onload="document.body.className = 'abc foO'" class="abc">
This should be green
</body>
</head>

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

@ -1,10 +0,0 @@
<!-- Quirks on purpose -->
<head>
<style>
body { color: green; }
.Foo { color: red; }
</style>
<body onload="document.body.className = 'abc bar'" class="fOo">
This should be green
</body>
</head>

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

@ -1448,9 +1448,3 @@ random-if(!haveTestPlugin) == 546071-1.html 546071-1-ref.html
== 571281-1a.html 571281-1-ref.html
== 571281-1b.html 571281-1-ref.html
== 571281-1c.html 571281-1-ref.html
== 571347-1a.html 571347-1-ref.html
== 571347-1b.html 571347-1-ref.html
== 571347-2a.html 571347-2-ref.html
== 571347-2b.html 571347-2-ref.html
== 571347-2c.html 571347-2-ref.html
== 571347-2d.html 571347-2-ref.html

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

@ -706,67 +706,6 @@ static const PLDHashTableOps AttributeSelectorOps = {
};
//--------------------------------
// Class selectors hash table.
struct ClassSelectorEntry : public PLDHashEntryHdr {
nsIAtom *mClass;
nsTArray<nsCSSSelector*> mSelectors;
};
static void
ClassSelector_ClearEntry(PLDHashTable *table, PLDHashEntryHdr *hdr)
{
(static_cast<ClassSelectorEntry*>(hdr))->~ClassSelectorEntry();
}
static PRBool
ClassSelector_InitEntry(PLDHashTable *table, PLDHashEntryHdr *hdr,
const void *key)
{
ClassSelectorEntry *entry = static_cast<ClassSelectorEntry*>(hdr);
new (entry) ClassSelectorEntry();
entry->mClass = const_cast<nsIAtom*>(static_cast<const nsIAtom*>(key));
return PR_TRUE;
}
static nsIAtom*
ClassSelector_GetKey(PLDHashTable *table, const PLDHashEntryHdr *hdr)
{
const ClassSelectorEntry *entry = static_cast<const ClassSelectorEntry*>(hdr);
return entry->mClass;
}
// Case-sensitive ops.
static const RuleHashTableOps ClassSelector_CSOps = {
{
PL_DHashAllocTable,
PL_DHashFreeTable,
PL_DHashVoidPtrKeyStub,
RuleHash_CSMatchEntry,
PL_DHashMoveEntryStub,
ClassSelector_ClearEntry,
PL_DHashFinalizeStub,
ClassSelector_InitEntry
},
ClassSelector_GetKey
};
// Case-insensitive ops.
static const RuleHashTableOps ClassSelector_CIOps = {
{
PL_DHashAllocTable,
PL_DHashFreeTable,
RuleHash_CIHashKey,
RuleHash_CIMatchEntry,
PL_DHashMoveEntryStub,
ClassSelector_ClearEntry,
PL_DHashFinalizeStub,
ClassSelector_InitEntry
},
ClassSelector_GetKey
};
//--------------------------------
struct RuleCascadeData {
@ -782,10 +721,6 @@ struct RuleCascadeData {
sizeof(AttributeSelectorEntry), 16);
PL_DHashTableInit(&mAnonBoxRules, &RuleHash_TagTable_Ops, nsnull,
sizeof(RuleHashTagTableEntry), 16);
PL_DHashTableInit(&mClassSelectors,
aQuirksMode ? &ClassSelector_CIOps.ops :
&ClassSelector_CSOps.ops,
nsnull, sizeof(ClassSelectorEntry), 16);
memset(mPseudoElementRuleHashes, 0, sizeof(mPseudoElementRuleHashes));
#ifdef MOZ_XUL
PL_DHashTableInit(&mXULTreeRules, &RuleHash_TagTable_Ops, nsnull,
@ -797,10 +732,7 @@ struct RuleCascadeData {
{
PL_DHashTableFinish(&mAttributeSelectors);
PL_DHashTableFinish(&mAnonBoxRules);
PL_DHashTableFinish(&mClassSelectors);
#ifdef MOZ_XUL
PL_DHashTableFinish(&mXULTreeRules);
#endif
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(mPseudoElementRuleHashes); ++i) {
delete mPseudoElementRuleHashes[i];
}
@ -810,7 +742,7 @@ struct RuleCascadeData {
mPseudoElementRuleHashes[nsCSSPseudoElements::ePseudo_PseudoElementCount];
nsTArray<nsCSSSelector*> mStateSelectors;
PRUint32 mSelectorDocumentStates;
PLDHashTable mClassSelectors;
nsTArray<nsCSSSelector*> mClassSelectors;
nsTArray<nsCSSSelector*> mIDSelectors;
PLDHashTable mAttributeSelectors;
PLDHashTable mAnonBoxRules;
@ -2525,23 +2457,10 @@ nsCSSRuleProcessor::HasAttributeDependentStyle(AttributeRuleProcessorData* aData
}
if (aData->mAttribute == aData->mElement->GetClassAttributeName()) {
const nsAttrValue* elementClasses = aData->mClasses;
if (elementClasses) {
PRInt32 atomCount = elementClasses->GetAtomCount();
for (PRInt32 i = 0; i < atomCount; ++i) {
nsIAtom* curClass = elementClasses->AtomAt(i);
ClassSelectorEntry *entry =
static_cast<ClassSelectorEntry*>
(PL_DHashTableOperate(&cascade->mClassSelectors,
curClass, PL_DHASH_LOOKUP));
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
nsCSSSelector **iter = entry->mSelectors.Elements(),
**end = iter + entry->mSelectors.Length();
for(; iter != end; ++iter) {
AttributeEnumFunc(*iter, &data);
}
}
}
nsCSSSelector **iter = cascade->mClassSelectors.Elements(),
**end = iter + cascade->mClassSelectors.Length();
for(; iter != end; ++iter) {
AttributeEnumFunc(*iter, &data);
}
}
@ -2666,15 +2585,8 @@ AddSelector(RuleCascadeData* aCascade,
}
// Build mClassSelectors
for (nsAtomList* curClass = aSelectorPart->mClassList; curClass;
curClass = curClass->mNext) {
ClassSelectorEntry *entry =
static_cast<ClassSelectorEntry*>(PL_DHashTableOperate(&aCascade->mClassSelectors,
curClass->mAtom,
PL_DHASH_ADD));
if (entry) {
entry->mSelectors.AppendElement(aSelectorInTopLevel);
}
if (aSelectorPart->mClassList) {
aCascade->mClassSelectors.AppendElement(aSelectorInTopLevel);
}
// Build mAttributeSelectors.