LCOV - code coverage report
Current view: top level - dom/html - HTMLTableColElement.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 38 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 9 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/HTMLTableColElement.h"
       8             : #include "mozilla/dom/HTMLTableColElementBinding.h"
       9             : #include "nsMappedAttributes.h"
      10             : #include "nsAttrValueInlines.h"
      11             : #include "mozilla/GenericSpecifiedValuesInlines.h"
      12             : 
      13           0 : NS_IMPL_NS_NEW_HTML_ELEMENT(TableCol)
      14             : 
      15             : namespace mozilla {
      16             : namespace dom {
      17             : 
      18             : // use the same protection as ancient code did
      19             : // http://lxr.mozilla.org/classic/source/lib/layout/laytable.c#46
      20             : #define MAX_COLSPAN 1000
      21             : 
      22           0 : HTMLTableColElement::~HTMLTableColElement()
      23             : {
      24           0 : }
      25             : 
      26             : JSObject*
      27           0 : HTMLTableColElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
      28             : {
      29           0 :   return HTMLTableColElementBinding::Wrap(aCx, this, aGivenProto);
      30             : }
      31             : 
      32           0 : NS_IMPL_ELEMENT_CLONE(HTMLTableColElement)
      33             : 
      34             : bool
      35           0 : HTMLTableColElement::ParseAttribute(int32_t aNamespaceID,
      36             :                                     nsIAtom* aAttribute,
      37             :                                     const nsAString& aValue,
      38             :                                     nsAttrValue& aResult)
      39             : {
      40           0 :   if (aNamespaceID == kNameSpaceID_None) {
      41             :     /* ignore these attributes, stored simply as strings ch */
      42           0 :     if (aAttribute == nsGkAtoms::charoff) {
      43           0 :       return aResult.ParseSpecialIntValue(aValue);
      44             :     }
      45           0 :     if (aAttribute == nsGkAtoms::span) {
      46             :       /* protection from unrealistic large colspan values */
      47           0 :       aResult.ParseIntWithFallback(aValue, 1, MAX_COLSPAN);
      48           0 :       return true;
      49             :     }
      50           0 :     if (aAttribute == nsGkAtoms::width) {
      51           0 :       return aResult.ParseSpecialIntValue(aValue);
      52             :     }
      53           0 :     if (aAttribute == nsGkAtoms::align) {
      54           0 :       return ParseTableCellHAlignValue(aValue, aResult);
      55             :     }
      56           0 :     if (aAttribute == nsGkAtoms::valign) {
      57           0 :       return ParseTableVAlignValue(aValue, aResult);
      58             :     }
      59             :   }
      60             : 
      61           0 :   return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
      62           0 :                                               aResult);
      63             : }
      64             : 
      65             : void
      66           0 : HTMLTableColElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
      67             :                                            GenericSpecifiedValues* aData)
      68             : {
      69           0 :   if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Table))) {
      70           0 :     if (!aData->PropertyIsSet(eCSSProperty__x_span)) {
      71             :       // span: int
      72           0 :       const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::span);
      73           0 :       if (value && value->Type() == nsAttrValue::eInteger) {
      74           0 :         int32_t val = value->GetIntegerValue();
      75             :         // Note: Do NOT use this code for table cells!  The value "0"
      76             :         // means something special for colspan and rowspan, but for <col
      77             :         // span> and <colgroup span> it's just disallowed.
      78           0 :         if (val > 0) {
      79           0 :           aData->SetIntValue(eCSSProperty__x_span, value->GetIntegerValue());
      80             :         }
      81             :       }
      82             :     }
      83             :   }
      84             : 
      85           0 :   nsGenericHTMLElement::MapWidthAttributeInto(aAttributes, aData);
      86           0 :   nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
      87           0 :   nsGenericHTMLElement::MapVAlignAttributeInto(aAttributes, aData);
      88           0 :   nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
      89           0 : }
      90             : 
      91             : NS_IMETHODIMP_(bool)
      92           0 : HTMLTableColElement::IsAttributeMapped(const nsIAtom* aAttribute) const
      93             : {
      94             :   static const MappedAttributeEntry attributes[] = {
      95             :     { &nsGkAtoms::width },
      96             :     { &nsGkAtoms::align },
      97             :     { &nsGkAtoms::valign },
      98             :     { &nsGkAtoms::span },
      99             :     { nullptr }
     100             :   };
     101             : 
     102             :   static const MappedAttributeEntry* const map[] = {
     103             :     attributes,
     104             :     sCommonAttributeMap,
     105             :   };
     106             : 
     107           0 :   return FindAttributeDependence(aAttribute, map);
     108             : }
     109             : 
     110             : 
     111             : nsMapRuleToAttributesFunc
     112           0 : HTMLTableColElement::GetAttributeMappingFunction() const
     113             : {
     114           0 :   return &MapAttributesIntoRule;
     115             : }
     116             : 
     117             : } // namespace dom
     118             : } // namespace mozilla

Generated by: LCOV version 1.13