XULTextElement.h (1945B)
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 XULTextElement_h__ 8 #define XULTextElement_h__ 9 10 #include "nsXULElement.h" 11 12 namespace mozilla::dom { 13 14 class XULTextElement final : public nsXULElement { 15 public: 16 explicit XULTextElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) 17 : nsXULElement(std::move(aNodeInfo)) {} 18 19 bool Disabled() { return IsDisabled(); } 20 MOZ_CAN_RUN_SCRIPT void SetDisabled(bool aValue) { 21 SetBoolAttr(nsGkAtoms::disabled, aValue); 22 } 23 void GetValue(DOMString& aValue) const { 24 GetXULAttr(nsGkAtoms::value, aValue); 25 } 26 MOZ_CAN_RUN_SCRIPT void SetValue(const nsAString& aValue) { 27 SetAttr(kNameSpaceID_None, nsGkAtoms::value, aValue, true); 28 } 29 void GetAccessKey(DOMString& aValue) const { 30 GetXULAttr(nsGkAtoms::accesskey, aValue); 31 } 32 MOZ_CAN_RUN_SCRIPT void SetAccessKey(const nsAString& aValue) { 33 SetAttr(kNameSpaceID_None, nsGkAtoms::accesskey, aValue, true); 34 } 35 36 nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute, 37 AttrModType aModType) const override; 38 39 void AfterSetAttr(int32_t aNamespaceID, nsAtom* aName, 40 const nsAttrValue* aValue, const nsAttrValue* aOldValue, 41 nsIPrincipal* aSubjectPrincipal, bool aNotify) override; 42 43 NS_IMPL_FROMNODE_HELPER(XULTextElement, 44 IsAnyOfXULElements(nsGkAtoms::label, 45 nsGkAtoms::description)); 46 47 protected: 48 virtual ~XULTextElement() = default; 49 JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final; 50 }; 51 52 } // namespace mozilla::dom 53 54 #endif // XULTextElement_h