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

Unified Diff: third_party/WebKit/Source/core/dom/DOMTokenList.cpp

Issue 1411123004: Handle extra whitespaces in the DOM token list (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « third_party/WebKit/LayoutTests/fast/dom/HTMLOutputElement/script-tests/dom-settable-token-list.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/DOMTokenList.cpp
diff --git a/third_party/WebKit/Source/core/dom/DOMTokenList.cpp b/third_party/WebKit/Source/core/dom/DOMTokenList.cpp
index 4f5db64270ea2043c719fd634ae4c52e428f297c..3c2134386b14557251f47af219628e4f7a627268 100644
--- a/third_party/WebKit/Source/core/dom/DOMTokenList.cpp
+++ b/third_party/WebKit/Source/core/dom/DOMTokenList.cpp
@@ -242,7 +242,7 @@ AtomicString DOMTokenList::removeTokens(const AtomicString& input, const Vector<
// Step 5
while (position < inputLength) {
if (isHTMLSpace<UChar>(input[position])) { // 6
- output.append(input[position++]); // 6.1, 6.2
+ position++;
continue; // 6.3
}
@@ -263,15 +263,18 @@ AtomicString DOMTokenList::removeTokens(const AtomicString& input, const Vector<
while (j > 0 && isHTMLSpace<UChar>(output[j - 1]))
--j;
output.resize(j);
-
- // Step 8.3
- if (position < inputLength && !output.isEmpty())
- output.append(' ');
} else {
output.append(token); // Step 9
}
+
+ if (position < inputLength && !output.isEmpty())
+ output.append(' ');
}
+ size_t j = output.length();
+ if (j > 0 && isHTMLSpace<UChar>(output[j - 1]))
+ output.resize(j - 1);
+
return output.toAtomicString();
}
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/HTMLOutputElement/script-tests/dom-settable-token-list.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698