LCOV - code coverage report
Current view: top level - dom/html - HTMLDivElement.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 20 44 45.5 %
Date: 2017-07-14 16:53:18 Functions: 6 10 60.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #include "nsGenericHTMLElement.h"
       9             : #include "nsStyleConsts.h"
      10             : #include "nsMappedAttributes.h"
      11             : #include "mozilla/dom/HTMLDivElementBinding.h"
      12             : 
      13          78 : NS_IMPL_NS_NEW_HTML_ELEMENT(Div)
      14             : 
      15             : namespace mozilla {
      16             : namespace dom {
      17             : 
      18           0 : HTMLDivElement::~HTMLDivElement()
      19             : {
      20           0 : }
      21             : 
      22           0 : NS_IMPL_ELEMENT_CLONE(HTMLDivElement)
      23             : 
      24             : JSObject*
      25           2 : HTMLDivElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
      26             : {
      27           2 :   return dom::HTMLDivElementBinding::Wrap(aCx, this, aGivenProto);
      28             : }
      29             : 
      30             : bool
      31          31 : HTMLDivElement::ParseAttribute(int32_t aNamespaceID,
      32             :                                nsIAtom* aAttribute,
      33             :                                const nsAString& aValue,
      34             :                                nsAttrValue& aResult)
      35             : {
      36          31 :   if (aNamespaceID == kNameSpaceID_None) {
      37          29 :     if (mNodeInfo->Equals(nsGkAtoms::marquee)) {
      38           0 :       if ((aAttribute == nsGkAtoms::width) ||
      39           0 :           (aAttribute == nsGkAtoms::height)) {
      40           0 :         return aResult.ParseSpecialIntValue(aValue);
      41             :       }
      42           0 :       if (aAttribute == nsGkAtoms::bgcolor) {
      43           0 :         return aResult.ParseColor(aValue);
      44             :       }
      45           0 :       if ((aAttribute == nsGkAtoms::hspace) ||
      46           0 :           (aAttribute == nsGkAtoms::vspace)) {
      47           0 :         return aResult.ParseIntWithBounds(aValue, 0);
      48             :       }
      49             :     }
      50             : 
      51          58 :     if (mNodeInfo->Equals(nsGkAtoms::div) &&
      52          29 :         aAttribute == nsGkAtoms::align) {
      53           0 :       return ParseDivAlignValue(aValue, aResult);
      54             :     }
      55             :   }
      56             : 
      57          31 :   return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
      58          31 :                                               aResult);
      59             : }
      60             : 
      61             : void
      62          88 : HTMLDivElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
      63             :                                       GenericSpecifiedValues* aData)
      64             : {
      65          88 :   nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
      66          88 :   nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
      67          88 : }
      68             : 
      69             : static void
      70           0 : MapMarqueeAttributesIntoRule(const nsMappedAttributes* aAttributes, GenericSpecifiedValues* aData)
      71             : {
      72           0 :   nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
      73           0 :   nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
      74           0 :   nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
      75           0 :   nsGenericHTMLElement::MapBGColorInto(aAttributes, aData);
      76           0 : }
      77             : 
      78             : NS_IMETHODIMP_(bool)
      79          62 : HTMLDivElement::IsAttributeMapped(const nsIAtom* aAttribute) const
      80             : {
      81          62 :   if (mNodeInfo->Equals(nsGkAtoms::div)) {
      82             :     static const MappedAttributeEntry* const map[] = {
      83             :       sDivAlignAttributeMap,
      84             :       sCommonAttributeMap
      85             :     };
      86          62 :     return FindAttributeDependence(aAttribute, map);
      87             :   }
      88           0 :   if (mNodeInfo->Equals(nsGkAtoms::marquee)) {
      89             :     static const MappedAttributeEntry* const map[] = {
      90             :       sImageMarginSizeAttributeMap,
      91             :       sBackgroundColorAttributeMap,
      92             :       sCommonAttributeMap
      93             :     };
      94           0 :     return FindAttributeDependence(aAttribute, map);
      95             :   }
      96             : 
      97           0 :   return nsGenericHTMLElement::IsAttributeMapped(aAttribute);
      98             : }
      99             : 
     100             : nsMapRuleToAttributesFunc
     101          25 : HTMLDivElement::GetAttributeMappingFunction() const
     102             : {
     103          25 :   if (mNodeInfo->Equals(nsGkAtoms::div)) {
     104          25 :     return &MapAttributesIntoRule;
     105             :   }
     106           0 :   if (mNodeInfo->Equals(nsGkAtoms::marquee)) {
     107           0 :     return &MapMarqueeAttributesIntoRule;
     108             :   }
     109           0 :   return nsGenericHTMLElement::GetAttributeMappingFunction();
     110             : }
     111             : 
     112             : } // namespace dom
     113             : } // namespace mozilla

Generated by: LCOV version 1.13