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
9 #include "mozilla/Attributes.h"
10 #include "nsGenericHTMLElement.h"
12 namespace mozilla::dom
{
14 class HTMLTableColElement final
: public nsGenericHTMLElement
{
16 explicit HTMLTableColElement(
17 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
)
18 : nsGenericHTMLElement(std::move(aNodeInfo
)) {
19 SetHasWeirdParserInsertionMode();
22 uint32_t Span() const { return GetUnsignedIntAttr(nsGkAtoms::span
, 1); }
23 void SetSpan(uint32_t aSpan
, ErrorResult
& aError
) {
24 SetUnsignedIntAttr(nsGkAtoms::span
, aSpan
, 1, aError
);
27 void GetAlign(DOMString
& aAlign
) { GetHTMLAttr(nsGkAtoms::align
, aAlign
); }
28 void SetAlign(const nsAString
& aAlign
, ErrorResult
& aError
) {
29 SetHTMLAttr(nsGkAtoms::align
, aAlign
, aError
);
31 void GetCh(DOMString
& aCh
) { GetHTMLAttr(nsGkAtoms::_char
, aCh
); }
32 void SetCh(const nsAString
& aCh
, ErrorResult
& aError
) {
33 SetHTMLAttr(nsGkAtoms::_char
, aCh
, aError
);
35 void GetChOff(DOMString
& aChOff
) { GetHTMLAttr(nsGkAtoms::charoff
, aChOff
); }
36 void SetChOff(const nsAString
& aChOff
, ErrorResult
& aError
) {
37 SetHTMLAttr(nsGkAtoms::charoff
, aChOff
, aError
);
39 void GetVAlign(DOMString
& aVAlign
) {
40 GetHTMLAttr(nsGkAtoms::valign
, aVAlign
);
42 void SetVAlign(const nsAString
& aVAlign
, ErrorResult
& aError
) {
43 SetHTMLAttr(nsGkAtoms::valign
, aVAlign
, aError
);
45 void GetWidth(DOMString
& aWidth
) { GetHTMLAttr(nsGkAtoms::width
, aWidth
); }
46 void SetWidth(const nsAString
& aWidth
, ErrorResult
& aError
) {
47 SetHTMLAttr(nsGkAtoms::width
, aWidth
, aError
);
50 bool ParseAttribute(int32_t aNamespaceID
, nsAtom
* aAttribute
,
51 const nsAString
& aValue
,
52 nsIPrincipal
* aMaybeScriptedPrincipal
,
53 nsAttrValue
& aResult
) override
;
54 nsMapRuleToAttributesFunc
GetAttributeMappingFunction() const override
;
55 NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom
* aAttribute
) const override
;
57 nsresult
Clone(dom::NodeInfo
*, nsINode
** aResult
) const override
;
60 virtual ~HTMLTableColElement();
62 JSObject
* WrapNode(JSContext
*, JS::Handle
<JSObject
*> aGivenProto
) override
;
65 static void MapAttributesIntoRule(MappedDeclarationsBuilder
&);
68 } // namespace mozilla::dom
70 #endif /* mozilla_dom_HTMLTableColElement_h */