LCOV - code coverage report
Current view: top level - parser/html - nsHtml5StackNode.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 56 114 49.1 %
Date: 2017-07-14 16:53:18 Functions: 10 21 47.6 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2007 Henri Sivonen
       3             :  * Copyright (c) 2007-2011 Mozilla Foundation
       4             :  *
       5             :  * Permission is hereby granted, free of charge, to any person obtaining a
       6             :  * copy of this software and associated documentation files (the "Software"),
       7             :  * to deal in the Software without restriction, including without limitation
       8             :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
       9             :  * and/or sell copies of the Software, and to permit persons to whom the
      10             :  * Software is furnished to do so, subject to the following conditions:
      11             :  *
      12             :  * The above copyright notice and this permission notice shall be included in
      13             :  * all copies or substantial portions of the Software.
      14             :  *
      15             :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      16             :  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      17             :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      18             :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      19             :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      20             :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      21             :  * DEALINGS IN THE SOFTWARE.
      22             :  */
      23             : 
      24             : /*
      25             :  * THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
      26             :  * Please edit StackNode.java instead and regenerate.
      27             :  */
      28             : 
      29             : #define nsHtml5StackNode_cpp__
      30             : 
      31             : #include "nsIAtom.h"
      32             : #include "nsHtml5AtomTable.h"
      33             : #include "nsHtml5String.h"
      34             : #include "nsNameSpaceManager.h"
      35             : #include "nsIContent.h"
      36             : #include "nsTraceRefcnt.h"
      37             : #include "jArray.h"
      38             : #include "nsHtml5ArrayCopy.h"
      39             : #include "nsAHtml5TreeBuilderState.h"
      40             : #include "nsGkAtoms.h"
      41             : #include "nsHtml5ByteReadable.h"
      42             : #include "nsHtml5Macros.h"
      43             : #include "nsIContentHandle.h"
      44             : #include "nsHtml5Portability.h"
      45             : 
      46             : #include "nsHtml5AttributeName.h"
      47             : #include "nsHtml5ElementName.h"
      48             : #include "nsHtml5Tokenizer.h"
      49             : #include "nsHtml5TreeBuilder.h"
      50             : #include "nsHtml5MetaScanner.h"
      51             : #include "nsHtml5UTF16Buffer.h"
      52             : #include "nsHtml5StateSnapshot.h"
      53             : #include "nsHtml5Portability.h"
      54             : 
      55             : #include "nsHtml5StackNode.h"
      56             : 
      57             : int32_t 
      58           2 : nsHtml5StackNode::getGroup()
      59             : {
      60           2 :   return flags & nsHtml5ElementName::GROUP_MASK;
      61             : }
      62             : 
      63             : bool 
      64           0 : nsHtml5StackNode::isScoping()
      65             : {
      66           0 :   return (flags & nsHtml5ElementName::SCOPING);
      67             : }
      68             : 
      69             : bool 
      70           0 : nsHtml5StackNode::isSpecial()
      71             : {
      72           0 :   return (flags & nsHtml5ElementName::SPECIAL);
      73             : }
      74             : 
      75             : bool 
      76           8 : nsHtml5StackNode::isFosterParenting()
      77             : {
      78           8 :   return (flags & nsHtml5ElementName::FOSTER_PARENTING);
      79             : }
      80             : 
      81             : bool 
      82           0 : nsHtml5StackNode::isHtmlIntegrationPoint()
      83             : {
      84           0 :   return (flags & nsHtml5ElementName::HTML_INTEGRATION_POINT);
      85             : }
      86             : 
      87          18 : nsHtml5StackNode::nsHtml5StackNode(int32_t idxInTreeBuilder)
      88             :   : idxInTreeBuilder(idxInTreeBuilder)
      89          18 :   , refcount(0)
      90             : {
      91          18 :   MOZ_COUNT_CTOR(nsHtml5StackNode);
      92          18 : }
      93             : 
      94             : void
      95          20 : nsHtml5StackNode::setValues(int32_t flags,
      96             :                             int32_t ns,
      97             :                             nsIAtom* name,
      98             :                             nsIContentHandle* node,
      99             :                             nsIAtom* popName,
     100             :                             nsHtml5HtmlAttributes* attributes)
     101             : {
     102          20 :   MOZ_ASSERT(isUnused());
     103          20 :   this->flags = flags;
     104          20 :   this->name = name;
     105          20 :   this->popName = popName;
     106          20 :   this->ns = ns;
     107          20 :   this->node = node;
     108          20 :   this->attributes = attributes;
     109          20 :   this->refcount = 1;
     110          20 : }
     111             : 
     112             : void
     113           6 : nsHtml5StackNode::setValues(nsHtml5ElementName* elementName,
     114             :                             nsIContentHandle* node)
     115             : {
     116           6 :   MOZ_ASSERT(isUnused());
     117           6 :   this->flags = elementName->getFlags();
     118           6 :   this->name = elementName->getName();
     119           6 :   this->popName = elementName->getName();
     120           6 :   this->ns = kNameSpaceID_XHTML;
     121           6 :   this->node = node;
     122           6 :   this->attributes = nullptr;
     123           6 :   this->refcount = 1;
     124           6 :   MOZ_ASSERT(elementName->isInterned(),
     125             :              "Don't use this constructor for custom elements.");
     126           6 : }
     127             : 
     128             : void
     129           0 : nsHtml5StackNode::setValues(nsHtml5ElementName* elementName,
     130             :                             nsIContentHandle* node,
     131             :                             nsHtml5HtmlAttributes* attributes)
     132             : {
     133           0 :   MOZ_ASSERT(isUnused());
     134           0 :   this->flags = elementName->getFlags();
     135           0 :   this->name = elementName->getName();
     136           0 :   this->popName = elementName->getName();
     137           0 :   this->ns = kNameSpaceID_XHTML;
     138           0 :   this->node = node;
     139           0 :   this->attributes = attributes;
     140           0 :   this->refcount = 1;
     141           0 :   MOZ_ASSERT(elementName->isInterned(),
     142             :              "Don't use this constructor for custom elements.");
     143           0 : }
     144             : 
     145             : void
     146           6 : nsHtml5StackNode::setValues(nsHtml5ElementName* elementName,
     147             :                             nsIContentHandle* node,
     148             :                             nsIAtom* popName)
     149             : {
     150           6 :   MOZ_ASSERT(isUnused());
     151           6 :   this->flags = elementName->getFlags();
     152           6 :   this->name = elementName->getName();
     153           6 :   this->popName = popName;
     154           6 :   this->ns = kNameSpaceID_XHTML;
     155           6 :   this->node = node;
     156           6 :   this->attributes = nullptr;
     157           6 :   this->refcount = 1;
     158           6 : }
     159             : 
     160             : void
     161           0 : nsHtml5StackNode::setValues(nsHtml5ElementName* elementName,
     162             :                             nsIAtom* popName,
     163             :                             nsIContentHandle* node)
     164             : {
     165           0 :   MOZ_ASSERT(isUnused());
     166           0 :   this->flags = prepareSvgFlags(elementName->getFlags());
     167           0 :   this->name = elementName->getName();
     168           0 :   this->popName = popName;
     169           0 :   this->ns = kNameSpaceID_SVG;
     170           0 :   this->node = node;
     171           0 :   this->attributes = nullptr;
     172           0 :   this->refcount = 1;
     173           0 : }
     174             : 
     175             : void
     176           0 : nsHtml5StackNode::setValues(nsHtml5ElementName* elementName,
     177             :                             nsIContentHandle* node,
     178             :                             nsIAtom* popName,
     179             :                             bool markAsIntegrationPoint)
     180             : {
     181           0 :   MOZ_ASSERT(isUnused());
     182           0 :   this->flags =
     183           0 :     prepareMathFlags(elementName->getFlags(), markAsIntegrationPoint);
     184           0 :   this->name = elementName->getName();
     185           0 :   this->popName = popName;
     186           0 :   this->ns = kNameSpaceID_MathML;
     187           0 :   this->node = node;
     188           0 :   this->attributes = nullptr;
     189           0 :   this->refcount = 1;
     190           0 : }
     191             : 
     192             : int32_t 
     193           0 : nsHtml5StackNode::prepareSvgFlags(int32_t flags)
     194             : {
     195           0 :   flags &=
     196             :     ~(nsHtml5ElementName::FOSTER_PARENTING | nsHtml5ElementName::SCOPING |
     197             :       nsHtml5ElementName::SPECIAL | nsHtml5ElementName::OPTIONAL_END_TAG);
     198           0 :   if ((flags & nsHtml5ElementName::SCOPING_AS_SVG)) {
     199           0 :     flags |= (nsHtml5ElementName::SCOPING | nsHtml5ElementName::SPECIAL |
     200             :               nsHtml5ElementName::HTML_INTEGRATION_POINT);
     201             :   }
     202           0 :   return flags;
     203             : }
     204             : 
     205             : int32_t 
     206           0 : nsHtml5StackNode::prepareMathFlags(int32_t flags, bool markAsIntegrationPoint)
     207             : {
     208           0 :   flags &=
     209             :     ~(nsHtml5ElementName::FOSTER_PARENTING | nsHtml5ElementName::SCOPING |
     210             :       nsHtml5ElementName::SPECIAL | nsHtml5ElementName::OPTIONAL_END_TAG);
     211           0 :   if ((flags & nsHtml5ElementName::SCOPING_AS_MATHML)) {
     212           0 :     flags |= (nsHtml5ElementName::SCOPING | nsHtml5ElementName::SPECIAL);
     213             :   }
     214           0 :   if (markAsIntegrationPoint) {
     215           0 :     flags |= nsHtml5ElementName::HTML_INTEGRATION_POINT;
     216             :   }
     217           0 :   return flags;
     218             : }
     219             : 
     220             : 
     221          26 : nsHtml5StackNode::~nsHtml5StackNode()
     222             : {
     223          13 :   MOZ_COUNT_DTOR(nsHtml5StackNode);
     224          13 : }
     225             : 
     226             : void 
     227           0 : nsHtml5StackNode::dropAttributes()
     228             : {
     229           0 :   attributes = nullptr;
     230           0 : }
     231             : 
     232             : void 
     233           0 : nsHtml5StackNode::retain()
     234             : {
     235           0 :   refcount++;
     236           0 : }
     237             : 
     238             : void
     239          30 : nsHtml5StackNode::release(nsHtml5TreeBuilder* owningTreeBuilder)
     240             : {
     241          30 :   refcount--;
     242          30 :   MOZ_ASSERT(refcount >= 0);
     243          30 :   if (!refcount) {
     244          30 :     delete attributes;
     245          30 :     if (idxInTreeBuilder >= 0) {
     246          20 :       owningTreeBuilder->notifyUnusedStackNode(idxInTreeBuilder);
     247             :     } else {
     248          10 :       MOZ_ASSERT(!owningTreeBuilder);
     249          10 :       delete this;
     250             :     }
     251             :   }
     252          30 : }
     253             : 
     254             : bool
     255          49 : nsHtml5StackNode::isUnused()
     256             : {
     257          49 :   return !refcount;
     258             : }
     259             : 
     260             : void
     261           3 : nsHtml5StackNode::initializeStatics()
     262             : {
     263           3 : }
     264             : 
     265             : void
     266           0 : nsHtml5StackNode::releaseStatics()
     267             : {
     268           0 : }
     269             : 
     270             : 

Generated by: LCOV version 1.13