Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / html / HTMLParagraphElement.cpp
blob19f732446d963afe45f8fc2bcead72633dc0f4cf
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/MappedDeclarationsBuilder.h"
11 #include "nsStyleConsts.h"
13 NS_IMPL_NS_NEW_HTML_ELEMENT(Paragraph)
15 namespace mozilla::dom {
17 HTMLParagraphElement::~HTMLParagraphElement() = default;
19 NS_IMPL_ELEMENT_CLONE(HTMLParagraphElement)
21 bool HTMLParagraphElement::ParseAttribute(int32_t aNamespaceID,
22 nsAtom* aAttribute,
23 const nsAString& aValue,
24 nsIPrincipal* aMaybeScriptedPrincipal,
25 nsAttrValue& aResult) {
26 if (aAttribute == nsGkAtoms::align && aNamespaceID == kNameSpaceID_None) {
27 return ParseDivAlignValue(aValue, aResult);
30 return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
31 aMaybeScriptedPrincipal, aResult);
34 void HTMLParagraphElement::MapAttributesIntoRule(
35 MappedDeclarationsBuilder& aBuilder) {
36 nsGenericHTMLElement::MapDivAlignAttributeInto(aBuilder);
37 nsGenericHTMLElement::MapCommonAttributesInto(aBuilder);
40 NS_IMETHODIMP_(bool)
41 HTMLParagraphElement::IsAttributeMapped(const nsAtom* aAttribute) const {
42 static const MappedAttributeEntry* const map[] = {
43 sDivAlignAttributeMap,
44 sCommonAttributeMap,
47 return FindAttributeDependence(aAttribute, map);
50 nsMapRuleToAttributesFunc HTMLParagraphElement::GetAttributeMappingFunction()
51 const {
52 return &MapAttributesIntoRule;
55 JSObject* HTMLParagraphElement::WrapNode(JSContext* aCx,
56 JS::Handle<JSObject*> aGivenProto) {
57 return HTMLParagraphElement_Binding::Wrap(aCx, this, aGivenProto);
60 } // namespace mozilla::dom