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