Bug 1795723 - Unified extensions UI should support High Contrast Mode. r=ayeddi,deskt...
[gecko.git] / dom / html / HTMLParagraphElement.cpp
blob9a4339003167b637b9c27072f3765c857229b9e0
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::dom {
18 HTMLParagraphElement::~HTMLParagraphElement() = default;
20 NS_IMPL_ELEMENT_CLONE(HTMLParagraphElement)
22 bool HTMLParagraphElement::ParseAttribute(int32_t aNamespaceID,
23 nsAtom* aAttribute,
24 const nsAString& aValue,
25 nsIPrincipal* aMaybeScriptedPrincipal,
26 nsAttrValue& aResult) {
27 if (aAttribute == nsGkAtoms::align && aNamespaceID == kNameSpaceID_None) {
28 return ParseDivAlignValue(aValue, aResult);
31 return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
32 aMaybeScriptedPrincipal, aResult);
35 void HTMLParagraphElement::MapAttributesIntoRule(
36 const nsMappedAttributes* aAttributes, MappedDeclarations& aDecls) {
37 nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aDecls);
38 nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
41 NS_IMETHODIMP_(bool)
42 HTMLParagraphElement::IsAttributeMapped(const nsAtom* aAttribute) const {
43 static const MappedAttributeEntry* const map[] = {
44 sDivAlignAttributeMap,
45 sCommonAttributeMap,
48 return FindAttributeDependence(aAttribute, map);
51 nsMapRuleToAttributesFunc HTMLParagraphElement::GetAttributeMappingFunction()
52 const {
53 return &MapAttributesIntoRule;
56 JSObject* HTMLParagraphElement::WrapNode(JSContext* aCx,
57 JS::Handle<JSObject*> aGivenProto) {
58 return HTMLParagraphElement_Binding::Wrap(aCx, this, aGivenProto);
61 } // namespace mozilla::dom