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/. */
7 #ifndef mozilla_dom_HTMLHRElement_h
8 #define mozilla_dom_HTMLHRElement_h
10 #include "nsGenericHTMLElement.h"
11 #include "nsMappedAttributes.h"
12 #include "nsAttrValueInlines.h"
17 class HTMLHRElement final
: public nsGenericHTMLElement
{
19 explicit HTMLHRElement(already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
);
22 NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLHRElement
, nsGenericHTMLElement
)
24 virtual bool ParseAttribute(int32_t aNamespaceID
, nsAtom
* aAttribute
,
25 const nsAString
& aValue
,
26 nsIPrincipal
* aMaybeScriptedPrincipal
,
27 nsAttrValue
& aResult
) override
;
28 NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom
* aAttribute
) const override
;
29 virtual nsMapRuleToAttributesFunc
GetAttributeMappingFunction()
31 virtual nsresult
Clone(dom::NodeInfo
*, nsINode
** aResult
) const override
;
34 void GetAlign(nsAString
& aValue
) const {
35 GetHTMLAttr(nsGkAtoms::align
, aValue
);
37 void SetAlign(const nsAString
& aAlign
, ErrorResult
& aError
) {
38 SetHTMLAttr(nsGkAtoms::align
, aAlign
, aError
);
41 void GetColor(nsAString
& aValue
) const {
42 GetHTMLAttr(nsGkAtoms::color
, aValue
);
44 void SetColor(const nsAString
& aColor
, ErrorResult
& aError
) {
45 SetHTMLAttr(nsGkAtoms::color
, aColor
, aError
);
48 bool NoShade() const { return GetBoolAttr(nsGkAtoms::noshade
); }
49 void SetNoShade(bool aNoShade
, ErrorResult
& aError
) {
50 SetHTMLBoolAttr(nsGkAtoms::noshade
, aNoShade
, aError
);
53 void GetSize(nsAString
& aValue
) const {
54 GetHTMLAttr(nsGkAtoms::size
, aValue
);
56 void SetSize(const nsAString
& aSize
, ErrorResult
& aError
) {
57 SetHTMLAttr(nsGkAtoms::size
, aSize
, aError
);
60 void GetWidth(nsAString
& aValue
) const {
61 GetHTMLAttr(nsGkAtoms::width
, aValue
);
63 void SetWidth(const nsAString
& aWidth
, ErrorResult
& aError
) {
64 SetHTMLAttr(nsGkAtoms::width
, aWidth
, aError
);
68 virtual ~HTMLHRElement();
70 virtual JSObject
* WrapNode(JSContext
* aCx
,
71 JS::Handle
<JSObject
*> aGivenProto
) override
;
74 static void MapAttributesIntoRule(const nsMappedAttributes
* aAttributes
,
79 } // namespace mozilla
81 #endif // mozilla_dom_HTMLHRElement_h