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

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

Issue 485093003: Make it obvious an HTMLOptionsCollection can only contain HTMLOptionElements (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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/html/HTMLSelectElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLSelectElement.cpp
diff --git a/Source/core/html/HTMLSelectElement.cpp b/Source/core/html/HTMLSelectElement.cpp
index 371c14303d801521fb4d498053b744e261d0674d..906812120075f2065568cbede9200c54123b4cd9 100644
--- a/Source/core/html/HTMLSelectElement.cpp
+++ b/Source/core/html/HTMLSelectElement.cpp
@@ -225,7 +225,7 @@ void HTMLSelectElement::add(HTMLElement* element, HTMLElement* before, Exception
void HTMLSelectElement::addBeforeOptionAtIndex(HTMLElement* element, int beforeIndex, ExceptionState& exceptionState)
{
- HTMLElement* beforeElement = toHTMLElement(options()->item(beforeIndex));
+ HTMLOptionElement* beforeElement = options()->item(beforeIndex);
add(element, beforeElement, exceptionState);
}
@@ -452,7 +452,7 @@ Element* HTMLSelectElement::namedItem(const AtomicString& name)
return options()->namedItem(name);
}
-Element* HTMLSelectElement::item(unsigned index)
+HTMLOptionElement* HTMLSelectElement::item(unsigned index)
{
return options()->item(index);
}
@@ -462,13 +462,13 @@ void HTMLSelectElement::setOption(unsigned index, HTMLOptionElement* option, Exc
if (index > maxSelectItems - 1)
index = maxSelectItems - 1;
int diff = index - length();
- RefPtrWillBeRawPtr<HTMLElement> before = nullptr;
+ RefPtrWillBeRawPtr<HTMLOptionElement> before = nullptr;
// Out of array bounds? First insert empty dummies.
if (diff > 0) {
setLength(index, exceptionState);
// Replace an existing entry?
} else if (diff < 0) {
- before = toHTMLElement(options()->item(index+1));
+ before = options()->item(index + 1);
remove(index);
}
// Finally add the new element.
« no previous file with comments | « Source/core/html/HTMLSelectElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698