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

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

Issue 337343002: IDL: make optional arguments (without default) explicit sometimes Base URL: https://chromium.googlesource.com/chromium/blink.git@idl-default-arguments-next
Patch Set: 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/DOMTokenList.h ('k') | Source/core/dom/Document.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/DOMTokenList.cpp
diff --git a/Source/core/dom/DOMTokenList.cpp b/Source/core/dom/DOMTokenList.cpp
index b434de742135c97e057c103ca3a1c70f0ba875c1..3f2482cf4a3b8ae742b8cd5f9d67ce95482de83e 100644
--- a/Source/core/dom/DOMTokenList.cpp
+++ b/Source/core/dom/DOMTokenList.cpp
@@ -121,30 +121,23 @@ void DOMTokenList::remove(const Vector<String>& tokens, ExceptionState& exceptio
setValue(removeTokens(value(), tokens));
}
-bool DOMTokenList::toggle(const AtomicString& token, ExceptionState& exceptionState)
+bool DOMTokenList::toggle(const AtomicString& token, Optional<bool> force, ExceptionState& exceptionState)
{
if (!validateToken(token, exceptionState))
return false;
if (containsInternal(token)) {
- removeInternal(token);
- return false;
- }
- addInternal(token);
- return true;
-}
-
-bool DOMTokenList::toggle(const AtomicString& token, bool force, ExceptionState& exceptionState)
-{
- if (!validateToken(token, exceptionState))
- return false;
-
- if (force)
+ if (force.isMissing() || !force.get()) {
+ removeInternal(token);
+ return false;
+ }
+ return true;
+ } else {
+ if (!force.isMissing() && !force.get())
+ return false;
addInternal(token);
- else
- removeInternal(token);
-
- return force;
+ return true;
+ }
}
void DOMTokenList::addInternal(const AtomicString& token)
« no previous file with comments | « Source/core/dom/DOMTokenList.h ('k') | Source/core/dom/Document.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698