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

Unified Diff: Source/core/dom/DOMTokenList.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: 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/DOMTokenList.cpp
diff --git a/Source/core/dom/DOMTokenList.cpp b/Source/core/dom/DOMTokenList.cpp
index 41255b2b1702a0eb8c39a168a21770f6785b6353..42d0ef7ee941b9f8ad0021e2cac038f27be46d37 100644
--- a/Source/core/dom/DOMTokenList.cpp
+++ b/Source/core/dom/DOMTokenList.cpp
@@ -32,7 +32,7 @@
namespace WebCore {
-bool DOMTokenList::validateToken(const AtomicString& token, ExceptionState& exceptionState)
+bool DOMTokenList::validateToken(const String& token, ExceptionState& exceptionState)
{
if (token.isEmpty()) {
exceptionState.throwDOMException(SyntaxError, "The token provided must not be empty.");
@@ -81,7 +81,7 @@ void DOMTokenList::add(const Vector<String>& tokens, ExceptionState& exceptionSt
for (size_t i = 0; i < tokens.size(); ++i) {
if (!validateToken(tokens[i], exceptionState))
return;
- if (containsInternal(tokens[i]))
+ if (containsInternal(AtomicString(tokens[i])))
continue;
if (filteredTokens.contains(tokens[i]))
continue;
@@ -110,7 +110,7 @@ void DOMTokenList::remove(const Vector<String>& tokens, ExceptionState& exceptio
// through the string character by character.
bool found = false;
for (size_t i = 0; i < tokens.size(); ++i) {
- if (containsInternal(tokens[i])) {
+ if (containsInternal(AtomicString(tokens[i]))) {
found = true;
break;
}
@@ -161,14 +161,14 @@ void DOMTokenList::removeInternal(const AtomicString& token)
setValue(removeToken(value(), token));
}
-String DOMTokenList::addToken(const AtomicString& input, const AtomicString& token)
+AtomicString DOMTokenList::addToken(const AtomicString& input, const AtomicString& token)
{
Vector<String> tokens;
tokens.append(token.string());
return addTokens(input, tokens);
}
-String DOMTokenList::addTokens(const AtomicString& input, const Vector<String>& tokens)
+AtomicString DOMTokenList::addTokens(const AtomicString& input, const Vector<String>& tokens)
{
bool needsSpace = false;
@@ -185,17 +185,17 @@ String DOMTokenList::addTokens(const AtomicString& input, const Vector<String>&
needsSpace = true;
}
- return builder.toString();
+ return builder.toAtomicString();
}
-String DOMTokenList::removeToken(const AtomicString& input, const AtomicString& token)
+AtomicString DOMTokenList::removeToken(const AtomicString& input, const AtomicString& token)
{
Vector<String> tokens;
tokens.append(token.string());
return removeTokens(input, tokens);
}
-String DOMTokenList::removeTokens(const AtomicString& input, const Vector<String>& tokens)
+AtomicString DOMTokenList::removeTokens(const AtomicString& input, const Vector<String>& tokens)
{
// Algorithm defined at http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#remove-a-token-from-a-string
// New spec is at http://dom.spec.whatwg.org/#remove-a-token-from-a-string
@@ -238,7 +238,7 @@ String DOMTokenList::removeTokens(const AtomicString& input, const Vector<String
}
}
- return output.toString();
+ return output.toAtomicString();
}
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698