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