tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

HTMLDivElement.cpp (1974B)


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