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

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

Issue 119533003: Clear mutable inline style when it is empty. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed typo. Created 7 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
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/editing/ApplyStyleCommand.cpp » ('j') | 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 ced2bd06440792fe0a24dbe5deac5b25b4f45e55..a4d2253ef8f179410d823cbbf79026283e95bf46 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -3432,8 +3432,9 @@ void Element::synchronizeStyleAttributeInternal() const
ASSERT(elementData());
ASSERT(elementData()->m_styleAttributeIsDirty);
elementData()->m_styleAttributeIsDirty = false;
- if (const StylePropertySet* inlineStyle = this->inlineStyle())
- const_cast<Element*>(this)->setSynchronizedLazyAttribute(styleAttr, inlineStyle->asText());
+ const StylePropertySet* inlineStyle = this->inlineStyle();
+ const_cast<Element*>(this)->setSynchronizedLazyAttribute(styleAttr,
+ inlineStyle ? AtomicString(inlineStyle->asText()) : nullAtom);
}
CSSStyleDeclaration* Element::style()
@@ -3456,6 +3457,13 @@ MutableStylePropertySet* Element::ensureMutableInlineStyle()
return toMutableStylePropertySet(inlineStyle);
}
+void Element::clearMutableInlineStyleIfEmpty()
+{
+ if (ensureMutableInlineStyle()->isEmpty()) {
+ ensureUniqueElementData()->m_inlineStyle.clear();
+ }
+}
+
PropertySetCSSStyleDeclaration* Element::inlineStyleCSSOMWrapper()
{
if (!inlineStyle() || !inlineStyle()->hasCSSOMWrapper())
@@ -3564,7 +3572,7 @@ bool Element::removeInlineStyleProperty(CSSPropertyID propertyID)
void Element::removeAllInlineStyleProperties()
{
ASSERT(isStyledElement());
- if (!inlineStyle() || inlineStyle()->isEmpty())
+ if (!inlineStyle())
return;
ensureMutableInlineStyle()->clear();
inlineStyleChanged();
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/editing/ApplyStyleCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698