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

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

Issue 1514733002: Avoid unnecessary invalidation scheduling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary isMaster check Created 5 years 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 575b315200c86f5f591b7e574ae3f19c22bd5757..41a470c7c13b0b2ef693b0b3fb5805593e9f8ec5 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -1201,15 +1201,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);
@@ -1226,10 +1223,6 @@ 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)
- setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::fromAttribute(name));
-
if (inDocument()) {
if (AXObjectCache* cache = document().existingAXObjectCache())
cache->handleAttributeChanged(name, this);
@@ -1287,9 +1280,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();
@@ -1297,12 +1287,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
@@ -1876,9 +1864,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)
@@ -3131,9 +3117,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