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 :
7 : #include "mozilla/dom/HTMLHeadingElement.h"
8 : #include "mozilla/dom/HTMLHeadingElementBinding.h"
9 :
10 : #include "mozilla/GenericSpecifiedValuesInlines.h"
11 : #include "nsGkAtoms.h"
12 : #include "nsStyleConsts.h"
13 : #include "nsMappedAttributes.h"
14 : #include "mozAutoDocUpdate.h"
15 :
16 0 : NS_IMPL_NS_NEW_HTML_ELEMENT(Heading)
17 :
18 : namespace mozilla {
19 : namespace dom {
20 :
21 0 : HTMLHeadingElement::~HTMLHeadingElement()
22 : {
23 0 : }
24 :
25 0 : NS_IMPL_ELEMENT_CLONE(HTMLHeadingElement)
26 :
27 : JSObject*
28 0 : HTMLHeadingElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
29 : {
30 0 : return HTMLHeadingElementBinding::Wrap(aCx, this, aGivenProto);
31 : }
32 :
33 : bool
34 0 : HTMLHeadingElement::ParseAttribute(int32_t aNamespaceID,
35 : nsIAtom* aAttribute,
36 : const nsAString& aValue,
37 : nsAttrValue& aResult)
38 : {
39 0 : if (aAttribute == nsGkAtoms::align && aNamespaceID == kNameSpaceID_None) {
40 0 : return ParseDivAlignValue(aValue, aResult);
41 : }
42 :
43 0 : return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
44 0 : aResult);
45 : }
46 :
47 : void
48 0 : HTMLHeadingElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
49 : GenericSpecifiedValues* aData)
50 : {
51 0 : nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
52 0 : nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
53 0 : }
54 :
55 : NS_IMETHODIMP_(bool)
56 0 : HTMLHeadingElement::IsAttributeMapped(const nsIAtom* aAttribute) const
57 : {
58 : static const MappedAttributeEntry* const map[] = {
59 : sDivAlignAttributeMap,
60 : sCommonAttributeMap
61 : };
62 :
63 0 : return FindAttributeDependence(aAttribute, map);
64 : }
65 :
66 :
67 : nsMapRuleToAttributesFunc
68 0 : HTMLHeadingElement::GetAttributeMappingFunction() const
69 : {
70 0 : return &MapAttributesIntoRule;
71 : }
72 :
73 : } // namespace dom
74 : } // namespace mozilla
|