LCOV - code coverage report
Current view: top level - dom/html - HTMLLIElement.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 31 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 16 0.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 "mozilla/dom/HTMLLIElement.h"
       8             : #include "mozilla/dom/HTMLLIElementBinding.h"
       9             : 
      10             : #include "mozilla/GenericSpecifiedValuesInlines.h"
      11             : #include "nsAttrValueInlines.h"
      12             : #include "nsGkAtoms.h"
      13             : #include "nsStyleConsts.h"
      14             : #include "nsMappedAttributes.h"
      15             : 
      16           0 : NS_IMPL_NS_NEW_HTML_ELEMENT(LI)
      17             : 
      18             : namespace mozilla {
      19             : namespace dom {
      20             : 
      21           0 : HTMLLIElement::~HTMLLIElement()
      22             : {
      23           0 : }
      24             : 
      25           0 : NS_IMPL_ISUPPORTS_INHERITED(HTMLLIElement, nsGenericHTMLElement,
      26             :                             nsIDOMHTMLLIElement)
      27             : 
      28           0 : NS_IMPL_ELEMENT_CLONE(HTMLLIElement)
      29             : 
      30           0 : NS_IMPL_STRING_ATTR(HTMLLIElement, Type, type)
      31           0 : NS_IMPL_INT_ATTR(HTMLLIElement, Value, value)
      32             : 
      33             : // values that are handled case-insensitively
      34             : static const nsAttrValue::EnumTable kUnorderedListItemTypeTable[] = {
      35             :   { "disc", NS_STYLE_LIST_STYLE_DISC },
      36             :   { "circle", NS_STYLE_LIST_STYLE_CIRCLE },
      37             :   { "round", NS_STYLE_LIST_STYLE_CIRCLE },
      38             :   { "square", NS_STYLE_LIST_STYLE_SQUARE },
      39             :   { nullptr, 0 }
      40             : };
      41             : 
      42             : // values that are handled case-sensitively
      43             : static const nsAttrValue::EnumTable kOrderedListItemTypeTable[] = {
      44             :   { "A", NS_STYLE_LIST_STYLE_UPPER_ALPHA },
      45             :   { "a", NS_STYLE_LIST_STYLE_LOWER_ALPHA },
      46             :   { "I", NS_STYLE_LIST_STYLE_UPPER_ROMAN },
      47             :   { "i", NS_STYLE_LIST_STYLE_LOWER_ROMAN },
      48             :   { "1", NS_STYLE_LIST_STYLE_DECIMAL },
      49             :   { nullptr, 0 }
      50             : };
      51             : 
      52             : bool
      53           0 : HTMLLIElement::ParseAttribute(int32_t aNamespaceID,
      54             :                               nsIAtom* aAttribute,
      55             :                               const nsAString& aValue,
      56             :                               nsAttrValue& aResult)
      57             : {
      58           0 :   if (aNamespaceID == kNameSpaceID_None) {
      59           0 :     if (aAttribute == nsGkAtoms::type) {
      60           0 :       return aResult.ParseEnumValue(aValue, kOrderedListItemTypeTable,
      61           0 :                                     true) ||
      62           0 :              aResult.ParseEnumValue(aValue, kUnorderedListItemTypeTable, false);
      63             :     }
      64           0 :     if (aAttribute == nsGkAtoms::value) {
      65           0 :       return aResult.ParseIntValue(aValue);
      66             :     }
      67             :   }
      68             : 
      69           0 :   return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
      70           0 :                                               aResult);
      71             : }
      72             : 
      73             : void
      74           0 : HTMLLIElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
      75             :                                      GenericSpecifiedValues* aData)
      76             : {
      77           0 :   if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(List))) {
      78           0 :     if (!aData->PropertyIsSet(eCSSProperty_list_style_type)) {
      79             :       // type: enum
      80           0 :       const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::type);
      81           0 :       if (value && value->Type() == nsAttrValue::eEnum)
      82           0 :         aData->SetKeywordValue(eCSSProperty_list_style_type, value->GetEnumValue());
      83             :     }
      84             :   }
      85             : 
      86           0 :   nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
      87           0 : }
      88             : 
      89             : NS_IMETHODIMP_(bool)
      90           0 : HTMLLIElement::IsAttributeMapped(const nsIAtom* aAttribute) const
      91             : {
      92             :   static const MappedAttributeEntry attributes[] = {
      93             :     { &nsGkAtoms::type },
      94             :     { nullptr },
      95             :   };
      96             : 
      97             :   static const MappedAttributeEntry* const map[] = {
      98             :     attributes,
      99             :     sCommonAttributeMap,
     100             :   };
     101             : 
     102           0 :   return FindAttributeDependence(aAttribute, map);
     103             : }
     104             : 
     105             : nsMapRuleToAttributesFunc
     106           0 : HTMLLIElement::GetAttributeMappingFunction() const
     107             : {
     108           0 :   return &MapAttributesIntoRule;
     109             : }
     110             : 
     111             : JSObject*
     112           0 : HTMLLIElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
     113             : {
     114           0 :   return HTMLLIElementBinding::Wrap(aCx, this, aGivenProto);
     115             : }
     116             : 
     117             : } // namespace dom
     118             : } // namespace mozilla

Generated by: LCOV version 1.13