Bug 1880216 - Migrate Fenix docs into Sphinx. r=owlish,geckoview-reviewers,android...
[gecko.git] / dom / html / HTMLTableCellElement.h
blobcdf61f89288a2fef7357d5ac13b863dc8eeeaf42
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_HTMLTableCellElement_h
7 #define mozilla_dom_HTMLTableCellElement_h
9 #include "mozilla/Attributes.h"
10 #include "nsGenericHTMLElement.h"
12 namespace mozilla::dom {
14 class HTMLTableElement;
16 class HTMLTableCellElement final : public nsGenericHTMLElement {
17 public:
18 explicit HTMLTableCellElement(
19 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
20 : nsGenericHTMLElement(std::move(aNodeInfo)) {
21 SetHasWeirdParserInsertionMode();
24 // nsISupports
25 NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLTableCellElement,
26 nsGenericHTMLElement)
28 NS_IMPL_FROMNODE_HELPER(HTMLTableCellElement,
29 IsAnyOfHTMLElements(nsGkAtoms::td, nsGkAtoms::th))
31 uint32_t ColSpan() const { return GetUnsignedIntAttr(nsGkAtoms::colspan, 1); }
32 void SetColSpan(uint32_t aColSpan, ErrorResult& aError) {
33 SetUnsignedIntAttr(nsGkAtoms::colspan, aColSpan, 1, aError);
35 uint32_t RowSpan() const { return GetUnsignedIntAttr(nsGkAtoms::rowspan, 1); }
36 void SetRowSpan(uint32_t aRowSpan, ErrorResult& aError) {
37 SetUnsignedIntAttr(nsGkAtoms::rowspan, aRowSpan, 1, aError);
39 // already_AddRefed<nsDOMTokenList> Headers() const;
40 void GetHeaders(DOMString& aHeaders) {
41 GetHTMLAttr(nsGkAtoms::headers, aHeaders);
43 void SetHeaders(const nsAString& aHeaders, ErrorResult& aError) {
44 SetHTMLAttr(nsGkAtoms::headers, aHeaders, aError);
46 int32_t CellIndex() const;
48 void GetAbbr(DOMString& aAbbr) { GetHTMLAttr(nsGkAtoms::abbr, aAbbr); }
49 void SetAbbr(const nsAString& aAbbr, ErrorResult& aError) {
50 SetHTMLAttr(nsGkAtoms::abbr, aAbbr, aError);
52 void GetScope(DOMString& aScope);
53 void SetScope(const nsAString& aScope, ErrorResult& aError) {
54 SetHTMLAttr(nsGkAtoms::scope, aScope, aError);
56 void GetAlign(DOMString& aAlign);
57 void SetAlign(const nsAString& aAlign, ErrorResult& aError) {
58 SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
60 void GetAxis(DOMString& aAxis) { GetHTMLAttr(nsGkAtoms::axis, aAxis); }
61 void SetAxis(const nsAString& aAxis, ErrorResult& aError) {
62 SetHTMLAttr(nsGkAtoms::axis, aAxis, aError);
64 void GetHeight(DOMString& aHeight) {
65 GetHTMLAttr(nsGkAtoms::height, aHeight);
67 void SetHeight(const nsAString& aHeight, ErrorResult& aError) {
68 SetHTMLAttr(nsGkAtoms::height, aHeight, aError);
70 void GetWidth(DOMString& aWidth) { GetHTMLAttr(nsGkAtoms::width, aWidth); }
71 void SetWidth(const nsAString& aWidth, ErrorResult& aError) {
72 SetHTMLAttr(nsGkAtoms::width, aWidth, aError);
74 void GetCh(DOMString& aCh) { GetHTMLAttr(nsGkAtoms::_char, aCh); }
75 void SetCh(const nsAString& aCh, ErrorResult& aError) {
76 SetHTMLAttr(nsGkAtoms::_char, aCh, aError);
78 void GetChOff(DOMString& aChOff) { GetHTMLAttr(nsGkAtoms::charoff, aChOff); }
79 void SetChOff(const nsAString& aChOff, ErrorResult& aError) {
80 SetHTMLAttr(nsGkAtoms::charoff, aChOff, aError);
82 bool NoWrap() { return GetBoolAttr(nsGkAtoms::nowrap); }
83 void SetNoWrap(bool aNoWrap, ErrorResult& aError) {
84 SetHTMLBoolAttr(nsGkAtoms::nowrap, aNoWrap, aError);
86 void GetVAlign(DOMString& aVAlign) {
87 GetHTMLAttr(nsGkAtoms::valign, aVAlign);
89 void SetVAlign(const nsAString& aVAlign, ErrorResult& aError) {
90 SetHTMLAttr(nsGkAtoms::valign, aVAlign, aError);
92 void GetBgColor(DOMString& aBgColor) {
93 GetHTMLAttr(nsGkAtoms::bgcolor, aBgColor);
95 void SetBgColor(const nsAString& aBgColor, ErrorResult& aError) {
96 SetHTMLAttr(nsGkAtoms::bgcolor, aBgColor, aError);
99 bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
100 const nsAString& aValue,
101 nsIPrincipal* aMaybeScriptedPrincipal,
102 nsAttrValue& aResult) override;
103 nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
104 NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
105 // Get mapped attributes of ancestor table, if any
106 StyleLockedDeclarationBlock* GetMappedAttributesInheritedFromTable() const;
108 nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
110 protected:
111 virtual ~HTMLTableCellElement();
113 JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override;
115 HTMLTableElement* GetTable() const;
117 HTMLTableRowElement* GetRow() const;
119 private:
120 static void MapAttributesIntoRule(MappedDeclarationsBuilder&);
123 } // namespace mozilla::dom
125 #endif /* mozilla_dom_HTMLTableCellElement_h */