1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_dom_HTMLTableCellElement_h
6 #define mozilla_dom_HTMLTableCellElement_h
8 #include "mozilla/Attributes.h"
9 #include "nsGenericHTMLElement.h"
10 #include "nsIDOMHTMLTableCellElement.h"
12 class nsIDOMHTMLTableRowElement
;
17 class HTMLTableElement
;
19 class HTMLTableCellElement MOZ_FINAL
: public nsGenericHTMLElement
,
20 public nsIDOMHTMLTableCellElement
23 explicit HTMLTableCellElement(already_AddRefed
<mozilla::dom::NodeInfo
>& aNodeInfo
)
24 : nsGenericHTMLElement(aNodeInfo
)
26 SetHasWeirdParserInsertionMode();
30 NS_DECL_ISUPPORTS_INHERITED
32 // nsIDOMHTMLTableCellElement
33 NS_DECL_NSIDOMHTMLTABLECELLELEMENT
35 uint32_t ColSpan() const
37 return GetIntAttr(nsGkAtoms::colspan
, 1);
39 void SetColSpan(uint32_t aColSpan
, ErrorResult
& aError
)
41 SetHTMLIntAttr(nsGkAtoms::colspan
, aColSpan
, aError
);
43 uint32_t RowSpan() const
45 return GetIntAttr(nsGkAtoms::rowspan
, 1);
47 void SetRowSpan(uint32_t aRowSpan
, ErrorResult
& aError
)
49 SetHTMLIntAttr(nsGkAtoms::rowspan
, aRowSpan
, aError
);
51 //already_AddRefed<nsDOMSettableTokenList> Headers() const;
52 void GetHeaders(nsString
& aHeaders
)
54 GetHTMLAttr(nsGkAtoms::headers
, aHeaders
);
56 void SetHeaders(const nsAString
& aHeaders
, ErrorResult
& aError
)
58 SetHTMLAttr(nsGkAtoms::headers
, aHeaders
, aError
);
60 int32_t CellIndex() const;
62 void GetAbbr(nsString
& aAbbr
)
64 GetHTMLAttr(nsGkAtoms::abbr
, aAbbr
);
66 void SetAbbr(const nsAString
& aAbbr
, ErrorResult
& aError
)
68 SetHTMLAttr(nsGkAtoms::abbr
, aAbbr
, aError
);
70 void GetScope(nsString
& aScope
)
72 GetHTMLAttr(nsGkAtoms::scope
, aScope
);
74 void SetScope(const nsAString
& aScope
, ErrorResult
& aError
)
76 SetHTMLAttr(nsGkAtoms::scope
, aScope
, aError
);
78 void GetAlign(nsString
& aAlign
);
79 void SetAlign(const nsAString
& aAlign
, ErrorResult
& aError
)
81 SetHTMLAttr(nsGkAtoms::align
, aAlign
, aError
);
83 void GetAxis(nsString
& aAxis
)
85 GetHTMLAttr(nsGkAtoms::axis
, aAxis
);
87 void SetAxis(const nsAString
& aAxis
, ErrorResult
& aError
)
89 SetHTMLAttr(nsGkAtoms::axis
, aAxis
, aError
);
91 void GetHeight(nsString
& aHeight
)
93 GetHTMLAttr(nsGkAtoms::height
, aHeight
);
95 void SetHeight(const nsAString
& aHeight
, ErrorResult
& aError
)
97 SetHTMLAttr(nsGkAtoms::height
, aHeight
, aError
);
99 void GetWidth(nsString
& aWidth
)
101 GetHTMLAttr(nsGkAtoms::width
, aWidth
);
103 void SetWidth(const nsAString
& aWidth
, ErrorResult
& aError
)
105 SetHTMLAttr(nsGkAtoms::width
, aWidth
, aError
);
107 void GetCh(nsString
& aCh
)
109 GetHTMLAttr(nsGkAtoms::_char
, aCh
);
111 void SetCh(const nsAString
& aCh
, ErrorResult
& aError
)
113 SetHTMLAttr(nsGkAtoms::_char
, aCh
, aError
);
115 void GetChOff(nsString
& aChOff
)
117 GetHTMLAttr(nsGkAtoms::charoff
, aChOff
);
119 void SetChOff(const nsAString
& aChOff
, ErrorResult
& aError
)
121 SetHTMLAttr(nsGkAtoms::charoff
, aChOff
, aError
);
125 return GetBoolAttr(nsGkAtoms::nowrap
);
127 void SetNoWrap(bool aNoWrap
, ErrorResult
& aError
)
129 SetHTMLBoolAttr(nsGkAtoms::nowrap
, aNoWrap
, aError
);
131 void GetVAlign(nsString
& aVAlign
)
133 GetHTMLAttr(nsGkAtoms::valign
, aVAlign
);
135 void SetVAlign(const nsAString
& aVAlign
, ErrorResult
& aError
)
137 SetHTMLAttr(nsGkAtoms::valign
, aVAlign
, aError
);
139 void GetBgColor(nsString
& aBgColor
)
141 GetHTMLAttr(nsGkAtoms::bgcolor
, aBgColor
);
143 void SetBgColor(const nsAString
& aBgColor
, ErrorResult
& aError
)
145 SetHTMLAttr(nsGkAtoms::bgcolor
, aBgColor
, aError
);
148 virtual bool ParseAttribute(int32_t aNamespaceID
,
150 const nsAString
& aValue
,
151 nsAttrValue
& aResult
) MOZ_OVERRIDE
;
152 virtual nsMapRuleToAttributesFunc
GetAttributeMappingFunction() const MOZ_OVERRIDE
;
153 NS_IMETHOD
WalkContentStyleRules(nsRuleWalker
* aRuleWalker
) MOZ_OVERRIDE
;
154 NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom
* aAttribute
) const MOZ_OVERRIDE
;
156 virtual nsresult
Clone(mozilla::dom::NodeInfo
*aNodeInfo
, nsINode
**aResult
) const MOZ_OVERRIDE
;
159 virtual ~HTMLTableCellElement();
161 virtual JSObject
* WrapNode(JSContext
*aCx
) MOZ_OVERRIDE
;
163 HTMLTableElement
* GetTable() const;
165 HTMLTableRowElement
* GetRow() const;
168 static void MapAttributesIntoRule(const nsMappedAttributes
* aAttributes
,
173 } // namespace mozilla
175 #endif /* mozilla_dom_HTMLTableCellElement_h */