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/. */
7 #include "mozilla/dom/HTMLHeadingElement.h"
8 #include "mozilla/dom/HTMLHeadingElementBinding.h"
10 #include "mozilla/MappedDeclarations.h"
11 #include "nsGkAtoms.h"
12 #include "nsStyleConsts.h"
13 #include "nsMappedAttributes.h"
14 #include "mozAutoDocUpdate.h"
16 NS_IMPL_NS_NEW_HTML_ELEMENT(Heading
)
21 HTMLHeadingElement::~HTMLHeadingElement()
25 NS_IMPL_ELEMENT_CLONE(HTMLHeadingElement
)
28 HTMLHeadingElement::WrapNode(JSContext
*aCx
, JS::Handle
<JSObject
*> aGivenProto
)
30 return HTMLHeadingElement_Binding::Wrap(aCx
, this, aGivenProto
);
34 HTMLHeadingElement::ParseAttribute(int32_t aNamespaceID
,
36 const nsAString
& aValue
,
37 nsIPrincipal
* aMaybeScriptedPrincipal
,
40 if (aAttribute
== nsGkAtoms::align
&& aNamespaceID
== kNameSpaceID_None
) {
41 return ParseDivAlignValue(aValue
, aResult
);
44 return nsGenericHTMLElement::ParseAttribute(aNamespaceID
, aAttribute
, aValue
,
45 aMaybeScriptedPrincipal
, aResult
);
49 HTMLHeadingElement::MapAttributesIntoRule(const nsMappedAttributes
* aAttributes
,
50 MappedDeclarations
& aDecls
)
52 nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes
, aDecls
);
53 nsGenericHTMLElement::MapCommonAttributesInto(aAttributes
, aDecls
);
57 HTMLHeadingElement::IsAttributeMapped(const nsAtom
* aAttribute
) const
59 static const MappedAttributeEntry
* const map
[] = {
60 sDivAlignAttributeMap
,
64 return FindAttributeDependence(aAttribute
, map
);
68 nsMapRuleToAttributesFunc
69 HTMLHeadingElement::GetAttributeMappingFunction() const
71 return &MapAttributesIntoRule
;
75 } // namespace mozilla