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"
14 namespace mozilla::dom
{
16 class HTMLHRElement final
: public nsGenericHTMLElement
{
18 explicit HTMLHRElement(already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
);
21 NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLHRElement
, nsGenericHTMLElement
)
23 virtual bool ParseAttribute(int32_t aNamespaceID
, nsAtom
* aAttribute
,
24 const nsAString
& aValue
,
25 nsIPrincipal
* aMaybeScriptedPrincipal
,
26 nsAttrValue
& aResult
) override
;
27 NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom
* aAttribute
) const override
;
28 virtual nsMapRuleToAttributesFunc
GetAttributeMappingFunction()
30 virtual nsresult
Clone(dom::NodeInfo
*, nsINode
** aResult
) const override
;
33 void GetAlign(nsAString
& aValue
) const {
34 GetHTMLAttr(nsGkAtoms::align
, aValue
);
36 void SetAlign(const nsAString
& aAlign
, ErrorResult
& aError
) {
37 SetHTMLAttr(nsGkAtoms::align
, aAlign
, aError
);
40 void GetColor(nsAString
& aValue
) const {
41 GetHTMLAttr(nsGkAtoms::color
, aValue
);
43 void SetColor(const nsAString
& aColor
, ErrorResult
& aError
) {
44 SetHTMLAttr(nsGkAtoms::color
, aColor
, aError
);
47 bool NoShade() const { return GetBoolAttr(nsGkAtoms::noshade
); }
48 void SetNoShade(bool aNoShade
, ErrorResult
& aError
) {
49 SetHTMLBoolAttr(nsGkAtoms::noshade
, aNoShade
, aError
);
52 void GetSize(nsAString
& aValue
) const {
53 GetHTMLAttr(nsGkAtoms::size
, aValue
);
55 void SetSize(const nsAString
& aSize
, ErrorResult
& aError
) {
56 SetHTMLAttr(nsGkAtoms::size
, aSize
, aError
);
59 void GetWidth(nsAString
& aValue
) const {
60 GetHTMLAttr(nsGkAtoms::width
, aValue
);
62 void SetWidth(const nsAString
& aWidth
, ErrorResult
& aError
) {
63 SetHTMLAttr(nsGkAtoms::width
, aWidth
, aError
);
67 virtual ~HTMLHRElement();
69 virtual JSObject
* WrapNode(JSContext
* aCx
,
70 JS::Handle
<JSObject
*> aGivenProto
) override
;
73 static void MapAttributesIntoRule(const nsMappedAttributes
* aAttributes
,
77 } // namespace mozilla::dom
79 #endif // mozilla_dom_HTMLHRElement_h