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 "HTMLDivElement.h"
8 #include "nsGenericHTMLElement.h"
9 #include "nsStyleConsts.h"
10 #include "mozilla/dom/HTMLDivElementBinding.h"
12 NS_IMPL_NS_NEW_HTML_ELEMENT(Div
)
14 namespace mozilla::dom
{
16 HTMLDivElement::~HTMLDivElement() = default;
18 NS_IMPL_ELEMENT_CLONE(HTMLDivElement
)
20 JSObject
* HTMLDivElement::WrapNode(JSContext
* aCx
,
21 JS::Handle
<JSObject
*> aGivenProto
) {
22 return dom::HTMLDivElement_Binding::Wrap(aCx
, this, aGivenProto
);
25 bool HTMLDivElement::ParseAttribute(int32_t aNamespaceID
, nsAtom
* aAttribute
,
26 const nsAString
& aValue
,
27 nsIPrincipal
* aMaybeScriptedPrincipal
,
28 nsAttrValue
& aResult
) {
29 if (aNamespaceID
== kNameSpaceID_None
&& aAttribute
== nsGkAtoms::align
) {
30 return ParseDivAlignValue(aValue
, aResult
);
33 return nsGenericHTMLElement::ParseAttribute(aNamespaceID
, aAttribute
, aValue
,
34 aMaybeScriptedPrincipal
, aResult
);
37 void HTMLDivElement::MapAttributesIntoRule(
38 MappedDeclarationsBuilder
& aBuilder
) {
39 MapDivAlignAttributeInto(aBuilder
);
40 MapCommonAttributesInto(aBuilder
);
44 HTMLDivElement::IsAttributeMapped(const nsAtom
* aAttribute
) const {
45 static const MappedAttributeEntry
* const map
[] = {sDivAlignAttributeMap
,
47 return FindAttributeDependence(aAttribute
, map
);
50 nsMapRuleToAttributesFunc
HTMLDivElement::GetAttributeMappingFunction() const {
51 return &MapAttributesIntoRule
;
54 } // namespace mozilla::dom