LCOV - code coverage report
Current view: top level - dom/html - HTMLPreElement.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 29 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 14 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/HTMLPreElement.h"
       8             : #include "mozilla/dom/HTMLPreElementBinding.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(Pre)
      17             : 
      18             : namespace mozilla {
      19             : namespace dom {
      20             : 
      21           0 : HTMLPreElement::~HTMLPreElement()
      22             : {
      23           0 : }
      24             : 
      25           0 : NS_IMPL_ISUPPORTS_INHERITED(HTMLPreElement, nsGenericHTMLElement,
      26             :                             nsIDOMHTMLPreElement)
      27             : 
      28           0 : NS_IMPL_ELEMENT_CLONE(HTMLPreElement)
      29             : 
      30           0 : NS_IMPL_INT_ATTR(HTMLPreElement, Width, width)
      31             : 
      32             : bool
      33           0 : HTMLPreElement::ParseAttribute(int32_t aNamespaceID,
      34             :                                nsIAtom* aAttribute,
      35             :                                const nsAString& aValue,
      36             :                                nsAttrValue& aResult)
      37             : {
      38           0 :   if (aNamespaceID == kNameSpaceID_None) {
      39           0 :     if (aAttribute == nsGkAtoms::width) {
      40           0 :       return aResult.ParseIntValue(aValue);
      41             :     }
      42             :   }
      43             : 
      44           0 :   return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
      45           0 :                                               aResult);
      46             : }
      47             : 
      48             : void
      49           0 : HTMLPreElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
      50             :                                       GenericSpecifiedValues* aData)
      51             : {
      52           0 :   if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Text))) {
      53           0 :     if (!aData->PropertyIsSet(eCSSProperty_white_space)) {
      54             :       // wrap: empty
      55           0 :       if (aAttributes->GetAttr(nsGkAtoms::wrap))
      56           0 :         aData->SetKeywordValue(eCSSProperty_white_space, StyleWhiteSpace::PreWrap);
      57             :     }
      58             :   }
      59             : 
      60           0 :   nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
      61           0 : }
      62             : 
      63             : NS_IMETHODIMP_(bool)
      64           0 : HTMLPreElement::IsAttributeMapped(const nsIAtom* aAttribute) const
      65             : {
      66           0 :   if (!mNodeInfo->Equals(nsGkAtoms::pre)) {
      67           0 :     return nsGenericHTMLElement::IsAttributeMapped(aAttribute);
      68             :   }
      69             : 
      70             :   static const MappedAttributeEntry attributes[] = {
      71             :     { &nsGkAtoms::wrap },
      72             :     { nullptr },
      73             :   };
      74             : 
      75             :   static const MappedAttributeEntry* const map[] = {
      76             :     attributes,
      77             :     sCommonAttributeMap,
      78             :   };
      79             : 
      80           0 :   return FindAttributeDependence(aAttribute, map);
      81             : }
      82             : 
      83             : nsMapRuleToAttributesFunc
      84           0 : HTMLPreElement::GetAttributeMappingFunction() const
      85             : {
      86           0 :   if (!mNodeInfo->Equals(nsGkAtoms::pre)) {
      87           0 :     return nsGenericHTMLElement::GetAttributeMappingFunction();
      88             :   }
      89             : 
      90           0 :   return &MapAttributesIntoRule;
      91             : }
      92             : 
      93             : JSObject*
      94           0 : HTMLPreElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
      95             : {
      96           0 :   return HTMLPreElementBinding::Wrap(aCx, this, aGivenProto);
      97             : }
      98             : 
      99             : } // namespace dom
     100             : } // namespace mozilla

Generated by: LCOV version 1.13