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

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

Issue 112843002: Make calls to AtomicString(const String&) explicit in dom/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added comments 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
Index: Source/core/dom/DatasetDOMStringMap.cpp
diff --git a/Source/core/dom/DatasetDOMStringMap.cpp b/Source/core/dom/DatasetDOMStringMap.cpp
index f9cd4eec6d78473b65a590e135e358bb7f7c5228..14c082d5ec7fbcdbee0a3e6d0239f861338086ef 100644
--- a/Source/core/dom/DatasetDOMStringMap.cpp
+++ b/Source/core/dom/DatasetDOMStringMap.cpp
@@ -107,7 +107,9 @@ static bool isValidPropertyName(const String& name)
return true;
}
-static String convertPropertyNameToAttributeName(const String& name)
+// This returns an AtomicString because attribute names are always stored
+// as AtomicString types in Element (see setAttribute()).
+static AtomicString convertPropertyNameToAttributeName(const String& name)
{
StringBuilder builder;
builder.append("data-");
@@ -122,7 +124,7 @@ static String convertPropertyNameToAttributeName(const String& name)
builder.append(character);
}
- return builder.toString();
+ return builder.toAtomicString();
}
void DatasetDOMStringMap::ref()
@@ -185,13 +187,13 @@ void DatasetDOMStringMap::setItem(const String& name, const String& value, Excep
return;
}
- m_element->setAttribute(convertPropertyNameToAttributeName(name), value, exceptionState);
+ m_element->setAttribute(convertPropertyNameToAttributeName(name), AtomicString(value), exceptionState);
}
bool DatasetDOMStringMap::deleteItem(const String& name)
{
if (isValidPropertyName(name)) {
- String attributeName = convertPropertyNameToAttributeName(name);
+ AtomicString attributeName = convertPropertyNameToAttributeName(name);
if (m_element->hasAttribute(attributeName)) {
m_element->removeAttribute(attributeName);
return true;

Powered by Google App Engine
This is Rietveld 408576698