Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Unified Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 1560693002: Avoid unnecessary invalidation scheduling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile fix Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/Element.cpp
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp
index 1eac2a5b10c1e2234c45ed248d0223c6baeeb4bb..15e218b2cb3f1cdbb1e9949a6f04d0f772523ed1 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -1198,15 +1198,12 @@ void Element::attributeChanged(const QualifiedName& name, const AtomicString& ol
document().incDOMTreeVersion();
- StyleResolver* styleResolver = document().styleResolver();
-
if (name == HTMLNames::idAttr) {
AtomicString oldId = elementData()->idForStyleResolution();
AtomicString newId = makeIdForStyleResolution(newValue, document().inQuirksMode());
if (newId != oldId) {
elementData()->setIdForStyleResolution(newId);
- if (inActiveDocument() && styleResolver)
- document().styleEngine().idChangedForElement(oldId, newId, *this);
+ document().styleEngine().idChangedForElement(oldId, newId, *this);
}
} else if (name == classAttr) {
classAttributeChanged(newValue);
@@ -1224,7 +1221,7 @@ void Element::attributeChanged(const QualifiedName& name, const AtomicString& ol
invalidateNodeListCachesInAncestors(&name, this);
// If there is currently no StyleResolver, we can't be sure that this attribute change won't affect style.
- if (!styleResolver)
+ if (!document().styleResolver())
setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::fromAttribute(name));
if (inDocument()) {
@@ -1284,9 +1281,6 @@ static inline ClassStringContent classStringHasClassName(const AtomicString& new
void Element::classAttributeChanged(const AtomicString& newClassString)
{
- StyleResolver* styleResolver = document().styleResolver();
- bool testShouldInvalidateStyle = inActiveDocument() && styleResolver;
-
ASSERT(elementData());
ClassStringContent classStringContentType = classStringHasClassName(newClassString);
const bool shouldFoldCase = document().inQuirksMode();
@@ -1294,12 +1288,10 @@ void Element::classAttributeChanged(const AtomicString& newClassString)
const SpaceSplitString oldClasses = elementData()->classNames();
elementData()->setClass(newClassString, shouldFoldCase);
const SpaceSplitString& newClasses = elementData()->classNames();
- if (testShouldInvalidateStyle)
- document().styleEngine().classChangedForElement(oldClasses, newClasses, *this);
+ document().styleEngine().classChangedForElement(oldClasses, newClasses, *this);
} else {
const SpaceSplitString& oldClasses = elementData()->classNames();
- if (testShouldInvalidateStyle)
- document().styleEngine().classChangedForElement(oldClasses, *this);
+ document().styleEngine().classChangedForElement(oldClasses, *this);
if (classStringContentType == ClassStringContent::WhiteSpaceOnly)
elementData()->setClass(newClassString, shouldFoldCase);
else
@@ -1873,9 +1865,7 @@ void Element::pseudoStateChanged(CSSSelector::PseudoType pseudo)
// like HTMLSelectElement.
if (document().inStyleRecalc())
return;
- StyleResolver* styleResolver = document().styleResolver();
- if (inActiveDocument() && styleResolver)
- document().styleEngine().pseudoStateChangedForElement(pseudo, *this);
+ document().styleEngine().pseudoStateChangedForElement(pseudo, *this);
}
void Element::setAnimationStyleChange(bool animationStyleChange)
@@ -3123,9 +3113,7 @@ void Element::willModifyAttribute(const QualifiedName& name, const AtomicString&
}
if (oldValue != newValue) {
- if (inActiveDocument() && document().styleResolver())
- document().styleEngine().attributeChangedForElement(name, *this);
-
+ document().styleEngine().attributeChangedForElement(name, *this);
if (isUpgradedCustomElement())
CustomElement::attributeDidChange(this, name.localName(), oldValue, newValue);
}
« no previous file with comments | « third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp ('k') | third_party/WebKit/Source/core/dom/StyleEngine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698