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

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

Issue 1169633002: Optimize Element::attributeChanged() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed unneeded local var Created 5 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index 0c0bac11e5865c4574f89b638f7c5c9570ba7629..8a3c55dc5d609d6304bf5fcb54fc2baa967b7c1f 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -1109,29 +1109,26 @@ void Element::attributeChanged(const QualifiedName& name, const AtomicString& ne
document().incDOMTreeVersion();
StyleResolver* styleResolver = document().styleResolver();
- bool testShouldInvalidateStyle = inActiveDocument() && styleResolver && styleChangeType() < SubtreeStyleChange;
-
- if (isStyledElement()) {
- if (name == styleAttr) {
- styleAttributeChanged(newValue, reason);
- } else if (isPresentationAttribute(name)) {
- elementData()->m_presentationAttributeStyleIsDirty = true;
- setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::fromAttribute(name));
- }
- }
if (name == HTMLNames::idAttr) {
AtomicString oldId = elementData()->idForStyleResolution();
AtomicString newId = makeIdForStyleResolution(newValue, document().inQuirksMode());
if (newId != oldId) {
elementData()->setIdForStyleResolution(newId);
- if (testShouldInvalidateStyle)
+ if (inActiveDocument() && styleResolver && styleChangeType() < SubtreeStyleChange)
document().styleEngine().idChangedForElement(oldId, newId, *this);
}
} else if (name == classAttr) {
classAttributeChanged(newValue);
} else if (name == HTMLNames::nameAttr) {
setHasName(!newValue.isNull());
+ } else if (isStyledElement()) {
+ if (name == styleAttr) {
+ styleAttributeChanged(newValue, reason);
+ } else if (isPresentationAttribute(name)) {
+ elementData()->m_presentationAttributeStyleIsDirty = true;
+ setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::fromAttribute(name));
+ }
}
invalidateNodeListCachesInAncestors(&name, this);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698