Line data Source code
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
8 :
9 : #include "mozilla/Attributes.h"
10 : #include "nsGenericHTMLElement.h"
11 : #include "nsIDOMHTMLTableCellElement.h"
12 :
13 : namespace mozilla {
14 : namespace dom {
15 :
16 : class HTMLTableElement;
17 :
18 : class HTMLTableCellElement final : public nsGenericHTMLElement,
19 : public nsIDOMHTMLTableCellElement
20 : {
21 : public:
22 0 : explicit HTMLTableCellElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
23 0 : : nsGenericHTMLElement(aNodeInfo)
24 : {
25 0 : SetHasWeirdParserInsertionMode();
26 0 : }
27 :
28 : // nsISupports
29 : NS_DECL_ISUPPORTS_INHERITED
30 :
31 : // nsIDOMHTMLTableCellElement
32 : NS_DECL_NSIDOMHTMLTABLECELLELEMENT
33 :
34 0 : uint32_t ColSpan() const
35 : {
36 0 : return GetIntAttr(nsGkAtoms::colspan, 1);
37 : }
38 0 : void SetColSpan(uint32_t aColSpan, ErrorResult& aError)
39 : {
40 0 : SetUnsignedIntAttr(nsGkAtoms::colspan, aColSpan, 1, aError);
41 0 : }
42 0 : uint32_t RowSpan() const
43 : {
44 0 : return GetIntAttr(nsGkAtoms::rowspan, 1);
45 : }
46 0 : void SetRowSpan(uint32_t aRowSpan, ErrorResult& aError)
47 : {
48 0 : SetUnsignedIntAttr(nsGkAtoms::rowspan, aRowSpan, 1, aError);
49 0 : }
50 : //already_AddRefed<nsDOMTokenList> Headers() const;
51 0 : void GetHeaders(DOMString& aHeaders)
52 : {
53 0 : GetHTMLAttr(nsGkAtoms::headers, aHeaders);
54 0 : }
55 0 : void SetHeaders(const nsAString& aHeaders, ErrorResult& aError)
56 : {
57 0 : SetHTMLAttr(nsGkAtoms::headers, aHeaders, aError);
58 0 : }
59 : int32_t CellIndex() const;
60 :
61 0 : void GetAbbr(DOMString& aAbbr)
62 : {
63 0 : GetHTMLAttr(nsGkAtoms::abbr, aAbbr);
64 0 : }
65 0 : void SetAbbr(const nsAString& aAbbr, ErrorResult& aError)
66 : {
67 0 : SetHTMLAttr(nsGkAtoms::abbr, aAbbr, aError);
68 0 : }
69 : void GetScope(DOMString& aScope);
70 0 : void SetScope(const nsAString& aScope, ErrorResult& aError)
71 : {
72 0 : SetHTMLAttr(nsGkAtoms::scope, aScope, aError);
73 0 : }
74 : void GetAlign(DOMString& aAlign);
75 0 : void SetAlign(const nsAString& aAlign, ErrorResult& aError)
76 : {
77 0 : SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
78 0 : }
79 0 : void GetAxis(DOMString& aAxis)
80 : {
81 0 : GetHTMLAttr(nsGkAtoms::axis, aAxis);
82 0 : }
83 0 : void SetAxis(const nsAString& aAxis, ErrorResult& aError)
84 : {
85 0 : SetHTMLAttr(nsGkAtoms::axis, aAxis, aError);
86 0 : }
87 0 : void GetHeight(DOMString& aHeight)
88 : {
89 0 : GetHTMLAttr(nsGkAtoms::height, aHeight);
90 0 : }
91 0 : void SetHeight(const nsAString& aHeight, ErrorResult& aError)
92 : {
93 0 : SetHTMLAttr(nsGkAtoms::height, aHeight, aError);
94 0 : }
95 0 : void GetWidth(DOMString& aWidth)
96 : {
97 0 : GetHTMLAttr(nsGkAtoms::width, aWidth);
98 0 : }
99 0 : void SetWidth(const nsAString& aWidth, ErrorResult& aError)
100 : {
101 0 : SetHTMLAttr(nsGkAtoms::width, aWidth, aError);
102 0 : }
103 0 : void GetCh(DOMString& aCh)
104 : {
105 0 : GetHTMLAttr(nsGkAtoms::_char, aCh);
106 0 : }
107 0 : void SetCh(const nsAString& aCh, ErrorResult& aError)
108 : {
109 0 : SetHTMLAttr(nsGkAtoms::_char, aCh, aError);
110 0 : }
111 0 : void GetChOff(DOMString& aChOff)
112 : {
113 0 : GetHTMLAttr(nsGkAtoms::charoff, aChOff);
114 0 : }
115 0 : void SetChOff(const nsAString& aChOff, ErrorResult& aError)
116 : {
117 0 : SetHTMLAttr(nsGkAtoms::charoff, aChOff, aError);
118 0 : }
119 0 : bool NoWrap()
120 : {
121 0 : return GetBoolAttr(nsGkAtoms::nowrap);
122 : }
123 0 : void SetNoWrap(bool aNoWrap, ErrorResult& aError)
124 : {
125 0 : SetHTMLBoolAttr(nsGkAtoms::nowrap, aNoWrap, aError);
126 0 : }
127 0 : void GetVAlign(DOMString& aVAlign)
128 : {
129 0 : GetHTMLAttr(nsGkAtoms::valign, aVAlign);
130 0 : }
131 0 : void SetVAlign(const nsAString& aVAlign, ErrorResult& aError)
132 : {
133 0 : SetHTMLAttr(nsGkAtoms::valign, aVAlign, aError);
134 0 : }
135 0 : void GetBgColor(DOMString& aBgColor)
136 : {
137 0 : GetHTMLAttr(nsGkAtoms::bgcolor, aBgColor);
138 0 : }
139 0 : void SetBgColor(const nsAString& aBgColor, ErrorResult& aError)
140 : {
141 0 : SetHTMLAttr(nsGkAtoms::bgcolor, aBgColor, aError);
142 0 : }
143 :
144 : virtual bool ParseAttribute(int32_t aNamespaceID,
145 : nsIAtom* aAttribute,
146 : const nsAString& aValue,
147 : nsAttrValue& aResult) override;
148 : virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
149 : NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;
150 : NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
151 : // Get mapped attributes of ancestor table, if any
152 : nsMappedAttributes* GetMappedAttributesInheritedFromTable() const;
153 :
154 : virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
155 : bool aPreallocateChildren) const override;
156 :
157 : protected:
158 : virtual ~HTMLTableCellElement();
159 :
160 : virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
161 :
162 : HTMLTableElement* GetTable() const;
163 :
164 : HTMLTableRowElement* GetRow() const;
165 :
166 : private:
167 : static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
168 : GenericSpecifiedValues* aGenericData);
169 : };
170 :
171 : } // namespace dom
172 : } // namespace mozilla
173 :
174 : #endif /* mozilla_dom_HTMLTableCellElement_h */
|