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 :
7 : #ifndef mozilla_dom_HTMLSharedListElement_h
8 : #define mozilla_dom_HTMLSharedListElement_h
9 :
10 : #include "mozilla/Attributes.h"
11 :
12 : #include "nsIDOMHTMLOListElement.h"
13 : #include "nsIDOMHTMLUListElement.h"
14 : #include "nsGenericHTMLElement.h"
15 :
16 : namespace mozilla {
17 : namespace dom {
18 :
19 : class HTMLSharedListElement final : public nsGenericHTMLElement,
20 : public nsIDOMHTMLOListElement,
21 : public nsIDOMHTMLUListElement
22 : {
23 : public:
24 1 : explicit HTMLSharedListElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
25 1 : : nsGenericHTMLElement(aNodeInfo)
26 : {
27 1 : }
28 :
29 : // nsISupports
30 : NS_DECL_ISUPPORTS_INHERITED
31 :
32 : // nsIDOMHTMLOListElement
33 : NS_DECL_NSIDOMHTMLOLISTELEMENT
34 :
35 : // nsIDOMHTMLUListElement
36 : // fully declared by NS_DECL_NSIDOMHTMLOLISTELEMENT
37 :
38 : virtual bool ParseAttribute(int32_t aNamespaceID,
39 : nsIAtom* aAttribute,
40 : const nsAString& aValue,
41 : nsAttrValue& aResult) override;
42 : virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
43 : NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
44 : virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
45 : bool aPreallocateChildren) const override;
46 :
47 0 : bool Reversed() const
48 : {
49 0 : return GetBoolAttr(nsGkAtoms::reversed);
50 : }
51 0 : void SetReversed(bool aReversed, mozilla::ErrorResult& rv)
52 : {
53 0 : SetHTMLBoolAttr(nsGkAtoms::reversed, aReversed, rv);
54 0 : }
55 0 : int32_t Start() const
56 : {
57 0 : return GetIntAttr(nsGkAtoms::start, 1);
58 : }
59 0 : void SetStart(int32_t aStart, mozilla::ErrorResult& rv)
60 : {
61 0 : SetHTMLIntAttr(nsGkAtoms::start, aStart, rv);
62 0 : }
63 0 : void GetType(DOMString& aType)
64 : {
65 0 : GetHTMLAttr(nsGkAtoms::type, aType);
66 0 : }
67 0 : void SetType(const nsAString& aType, mozilla::ErrorResult& rv)
68 : {
69 0 : SetHTMLAttr(nsGkAtoms::type, aType, rv);
70 0 : }
71 0 : bool Compact() const
72 : {
73 0 : return GetBoolAttr(nsGkAtoms::compact);
74 : }
75 0 : void SetCompact(bool aCompact, mozilla::ErrorResult& rv)
76 : {
77 0 : SetHTMLBoolAttr(nsGkAtoms::compact, aCompact, rv);
78 0 : }
79 :
80 : protected:
81 : virtual ~HTMLSharedListElement();
82 :
83 : virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
84 :
85 : private:
86 : static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
87 : GenericSpecifiedValues* aGenericData);
88 : };
89 :
90 : } // namespace dom
91 : } // namespace mozilla
92 :
93 : #endif // mozilla_dom_HTMLSharedListElement_h
|