Index: Source/core/html/HTMLDataListOptionsCollection.h |
diff --git a/Source/core/html/HTMLDataListOptionsCollection.h b/Source/core/html/HTMLDataListOptionsCollection.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ccb9c57f9eaac320d858fb167fbd8e30b848e0da |
--- /dev/null |
+++ b/Source/core/html/HTMLDataListOptionsCollection.h |
@@ -0,0 +1,44 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef HTMLDataListOptionsCollection_h |
+#define HTMLDataListOptionsCollection_h |
+ |
+#include "core/html/HTMLCollection.h" |
+#include "core/html/HTMLOptionElement.h" |
+ |
+namespace blink { |
+ |
+class HTMLDataListOptionsCollection : public HTMLCollection { |
+public: |
+ static PassRefPtrWillBeRawPtr<HTMLDataListOptionsCollection> create(ContainerNode& ownerNode, CollectionType type) |
+ { |
+ ASSERT_UNUSED(type, type == DataListOptions); |
+ return adoptRefWillBeNoop(new HTMLDataListOptionsCollection(ownerNode)); |
+ } |
+ |
+ HTMLOptionElement* item(unsigned offset) const { return toHTMLOptionElement(HTMLCollection::item(offset)); } |
+ |
+ bool elementMatches(const HTMLElement&) const; |
+private: |
+ explicit HTMLDataListOptionsCollection(ContainerNode& ownerNode) |
+ : HTMLCollection(ownerNode, DataListOptions, DoesNotOverrideItemAfter) |
+ { } |
+}; |
+ |
+DEFINE_TYPE_CASTS(HTMLDataListOptionsCollection, LiveNodeListBase, collection, collection->type() == DataListOptions, collection.type() == DataListOptions); |
+ |
+inline bool HTMLDataListOptionsCollection::elementMatches(const HTMLElement& element) const |
+{ |
+ if (isHTMLOptionElement(element)) { |
+ const HTMLOptionElement& option = toHTMLOptionElement(element); |
+ if (!option.isDisabledFormControl() && !option.value().isEmpty()) |
+ return true; |
+ } |
+ return false; |
+} |
+ |
+} // namespace blink |
+ |
+#endif // HTMLDataListOptionsCollection_h |