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
9 #include "mozilla/Attributes.h"
10 #include "nsGenericHTMLElement.h"
14 namespace mozilla::dom
{
16 class HTMLTableSectionElement
;
18 class HTMLTableRowElement final
: public nsGenericHTMLElement
{
20 explicit HTMLTableRowElement(
21 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
)
22 : nsGenericHTMLElement(std::move(aNodeInfo
)) {
23 SetHasWeirdParserInsertionMode();
26 NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLTableRowElement
, tr
)
29 NS_DECL_ISUPPORTS_INHERITED
31 int32_t RowIndex() const;
32 int32_t SectionRowIndex() const;
33 nsIHTMLCollection
* Cells();
34 already_AddRefed
<nsGenericHTMLElement
> InsertCell(int32_t aIndex
,
36 void DeleteCell(int32_t aValue
, ErrorResult
& aError
);
38 void GetAlign(DOMString
& aAlign
) { GetHTMLAttr(nsGkAtoms::align
, aAlign
); }
39 void SetAlign(const nsAString
& aAlign
, ErrorResult
& aError
) {
40 SetHTMLAttr(nsGkAtoms::align
, aAlign
, aError
);
42 void GetCh(DOMString
& aCh
) { GetHTMLAttr(nsGkAtoms::_char
, aCh
); }
43 void SetCh(const nsAString
& aCh
, ErrorResult
& aError
) {
44 SetHTMLAttr(nsGkAtoms::_char
, aCh
, aError
);
46 void GetChOff(DOMString
& aChOff
) { GetHTMLAttr(nsGkAtoms::charoff
, aChOff
); }
47 void SetChOff(const nsAString
& aChOff
, ErrorResult
& aError
) {
48 SetHTMLAttr(nsGkAtoms::charoff
, aChOff
, aError
);
50 void GetVAlign(DOMString
& aVAlign
) {
51 GetHTMLAttr(nsGkAtoms::valign
, aVAlign
);
53 void SetVAlign(const nsAString
& aVAlign
, ErrorResult
& aError
) {
54 SetHTMLAttr(nsGkAtoms::valign
, aVAlign
, aError
);
56 void GetBgColor(DOMString
& aBgColor
) {
57 GetHTMLAttr(nsGkAtoms::bgcolor
, aBgColor
);
59 void SetBgColor(const nsAString
& aBgColor
, ErrorResult
& aError
) {
60 SetHTMLAttr(nsGkAtoms::bgcolor
, aBgColor
, aError
);
63 virtual bool ParseAttribute(int32_t aNamespaceID
, nsAtom
* aAttribute
,
64 const nsAString
& aValue
,
65 nsIPrincipal
* aMaybeScriptedPrincipal
,
66 nsAttrValue
& aResult
) override
;
67 virtual nsMapRuleToAttributesFunc
GetAttributeMappingFunction()
69 NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom
* aAttribute
) const override
;
71 virtual nsresult
Clone(dom::NodeInfo
*, nsINode
** aResult
) const override
;
73 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLTableRowElement
,
77 virtual ~HTMLTableRowElement();
79 virtual JSObject
* WrapNode(JSContext
* aCx
,
80 JS::Handle
<JSObject
*> aGivenProto
) override
;
82 HTMLTableSectionElement
* GetSection() const;
83 HTMLTableElement
* GetTable() const;
84 RefPtr
<nsContentList
> mCells
;
87 static void MapAttributesIntoRule(MappedDeclarationsBuilder
&);
90 } // namespace mozilla::dom
92 #endif /* mozilla_dom_HTMLTableRowElement_h */