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_HTMLTableCaptionElement_h
7 #define mozilla_dom_HTMLTableCaptionElement_h
8 
9 #include "mozilla/Attributes.h"
10 #include "nsGenericHTMLElement.h"
11 
12 namespace mozilla {
13 namespace dom {
14 
15 class HTMLTableCaptionElement final : public nsGenericHTMLElement {
16  public:
HTMLTableCaptionElement(already_AddRefed<mozilla::dom::NodeInfo> && aNodeInfo)17   explicit HTMLTableCaptionElement(
18       already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
19       : nsGenericHTMLElement(std::move(aNodeInfo)) {
20     SetHasWeirdParserInsertionMode();
21   }
22 
GetAlign(DOMString & aAlign)23   void GetAlign(DOMString& aAlign) { GetHTMLAttr(nsGkAtoms::align, aAlign); }
SetAlign(const nsAString & aAlign,ErrorResult & aError)24   void SetAlign(const nsAString& aAlign, ErrorResult& aError) {
25     SetHTMLAttr(nsGkAtoms::align, aAlign, aError);
26   }
27 
28   virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
29                               const nsAString& aValue,
30                               nsIPrincipal* aMaybeScriptedPrincipal,
31                               nsAttrValue& aResult) override;
32   virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction()
33       const override;
34   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
35 
36   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
37 
38  protected:
39   virtual ~HTMLTableCaptionElement();
40 
41   virtual JSObject* WrapNode(JSContext* aCx,
42                              JS::Handle<JSObject*> aGivenProto) override;
43 
44  private:
45   static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
46                                     MappedDeclarations&);
47 };
48 
49 }  // namespace dom
50 }  // namespace mozilla
51 
52 #endif /* mozilla_dom_HTMLTableCaptionElement_h */
53