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

Unified Diff: Source/core/editing/ApplyStyleCommand.cpp

Issue 436603003: Make Element::attributes() less error-prone and simplify call sites (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Take feedback into consideration Created 6 years, 4 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 | « Source/core/dom/PresentationAttributeStyle.cpp ('k') | Source/core/editing/EditingStyle.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/ApplyStyleCommand.cpp
diff --git a/Source/core/editing/ApplyStyleCommand.cpp b/Source/core/editing/ApplyStyleCommand.cpp
index 64efc3a4f67c9e22b4c5364b9948d85ca1825d59..388e6870c2bae4a3d75fb9365102ba4f03ba95a4 100644
--- a/Source/core/editing/ApplyStyleCommand.cpp
+++ b/Source/core/editing/ApplyStyleCommand.cpp
@@ -76,7 +76,8 @@ bool isLegacyAppleStyleSpan(const Node* node)
static bool hasNoAttributeOrOnlyStyleAttribute(const HTMLElement* element, ShouldStyleAttributeBeEmpty shouldStyleAttributeBeEmpty)
{
- if (!element->hasAttributes())
+ AttributeCollection attributes = element->attributes();
+ if (attributes.isEmpty())
return true;
unsigned matchedAttributes = 0;
@@ -86,8 +87,8 @@ static bool hasNoAttributeOrOnlyStyleAttribute(const HTMLElement* element, Shoul
|| !element->inlineStyle() || element->inlineStyle()->isEmpty()))
matchedAttributes++;
- ASSERT(matchedAttributes <= element->attributes().size());
- return matchedAttributes == element->attributes().size();
+ ASSERT(matchedAttributes <= attributes.size());
+ return matchedAttributes == attributes.size();
}
bool isStyleSpanOrSpanWithOnlyStyleAttribute(const Element* element)
« no previous file with comments | « Source/core/dom/PresentationAttributeStyle.cpp ('k') | Source/core/editing/EditingStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698