| Index: third_party/WebKit/Source/core/dom/StyleEngine.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/StyleEngine.cpp b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
|
| index a030df253ecb34484ec6e858e9b12261c1d88218..374e9e8655a53160a95564ae23faff06207e5448 100644
|
| --- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
|
| @@ -626,9 +626,21 @@ void StyleEngine::platformColorsChanged()
|
| document().setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::PlatformColorChange));
|
| }
|
|
|
| +bool StyleEngine::shouldSkipInvalidationFor(const Element& element) const
|
| +{
|
| + if (!resolver())
|
| + return true;
|
| + if (!element.inActiveDocument())
|
| + return true;
|
| + if (!element.parentNode())
|
| + return true;
|
| + return element.parentNode()->styleChangeType() >= SubtreeStyleChange;
|
| +}
|
| +
|
| void StyleEngine::classChangedForElement(const SpaceSplitString& changedClasses, Element& element)
|
| {
|
| - ASSERT(isMaster());
|
| + if (shouldSkipInvalidationFor(element))
|
| + return;
|
| InvalidationLists invalidationLists;
|
| unsigned changedSize = changedClasses.size();
|
| RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSet();
|
| @@ -639,7 +651,9 @@ void StyleEngine::classChangedForElement(const SpaceSplitString& changedClasses,
|
|
|
| void StyleEngine::classChangedForElement(const SpaceSplitString& oldClasses, const SpaceSplitString& newClasses, Element& element)
|
| {
|
| - ASSERT(isMaster());
|
| + if (shouldSkipInvalidationFor(element))
|
| + return;
|
| +
|
| if (!oldClasses.size()) {
|
| classChangedForElement(newClasses, element);
|
| return;
|
| @@ -680,7 +694,9 @@ void StyleEngine::classChangedForElement(const SpaceSplitString& oldClasses, con
|
|
|
| void StyleEngine::attributeChangedForElement(const QualifiedName& attributeName, Element& element)
|
| {
|
| - ASSERT(isMaster());
|
| + if (shouldSkipInvalidationFor(element))
|
| + return;
|
| +
|
| InvalidationLists invalidationLists;
|
| ensureResolver().ensureUpdatedRuleFeatureSet().collectInvalidationSetsForAttribute(invalidationLists, element, attributeName);
|
| m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, element);
|
| @@ -688,7 +704,9 @@ void StyleEngine::attributeChangedForElement(const QualifiedName& attributeName,
|
|
|
| void StyleEngine::idChangedForElement(const AtomicString& oldId, const AtomicString& newId, Element& element)
|
| {
|
| - ASSERT(isMaster());
|
| + if (shouldSkipInvalidationFor(element))
|
| + return;
|
| +
|
| InvalidationLists invalidationLists;
|
| RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSet();
|
| if (!oldId.isEmpty())
|
| @@ -700,7 +718,9 @@ void StyleEngine::idChangedForElement(const AtomicString& oldId, const AtomicStr
|
|
|
| void StyleEngine::pseudoStateChangedForElement(CSSSelector::PseudoType pseudoType, Element& element)
|
| {
|
| - ASSERT(isMaster());
|
| + if (shouldSkipInvalidationFor(element))
|
| + return;
|
| +
|
| InvalidationLists invalidationLists;
|
| ensureResolver().ensureUpdatedRuleFeatureSet().collectInvalidationSetsForPseudoClass(invalidationLists, element, pseudoType);
|
| m_styleInvalidator.scheduleInvalidationSetsForElement(invalidationLists, element);
|
|
|