diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index 52e79902e38..08fe250a2ea 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -2692,6 +2692,16 @@ AttributeEnumFunc(nsCSSSelector* aSelector, AttributeEnumData* aData) } } +static MOZ_ALWAYS_INLINE void +EnumerateSelectors(nsTArray& 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); } }