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 :
8 : #ifndef mozilla_dom_HTMLHRElement_h
9 : #define mozilla_dom_HTMLHRElement_h
10 :
11 : #include "nsGenericHTMLElement.h"
12 : #include "nsIDOMHTMLHRElement.h"
13 : #include "nsMappedAttributes.h"
14 : #include "nsAttrValueInlines.h"
15 : #include "nsRuleData.h"
16 :
17 : namespace mozilla {
18 : namespace dom {
19 :
20 : class HTMLHRElement final : public nsGenericHTMLElement,
21 : public nsIDOMHTMLHRElement
22 : {
23 : public:
24 : explicit HTMLHRElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
25 :
26 : // nsISupports
27 : NS_DECL_ISUPPORTS_INHERITED
28 :
29 : // nsIDOMHTMLHRElement
30 : NS_DECL_NSIDOMHTMLHRELEMENT
31 :
32 : virtual bool ParseAttribute(int32_t aNamespaceID,
33 : nsIAtom* aAttribute,
34 : const nsAString& aValue,
35 : nsAttrValue& aResult) override;
36 : NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
37 : virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
38 : virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
39 : bool aPreallocateChildren) const override;
40 :
41 : // WebIDL API
42 0 : void SetAlign(const nsAString& aAlign, ErrorResult& aError)
43 : {
44 0 : SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
45 0 : }
46 :
47 : // The XPCOM GetColor is OK for us
48 0 : void SetColor(const nsAString& aColor, ErrorResult& aError)
49 : {
50 0 : SetHTMLAttr(nsGkAtoms::color, aColor, aError);
51 0 : }
52 :
53 0 : bool NoShade() const
54 : {
55 0 : return GetBoolAttr(nsGkAtoms::noshade);
56 : }
57 0 : void SetNoShade(bool aNoShade, ErrorResult& aError)
58 : {
59 0 : SetHTMLBoolAttr(nsGkAtoms::noshade, aNoShade, aError);
60 0 : }
61 :
62 : // The XPCOM GetSize is OK for us
63 0 : void SetSize(const nsAString& aSize, ErrorResult& aError)
64 : {
65 0 : SetHTMLAttr(nsGkAtoms::size, aSize, aError);
66 0 : }
67 :
68 : // The XPCOM GetWidth is OK for us
69 0 : void SetWidth(const nsAString& aWidth, ErrorResult& aError)
70 : {
71 0 : SetHTMLAttr(nsGkAtoms::width, aWidth, aError);
72 0 : }
73 :
74 : protected:
75 : virtual ~HTMLHRElement();
76 :
77 : virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
78 :
79 : private:
80 : static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
81 : GenericSpecifiedValues* aGenericData);
82 : };
83 :
84 : } // namespace dom
85 : } // namespace mozilla
86 :
87 : #endif // mozilla_dom_HTMLHRElement_h
|