LCOV - code coverage report
Current view: top level - dom/html - HTMLBRElement.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 12 26 46.2 %
Date: 2017-07-14 16:53:18 Functions: 5 10 50.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/HTMLBRElement.h"
       8             : #include "mozilla/dom/HTMLBRElementBinding.h"
       9             : #include "mozilla/GenericSpecifiedValuesInlines.h"
      10             : #include "nsAttrValueInlines.h"
      11             : #include "nsStyleConsts.h"
      12             : #include "nsMappedAttributes.h"
      13             : 
      14             : 
      15           4 : NS_IMPL_NS_NEW_HTML_ELEMENT(BR)
      16             : 
      17             : namespace mozilla {
      18             : namespace dom {
      19             : 
      20           2 : HTMLBRElement::HTMLBRElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
      21           2 :   : nsGenericHTMLElement(aNodeInfo)
      22             : {
      23           2 : }
      24             : 
      25           0 : HTMLBRElement::~HTMLBRElement()
      26             : {
      27           0 : }
      28             : 
      29           0 : NS_IMPL_ELEMENT_CLONE(HTMLBRElement)
      30             : 
      31             : static const nsAttrValue::EnumTable kClearTable[] = {
      32             :   { "left", StyleClear::Left },
      33             :   { "right", StyleClear::Right },
      34             :   { "all", StyleClear::Both },
      35             :   { "both", StyleClear::Both },
      36             :   { nullptr, 0 }
      37             : };
      38             : 
      39             : bool
      40           4 : HTMLBRElement::ParseAttribute(int32_t aNamespaceID,
      41             :                               nsIAtom* aAttribute,
      42             :                               const nsAString& aValue,
      43             :                               nsAttrValue& aResult)
      44             : {
      45           4 :   if (aAttribute == nsGkAtoms::clear && aNamespaceID == kNameSpaceID_None) {
      46           0 :     return aResult.ParseEnumValue(aValue, kClearTable, false);
      47             :   }
      48             : 
      49           4 :   return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
      50           4 :                                               aResult);
      51             : }
      52             : 
      53             : void
      54           0 : HTMLBRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
      55             :                                      GenericSpecifiedValues* aData)
      56             : {
      57           0 :   if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Display))) {
      58           0 :     if (!aData->PropertyIsSet(eCSSProperty_clear)) {
      59           0 :       const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::clear);
      60           0 :       if (value && value->Type() == nsAttrValue::eEnum)
      61           0 :         aData->SetKeywordValue(eCSSProperty_clear, value->GetEnumValue());
      62             :     }
      63             :   }
      64             : 
      65           0 :   nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
      66           0 : }
      67             : 
      68             : NS_IMETHODIMP_(bool)
      69           4 : HTMLBRElement::IsAttributeMapped(const nsIAtom* aAttribute) const
      70             : {
      71             :   static const MappedAttributeEntry attributes[] = {
      72             :     { &nsGkAtoms::clear },
      73             :     { nullptr }
      74             :   };
      75             : 
      76             :   static const MappedAttributeEntry* const map[] = {
      77             :     attributes,
      78             :     sCommonAttributeMap,
      79             :   };
      80             : 
      81           4 :   return FindAttributeDependence(aAttribute, map);
      82             : }
      83             : 
      84             : nsMapRuleToAttributesFunc
      85           0 : HTMLBRElement::GetAttributeMappingFunction() const
      86             : {
      87           0 :   return &MapAttributesIntoRule;
      88             : }
      89             : 
      90             : JSObject*
      91           1 : HTMLBRElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
      92             : {
      93           1 :   return HTMLBRElementBinding::Wrap(aCx, this, aGivenProto);
      94             : }
      95             : 
      96             : } // namespace dom
      97             : } // namespace mozilla

Generated by: LCOV version 1.13