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

Unified Diff: sky/engine/core/dom/Element.cpp

Issue 840223006: Don't queue mutation records when attributes don't change value. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | sky/tests/mutation-observer/observe-options-attributes.sky » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/dom/Element.cpp
diff --git a/sky/engine/core/dom/Element.cpp b/sky/engine/core/dom/Element.cpp
index 783dff4c45400b56db4d85ab5c662b05bc3d3352..7dc4a98b1a59e42b66681692a0814f124505bf92 100644
--- a/sky/engine/core/dom/Element.cpp
+++ b/sky/engine/core/dom/Element.cpp
@@ -632,11 +632,13 @@ ALWAYS_INLINE void Element::setAttributeInternal(size_t index, const QualifiedNa
const Attribute& existingAttribute = elementData()->attributes().at(index);
QualifiedName existingAttributeName = existingAttribute.name();
+ if (newValue == existingAttribute.value())
+ return;
+
if (!inSynchronizationOfLazyAttribute)
willModifyAttribute(existingAttributeName, existingAttribute.value(), newValue);
- if (newValue != existingAttribute.value())
- ensureUniqueElementData().attributes().at(index).setValue(newValue);
+ ensureUniqueElementData().attributes().at(index).setValue(newValue);
if (!inSynchronizationOfLazyAttribute)
attributeChanged(existingAttributeName, newValue);
@@ -1531,17 +1533,14 @@ inline void Element::updateId(TreeScope& scope, const AtomicString& oldId, const
void Element::willModifyAttribute(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue)
{
- if (name == HTMLNames::idAttr) {
+ if (name == HTMLNames::idAttr)
updateId(oldValue, newValue);
- }
- if (oldValue != newValue) {
- if (inActiveDocument() && styleChangeType() < SubtreeStyleChange && affectedByAttributeSelector(name.localName()))
- setNeedsStyleRecalc(LocalStyleChange);
+ if (inActiveDocument() && styleChangeType() < SubtreeStyleChange && affectedByAttributeSelector(name.localName()))
+ setNeedsStyleRecalc(LocalStyleChange);
- if (isUpgradedCustomElement())
- CustomElement::attributeDidChange(this, name.localName(), oldValue, newValue);
- }
+ if (isUpgradedCustomElement())
+ CustomElement::attributeDidChange(this, name.localName(), oldValue, newValue);
if (OwnPtr<MutationObserverInterestGroup> recipients = MutationObserverInterestGroup::createForAttributesMutation(*this, name))
recipients->enqueueMutationRecord(MutationRecord::createAttributes(this, name, oldValue));
« no previous file with comments | « no previous file | sky/tests/mutation-observer/observe-options-attributes.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698