Bug 968281 - pull helper function out of HasAttributeDependentStyle; r=bz

This commit is contained in:
Nathan Froyd 2014-02-05 10:16:03 -05:00
parent fde2659647
commit 39793d7ff4

View File

@ -2692,6 +2692,16 @@ AttributeEnumFunc(nsCSSSelector* aSelector, AttributeEnumData* aData)
}
}
static MOZ_ALWAYS_INLINE void
EnumerateSelectors(nsTArray<nsCSSSelector*>& aSelectors, AttributeEnumData* aData)
{
nsCSSSelector **iter = aSelectors.Elements(),
**end = iter + aSelectors.Length();
for (; iter != end; ++iter) {
AttributeEnumFunc(*iter, aData);
}
}
nsRestyleHint
nsCSSRuleProcessor::HasAttributeDependentStyle(AttributeRuleProcessorData* aData)
{
@ -2738,19 +2748,11 @@ nsCSSRuleProcessor::HasAttributeDependentStyle(AttributeRuleProcessorData* aData
(PL_DHashTableOperate(&cascade->mIdSelectors,
id, 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);
}
EnumerateSelectors(entry->mSelectors, &data);
}
}
nsCSSSelector **iter = cascade->mPossiblyNegatedIDSelectors.Elements(),
**end = iter + cascade->mPossiblyNegatedIDSelectors.Length();
for(; iter != end; ++iter) {
AttributeEnumFunc(*iter, &data);
}
EnumerateSelectors(cascade->mPossiblyNegatedIDSelectors, &data);
}
if (aData->mAttribute == aData->mElement->GetClassAttributeName()) {
@ -2764,21 +2766,12 @@ nsCSSRuleProcessor::HasAttributeDependentStyle(AttributeRuleProcessorData* aData
(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);
}
EnumerateSelectors(entry->mSelectors, &data);
}
}
}
nsCSSSelector **iter = cascade->mPossiblyNegatedClassSelectors.Elements(),
**end = iter +
cascade->mPossiblyNegatedClassSelectors.Length();
for (; iter != end; ++iter) {
AttributeEnumFunc(*iter, &data);
}
EnumerateSelectors(cascade->mPossiblyNegatedClassSelectors, &data);
}
AtomSelectorEntry *entry =
@ -2786,11 +2779,7 @@ nsCSSRuleProcessor::HasAttributeDependentStyle(AttributeRuleProcessorData* aData
(PL_DHashTableOperate(&cascade->mAttributeSelectors,
aData->mAttribute, 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);
}
EnumerateSelectors(entry->mSelectors, &data);
}
}