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