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 #ifndef mozilla_dom_HTMLTableSectionElement_h 7 #define mozilla_dom_HTMLTableSectionElement_h 8 9 #include "mozilla/Attributes.h" 10 #include "nsGenericHTMLElement.h" 11 #include "nsContentList.h" // For ctor. 12 13 namespace mozilla { 14 namespace dom { 15 16 class HTMLTableSectionElement final : public nsGenericHTMLElement { 17 public: HTMLTableSectionElement(already_AddRefed<mozilla::dom::NodeInfo> && aNodeInfo)18 explicit HTMLTableSectionElement( 19 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) 20 : nsGenericHTMLElement(std::move(aNodeInfo)) { 21 SetHasWeirdParserInsertionMode(); 22 } 23 24 // nsISupports 25 NS_DECL_ISUPPORTS_INHERITED 26 27 nsIHTMLCollection* Rows(); 28 already_AddRefed<nsGenericHTMLElement> InsertRow(int32_t aIndex, 29 ErrorResult& aError); 30 void DeleteRow(int32_t aValue, ErrorResult& aError); 31 GetAlign(DOMString & aAlign)32 void GetAlign(DOMString& aAlign) { GetHTMLAttr(nsGkAtoms::align, aAlign); } SetAlign(const nsAString & aAlign,ErrorResult & aError)33 void SetAlign(const nsAString& aAlign, ErrorResult& aError) { 34 SetHTMLAttr(nsGkAtoms::align, aAlign, aError); 35 } GetCh(DOMString & aCh)36 void GetCh(DOMString& aCh) { GetHTMLAttr(nsGkAtoms::_char, aCh); } SetCh(const nsAString & aCh,ErrorResult & aError)37 void SetCh(const nsAString& aCh, ErrorResult& aError) { 38 SetHTMLAttr(nsGkAtoms::_char, aCh, aError); 39 } GetChOff(DOMString & aChOff)40 void GetChOff(DOMString& aChOff) { GetHTMLAttr(nsGkAtoms::charoff, aChOff); } SetChOff(const nsAString & aChOff,ErrorResult & aError)41 void SetChOff(const nsAString& aChOff, ErrorResult& aError) { 42 SetHTMLAttr(nsGkAtoms::charoff, aChOff, aError); 43 } GetVAlign(DOMString & aVAlign)44 void GetVAlign(DOMString& aVAlign) { 45 GetHTMLAttr(nsGkAtoms::valign, aVAlign); 46 } SetVAlign(const nsAString & aVAlign,ErrorResult & aError)47 void SetVAlign(const nsAString& aVAlign, ErrorResult& aError) { 48 SetHTMLAttr(nsGkAtoms::valign, aVAlign, aError); 49 } 50 51 virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute, 52 const nsAString& aValue, 53 nsIPrincipal* aMaybeScriptedPrincipal, 54 nsAttrValue& aResult) override; 55 virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() 56 const override; 57 NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override; 58 59 virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override; 60 61 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLTableSectionElement, 62 nsGenericHTMLElement) 63 protected: 64 virtual ~HTMLTableSectionElement(); 65 66 virtual JSObject* WrapNode(JSContext* aCx, 67 JS::Handle<JSObject*> aGivenProto) override; 68 69 RefPtr<nsContentList> mRows; 70 71 private: 72 static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, 73 MappedDeclarations&); 74 }; 75 76 } // namespace dom 77 } // namespace mozilla 78 79 #endif /* mozilla_dom_HTMLTableSectionElement_h */ 80