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 XULTextElement_h__
8 #define XULTextElement_h__
10 #include "nsXULElement.h"
12 namespace mozilla::dom
{
14 class XULTextElement final
: public nsXULElement
{
16 explicit XULTextElement(already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
)
17 : nsXULElement(std::move(aNodeInfo
)) {}
19 bool Disabled() { return GetXULBoolAttr(nsGkAtoms::disabled
); }
20 MOZ_CAN_RUN_SCRIPT
void SetDisabled(bool aValue
) {
21 SetXULBoolAttr(nsGkAtoms::disabled
, aValue
, mozilla::IgnoreErrors());
23 void GetValue(DOMString
& aValue
) const {
24 GetXULAttr(nsGkAtoms::value
, aValue
);
26 MOZ_CAN_RUN_SCRIPT
void SetValue(const nsAString
& aValue
) {
27 SetAttr(kNameSpaceID_None
, nsGkAtoms::value
, aValue
, true);
29 void GetAccessKey(DOMString
& aValue
) const {
30 GetXULAttr(nsGkAtoms::accesskey
, aValue
);
32 MOZ_CAN_RUN_SCRIPT
void SetAccessKey(const nsAString
& aValue
) {
33 SetAttr(kNameSpaceID_None
, nsGkAtoms::accesskey
, aValue
, true);
36 nsChangeHint
GetAttributeChangeHint(const nsAtom
* aAttribute
,
37 int32_t aModType
) const override
;
39 NS_IMPL_FROMNODE_HELPER(XULTextElement
,
40 IsAnyOfXULElements(nsGkAtoms::label
,
41 nsGkAtoms::description
));
44 virtual ~XULTextElement() = default;
45 JSObject
* WrapNode(JSContext
* aCx
, JS::Handle
<JSObject
*> aGivenProto
) final
;
48 } // namespace mozilla::dom
50 #endif // XULTextElement_h