Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 : #ifndef HTMLDataListElement_h___
7 : #define HTMLDataListElement_h___
8 :
9 : #include "mozilla/Attributes.h"
10 : #include "nsGenericHTMLElement.h"
11 : #include "nsContentList.h"
12 :
13 : namespace mozilla {
14 : namespace dom {
15 :
16 : class HTMLDataListElement final : public nsGenericHTMLElement
17 : {
18 : public:
19 0 : explicit HTMLDataListElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
20 0 : : nsGenericHTMLElement(aNodeInfo)
21 : {
22 0 : }
23 :
24 : // nsISupports
25 : NS_DECL_ISUPPORTS_INHERITED
26 :
27 0 : nsContentList* Options()
28 : {
29 0 : if (!mOptions) {
30 0 : mOptions = new nsContentList(this, MatchOptions, nullptr, nullptr, true);
31 : }
32 :
33 0 : return mOptions;
34 : }
35 :
36 :
37 : virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
38 : bool aPreallocateChildren) const override;
39 :
40 : // This function is used to generate the nsContentList (option elements).
41 : static bool MatchOptions(Element* aElement, int32_t aNamespaceID,
42 : nsIAtom* aAtom, void* aData);
43 :
44 0 : NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLDataListElement,
45 : nsGenericHTMLElement)
46 : protected:
47 : virtual ~HTMLDataListElement();
48 :
49 : virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
50 :
51 : // <option>'s list inside the datalist element.
52 : RefPtr<nsContentList> mOptions;
53 : };
54 :
55 : } // namespace dom
56 : } // namespace mozilla
57 :
58 : #endif /* HTMLDataListElement_h___ */
|