mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1184842. Restyling should consider only the classes that have changed. r=heycam
This commit is contained in:
parent
c0b6fcd9ee
commit
727bfb81dc
@ -55,6 +55,7 @@
|
|||||||
#include "mozilla/Likely.h"
|
#include "mozilla/Likely.h"
|
||||||
#include "mozilla/TypedEnumBits.h"
|
#include "mozilla/TypedEnumBits.h"
|
||||||
#include "RuleProcessorCache.h"
|
#include "RuleProcessorCache.h"
|
||||||
|
#include "nsIDOMMutationEvent.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
@ -2802,11 +2803,31 @@ nsCSSRuleProcessor::HasAttributeDependentStyle(AttributeRuleProcessorData* aData
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (aData->mAttribute == nsGkAtoms::_class) {
|
if (aData->mAttribute == nsGkAtoms::_class) {
|
||||||
|
const nsAttrValue* otherClasses = aData->mOtherValue;
|
||||||
|
NS_ASSERTION(otherClasses ||
|
||||||
|
aData->mModType == nsIDOMMutationEvent::REMOVAL,
|
||||||
|
"All class values should be StoresOwnData and parsed"
|
||||||
|
"via Element::BeforeSetAttr, so available here");
|
||||||
|
// For WillChange, enumerate classes that will be removed to see which
|
||||||
|
// rules apply before the change.
|
||||||
|
// For Changed, enumerate classes that have been added to see which rules
|
||||||
|
// apply after the change.
|
||||||
|
// In both cases we're interested in the classes that are currently on
|
||||||
|
// the element but not in mOtherValue.
|
||||||
const nsAttrValue* elementClasses = aData->mElement->GetClasses();
|
const nsAttrValue* elementClasses = aData->mElement->GetClasses();
|
||||||
if (elementClasses) {
|
if (elementClasses) {
|
||||||
int32_t atomCount = elementClasses->GetAtomCount();
|
int32_t atomCount = elementClasses->GetAtomCount();
|
||||||
|
if (atomCount > 0) {
|
||||||
|
nsTHashtable<nsPtrHashKey<nsIAtom>> otherClassesTable;
|
||||||
|
if (otherClasses) {
|
||||||
|
int32_t otherClassesCount = otherClasses->GetAtomCount();
|
||||||
|
for (int32_t i = 0; i < otherClassesCount; ++i) {
|
||||||
|
otherClassesTable.PutEntry(otherClasses->AtomAt(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
for (int32_t i = 0; i < atomCount; ++i) {
|
for (int32_t i = 0; i < atomCount; ++i) {
|
||||||
nsIAtom* curClass = elementClasses->AtomAt(i);
|
nsIAtom* curClass = elementClasses->AtomAt(i);
|
||||||
|
if (!otherClassesTable.Contains(curClass)) {
|
||||||
AtomSelectorEntry *entry =
|
AtomSelectorEntry *entry =
|
||||||
static_cast<AtomSelectorEntry*>
|
static_cast<AtomSelectorEntry*>
|
||||||
(PL_DHashTableSearch(&cascade->mClassSelectors,
|
(PL_DHashTableSearch(&cascade->mClassSelectors,
|
||||||
@ -2816,6 +2837,8 @@ nsCSSRuleProcessor::HasAttributeDependentStyle(AttributeRuleProcessorData* aData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EnumerateSelectors(cascade->mPossiblyNegatedClassSelectors, &data);
|
EnumerateSelectors(cascade->mPossiblyNegatedClassSelectors, &data);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user