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

Unified Diff: Source/core/html/HTMLOptionsCollection.cpp

Issue 716773002: Use union types for HTMLSelectElement.add()'s arguments (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: added FIXME Created 6 years, 1 month 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/html/HTMLOptionsCollection.h ('k') | Source/core/html/HTMLOptionsCollection.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLOptionsCollection.cpp
diff --git a/Source/core/html/HTMLOptionsCollection.cpp b/Source/core/html/HTMLOptionsCollection.cpp
index 672737edffb5a535c6d092e3af26952a507d9a1a..3899f43ad62a06d3571591977bc65c9f4f5a7ff9 100644
--- a/Source/core/html/HTMLOptionsCollection.cpp
+++ b/Source/core/html/HTMLOptionsCollection.cpp
@@ -69,33 +69,9 @@ PassRefPtrWillBeRawPtr<HTMLOptionsCollection> HTMLOptionsCollection::create(Cont
return adoptRefWillBeNoop(new HTMLOptionsCollection(select));
}
-void HTMLOptionsCollection::add(PassRefPtrWillBeRawPtr<HTMLOptionElement> element, ExceptionState& exceptionState)
+void HTMLOptionsCollection::add(const HTMLOptionElementOrHTMLOptGroupElement& element, const HTMLElementOrLong& before, ExceptionState& exceptionState)
{
- add(element, length(), exceptionState);
-}
-
-void HTMLOptionsCollection::add(PassRefPtrWillBeRawPtr<HTMLOptionElement> element, int index, ExceptionState& exceptionState)
-{
- HTMLOptionElement* newOption = element.get();
-
- if (!newOption) {
- exceptionState.throwTypeError("The element provided was not an HTMLOptionElement.");
- return;
- }
-
- if (index < -1) {
- exceptionState.throwDOMException(IndexSizeError, "The index provided (" + String::number(index) + ") is less than -1.");
- return;
- }
-
- HTMLSelectElement& select = toHTMLSelectElement(ownerNode());
-
- if (index == -1 || unsigned(index) >= length())
- select.add(newOption, 0, exceptionState);
- else
- select.addBeforeOptionAtIndex(newOption, index, exceptionState);
-
- ASSERT(!exceptionState.hadException());
+ toHTMLSelectElement(ownerNode()).add(element, before, exceptionState);
}
void HTMLOptionsCollection::remove(int index)
« no previous file with comments | « Source/core/html/HTMLOptionsCollection.h ('k') | Source/core/html/HTMLOptionsCollection.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698