Bug 1560374 - Set testharness and reftest web-platform-tests to Tier-1; r=jmaher...
[gecko.git] / dom / html / HTMLParagraphElement.cpp
blob4bfeb3750cfb438641484ca86c231f2435fb0b4f
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/HTMLParagraphElement.h"
8 #include "mozilla/dom/HTMLParagraphElementBinding.h"
10 #include "mozilla/MappedDeclarations.h"
11 #include "nsStyleConsts.h"
12 #include "nsMappedAttributes.h"
14 NS_IMPL_NS_NEW_HTML_ELEMENT(Paragraph)
16 namespace mozilla {
17 namespace dom {
19 HTMLParagraphElement::~HTMLParagraphElement() {}
21 NS_IMPL_ELEMENT_CLONE(HTMLParagraphElement)
23 bool HTMLParagraphElement::ParseAttribute(int32_t aNamespaceID,
24 nsAtom* aAttribute,
25 const nsAString& aValue,
26 nsIPrincipal* aMaybeScriptedPrincipal,
27 nsAttrValue& aResult) {
28 if (aAttribute == nsGkAtoms::align && aNamespaceID == kNameSpaceID_None) {
29 return ParseDivAlignValue(aValue, aResult);
32 return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
33 aMaybeScriptedPrincipal, aResult);
36 void HTMLParagraphElement::MapAttributesIntoRule(
37 const nsMappedAttributes* aAttributes, MappedDeclarations& aDecls) {
38 nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aDecls);
39 nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
42 NS_IMETHODIMP_(bool)
43 HTMLParagraphElement::IsAttributeMapped(const nsAtom* aAttribute) const {
44 static const MappedAttributeEntry* const map[] = {
45 sDivAlignAttributeMap,
46 sCommonAttributeMap,
49 return FindAttributeDependence(aAttribute, map);
52 nsMapRuleToAttributesFunc HTMLParagraphElement::GetAttributeMappingFunction()
53 const {
54 return &MapAttributesIntoRule;
57 JSObject* HTMLParagraphElement::WrapNode(JSContext* aCx,
58 JS::Handle<JSObject*> aGivenProto) {
59 return HTMLParagraphElement_Binding::Wrap(aCx, this, aGivenProto);
62 } // namespace dom
63 } // namespace mozilla