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

Side by Side Diff: Source/core/html/HTMLDataListOptionsCollection.h

Issue 488763002: Introduce HTMLDataListOptionsCollection subclass for HTMLCollection (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef HTMLDataListOptionsCollection_h
6 #define HTMLDataListOptionsCollection_h
7
8 #include "core/html/HTMLCollection.h"
9 #include "core/html/HTMLOptionElement.h"
10
11 namespace blink {
12
13 class HTMLDataListOptionsCollection : public HTMLCollection {
14 public:
15 static PassRefPtrWillBeRawPtr<HTMLDataListOptionsCollection> create(Containe rNode& ownerNode, CollectionType type)
16 {
17 ASSERT_UNUSED(type, type == DataListOptions);
18 return adoptRefWillBeNoop(new HTMLDataListOptionsCollection(ownerNode));
19 }
20
21 HTMLOptionElement* item(unsigned offset) const { return toHTMLOptionElement( HTMLCollection::item(offset)); }
22
23 bool elementMatches(const HTMLElement&) const;
24 private:
25 explicit HTMLDataListOptionsCollection(ContainerNode& ownerNode)
26 : HTMLCollection(ownerNode, DataListOptions, DoesNotOverrideItemAfter)
27 { }
28 };
29
30 DEFINE_TYPE_CASTS(HTMLDataListOptionsCollection, LiveNodeListBase, collection, c ollection->type() == DataListOptions, collection.type() == DataListOptions);
31
32 inline bool HTMLDataListOptionsCollection::elementMatches(const HTMLElement& ele ment) const
33 {
34 if (isHTMLOptionElement(element)) {
35 const HTMLOptionElement& option = toHTMLOptionElement(element);
36 if (!option.isDisabledFormControl() && !option.value().isEmpty())
37 return true;
38 }
39 return false;
40 }
41
42 } // namespace blink
43
44 #endif // HTMLDataListOptionsCollection_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698