Chromium Code Reviews| 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 d5d9941d1cae10ee2b6c1a26c426a48a399dd7cf..683aca29c91411eb173412007f394e40b8db5621 100644 |
| --- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp |
| +++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp |
| @@ -627,9 +627,23 @@ void StyleEngine::platformColorsChanged() |
| document().setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::PlatformColorChange)); |
| } |
| +bool StyleEngine::shouldSkipInvalidationFor(const Element& element) const |
| +{ |
| + if (!isMaster()) |
| + return true; |
|
rune
2015/12/10 08:08:52
Should I rely on non-master documents having a nul
esprehn
2015/12/10 08:53:47
the non master will also not be active, so it'll f
|
| + 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)) |
|
esprehn
2015/12/10 08:53:47
classChangedForElement is guarded by:
bool te
esprehn
2015/12/10 08:57:01
Oh I see you removed all those checks, this seems
|
| + return; |
| InvalidationLists invalidationLists; |
| unsigned changedSize = changedClasses.size(); |
| RuleFeatureSet& ruleFeatureSet = ensureResolver().ensureUpdatedRuleFeatureSet(); |
| @@ -640,7 +654,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; |
| @@ -681,7 +697,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); |
| @@ -689,7 +707,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()) |
| @@ -701,7 +721,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); |