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