#define HTMLOptionsCollection_h
#include "core/html/HTMLCollection.h"
+#include "core/html/HTMLOptionElement.h"
-namespace WebCore {
+namespace blink {
class ExceptionState;
-class HTMLOptionElement;
-class HTMLSelectElement;
+class NodeListOrElement;
-class HTMLOptionsCollection FINAL : public HTMLCollection {
+class HTMLOptionsCollection final : public HTMLCollection {
+ DEFINE_WRAPPERTYPEINFO();
public:
- static PassRefPtr<HTMLOptionsCollection> create(ContainerNode&, CollectionType);
+ static PassRefPtrWillBeRawPtr<HTMLOptionsCollection> create(ContainerNode&, CollectionType);
- void add(PassRefPtr<HTMLOptionElement>, ExceptionState&);
- void add(PassRefPtr<HTMLOptionElement>, int index, ExceptionState&);
+ HTMLOptionElement* item(unsigned offset) const { return toHTMLOptionElement(HTMLCollection::item(offset)); }
+
+ void add(PassRefPtrWillBeRawPtr<HTMLOptionElement>, ExceptionState&);
+ void add(PassRefPtrWillBeRawPtr<HTMLOptionElement>, int index, ExceptionState&);
void remove(int index);
- void remove(HTMLOptionElement*);
int selectedIndex() const;
void setSelectedIndex(int);
void setLength(unsigned, ExceptionState&);
- void namedGetter(const AtomicString& name, bool&, RefPtr<NodeList>&, bool&, RefPtr<Element>&);
- bool anonymousIndexedSetter(unsigned, PassRefPtr<HTMLOptionElement>, ExceptionState&);
+ void namedGetter(const AtomicString& name, NodeListOrElement&);
+ bool anonymousIndexedSetter(unsigned, PassRefPtrWillBeRawPtr<HTMLOptionElement>, ExceptionState&);
+
+ bool elementMatches(const HTMLElement&) const;
private:
explicit HTMLOptionsCollection(ContainerNode&);
- virtual void supportedPropertyNames(Vector<String>& names) OVERRIDE;
+ virtual void supportedPropertyNames(Vector<String>& names) override;
};
-} //namespace
+DEFINE_TYPE_CASTS(HTMLOptionsCollection, LiveNodeListBase, collection, collection->type() == SelectOptions, collection.type() == SelectOptions);
+
+inline bool HTMLOptionsCollection::elementMatches(const HTMLElement& element) const
+{
+ return isHTMLOptionElement(element);
+}
+
+} // namespace blink
-#endif
+#endif // HTMLOptionsCollection_h