HTMLOptGroupElement.h (2581B)
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 file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_HTMLOptGroupElement_h 8 #define mozilla_dom_HTMLOptGroupElement_h 9 10 #include "nsGenericHTMLElement.h" 11 12 namespace mozilla { 13 class ErrorResult; 14 class EventChainPreVisitor; 15 namespace dom { 16 17 class HTMLOptGroupElement final : public nsGenericHTMLElement { 18 public: 19 explicit HTMLOptGroupElement( 20 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo); 21 22 NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLOptGroupElement, optgroup) 23 24 // nsISupports 25 NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLOptGroupElement, 26 nsGenericHTMLElement) 27 28 // nsINode 29 void InsertChildBefore( 30 nsIContent* aKid, nsIContent* aBeforeThis, bool aNotify, ErrorResult& aRv, 31 nsINode* aOldParent = nullptr, 32 MutationEffectOnScript aMutationEffectOnScript = 33 MutationEffectOnScript::DropTrustWorthiness) override; 34 void RemoveChildNode( 35 nsIContent* aKid, bool aNotify, const BatchRemovalState* aState, 36 nsINode* aNewParent = nullptr, 37 MutationEffectOnScript aMutationEffectOnScript = 38 MutationEffectOnScript::DropTrustWorthiness) override; 39 40 // nsIContent 41 void GetEventTargetParent(EventChainPreVisitor& aVisitor) override; 42 43 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; 44 45 void AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName, 46 const nsAttrValue* aValue, const nsAttrValue* aOldValue, 47 nsIPrincipal* aSubjectPrincipal, bool aNotify) override; 48 49 bool Disabled() const { return GetBoolAttr(nsGkAtoms::disabled); } 50 void SetDisabled(bool aValue, ErrorResult& aError) { 51 SetHTMLBoolAttr(nsGkAtoms::disabled, aValue, aError); 52 } 53 54 void GetLabel(nsAString& aValue) const { 55 GetHTMLAttr(nsGkAtoms::label, aValue); 56 } 57 void SetLabel(const nsAString& aLabel, ErrorResult& aError) { 58 SetHTMLAttr(nsGkAtoms::label, aLabel, aError); 59 } 60 61 protected: 62 virtual ~HTMLOptGroupElement(); 63 64 JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override; 65 66 protected: 67 /** 68 * Get the select content element that contains this option 69 * @param aSelectElement the select element [OUT] 70 */ 71 Element* GetSelect(); 72 }; 73 74 } // namespace dom 75 } // namespace mozilla 76 77 #endif /* mozilla_dom_HTMLOptGroupElement_h */