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_HTMLTableColElement_h
7 : #define mozilla_dom_HTMLTableColElement_h
8 :
9 : #include "mozilla/Attributes.h"
10 : #include "nsGenericHTMLElement.h"
11 :
12 : namespace mozilla {
13 : namespace dom {
14 :
15 : class HTMLTableColElement final : public nsGenericHTMLElement
16 : {
17 : public:
18 0 : explicit HTMLTableColElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
19 0 : : nsGenericHTMLElement(aNodeInfo)
20 : {
21 0 : SetHasWeirdParserInsertionMode();
22 0 : }
23 :
24 0 : uint32_t Span() const
25 : {
26 0 : return GetIntAttr(nsGkAtoms::span, 1);
27 : }
28 0 : void SetSpan(uint32_t aSpan, ErrorResult& aError)
29 : {
30 0 : uint32_t span = aSpan ? aSpan : 1;
31 0 : SetUnsignedIntAttr(nsGkAtoms::span, span, 1, aError);
32 0 : }
33 :
34 0 : void GetAlign(DOMString& aAlign)
35 : {
36 0 : GetHTMLAttr(nsGkAtoms::align, aAlign);
37 0 : }
38 0 : void SetAlign(const nsAString& aAlign, ErrorResult& aError)
39 : {
40 0 : SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
41 0 : }
42 0 : void GetCh(DOMString& aCh)
43 : {
44 0 : GetHTMLAttr(nsGkAtoms::_char, aCh);
45 0 : }
46 0 : void SetCh(const nsAString& aCh, ErrorResult& aError)
47 : {
48 0 : SetHTMLAttr(nsGkAtoms::_char, aCh, aError);
49 0 : }
50 0 : void GetChOff(DOMString& aChOff)
51 : {
52 0 : GetHTMLAttr(nsGkAtoms::charoff, aChOff);
53 0 : }
54 0 : void SetChOff(const nsAString& aChOff, ErrorResult& aError)
55 : {
56 0 : SetHTMLAttr(nsGkAtoms::charoff, aChOff, aError);
57 0 : }
58 0 : void GetVAlign(DOMString& aVAlign)
59 : {
60 0 : GetHTMLAttr(nsGkAtoms::valign, aVAlign);
61 0 : }
62 0 : void SetVAlign(const nsAString& aVAlign, ErrorResult& aError)
63 : {
64 0 : SetHTMLAttr(nsGkAtoms::valign, aVAlign, aError);
65 0 : }
66 0 : void GetWidth(DOMString& aWidth)
67 : {
68 0 : GetHTMLAttr(nsGkAtoms::width, aWidth);
69 0 : }
70 0 : void SetWidth(const nsAString& aWidth, ErrorResult& aError)
71 : {
72 0 : SetHTMLAttr(nsGkAtoms::width, aWidth, aError);
73 0 : }
74 :
75 : virtual bool ParseAttribute(int32_t aNamespaceID,
76 : nsIAtom* aAttribute,
77 : const nsAString& aValue,
78 : nsAttrValue& aResult) override;
79 : nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
80 : NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const override;
81 :
82 : virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
83 : bool aPreallocateChildren) const override;
84 :
85 : protected:
86 : virtual ~HTMLTableColElement();
87 :
88 : virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
89 :
90 : private:
91 : static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
92 : GenericSpecifiedValues* aGenericData);
93 : };
94 :
95 : } // namespace dom
96 : } // namespace mozilla
97 :
98 : #endif /* mozilla_dom_HTMLTableColElement_h */
|