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