parser/html/nsHtml5StackNode.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/parser/html/nsHtml5StackNode.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,229 @@
     1.4 +/*
     1.5 + * Copyright (c) 2007 Henri Sivonen
     1.6 + * Copyright (c) 2007-2011 Mozilla Foundation
     1.7 + *
     1.8 + * Permission is hereby granted, free of charge, to any person obtaining a 
     1.9 + * copy of this software and associated documentation files (the "Software"), 
    1.10 + * to deal in the Software without restriction, including without limitation 
    1.11 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
    1.12 + * and/or sell copies of the Software, and to permit persons to whom the 
    1.13 + * Software is furnished to do so, subject to the following conditions:
    1.14 + *
    1.15 + * The above copyright notice and this permission notice shall be included in 
    1.16 + * all copies or substantial portions of the Software.
    1.17 + *
    1.18 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
    1.19 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
    1.20 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
    1.21 + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
    1.22 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
    1.23 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
    1.24 + * DEALINGS IN THE SOFTWARE.
    1.25 + */
    1.26 +
    1.27 +/*
    1.28 + * THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
    1.29 + * Please edit StackNode.java instead and regenerate.
    1.30 + */
    1.31 +
    1.32 +#define nsHtml5StackNode_cpp__
    1.33 +
    1.34 +#include "nsIAtom.h"
    1.35 +#include "nsHtml5AtomTable.h"
    1.36 +#include "nsString.h"
    1.37 +#include "nsNameSpaceManager.h"
    1.38 +#include "nsIContent.h"
    1.39 +#include "nsTraceRefcnt.h"
    1.40 +#include "jArray.h"
    1.41 +#include "nsHtml5ArrayCopy.h"
    1.42 +#include "nsAHtml5TreeBuilderState.h"
    1.43 +#include "nsHtml5Atoms.h"
    1.44 +#include "nsHtml5ByteReadable.h"
    1.45 +#include "nsIUnicodeDecoder.h"
    1.46 +#include "nsHtml5Macros.h"
    1.47 +#include "nsIContentHandle.h"
    1.48 +
    1.49 +#include "nsHtml5Tokenizer.h"
    1.50 +#include "nsHtml5TreeBuilder.h"
    1.51 +#include "nsHtml5MetaScanner.h"
    1.52 +#include "nsHtml5AttributeName.h"
    1.53 +#include "nsHtml5ElementName.h"
    1.54 +#include "nsHtml5HtmlAttributes.h"
    1.55 +#include "nsHtml5UTF16Buffer.h"
    1.56 +#include "nsHtml5StateSnapshot.h"
    1.57 +#include "nsHtml5Portability.h"
    1.58 +
    1.59 +#include "nsHtml5StackNode.h"
    1.60 +
    1.61 +int32_t 
    1.62 +nsHtml5StackNode::getGroup()
    1.63 +{
    1.64 +  return flags & NS_HTML5ELEMENT_NAME_GROUP_MASK;
    1.65 +}
    1.66 +
    1.67 +bool 
    1.68 +nsHtml5StackNode::isScoping()
    1.69 +{
    1.70 +  return (flags & NS_HTML5ELEMENT_NAME_SCOPING);
    1.71 +}
    1.72 +
    1.73 +bool 
    1.74 +nsHtml5StackNode::isSpecial()
    1.75 +{
    1.76 +  return (flags & NS_HTML5ELEMENT_NAME_SPECIAL);
    1.77 +}
    1.78 +
    1.79 +bool 
    1.80 +nsHtml5StackNode::isFosterParenting()
    1.81 +{
    1.82 +  return (flags & NS_HTML5ELEMENT_NAME_FOSTER_PARENTING);
    1.83 +}
    1.84 +
    1.85 +bool 
    1.86 +nsHtml5StackNode::isHtmlIntegrationPoint()
    1.87 +{
    1.88 +  return (flags & NS_HTML5ELEMENT_NAME_HTML_INTEGRATION_POINT);
    1.89 +}
    1.90 +
    1.91 +
    1.92 +nsHtml5StackNode::nsHtml5StackNode(int32_t flags, int32_t ns, nsIAtom* name, nsIContentHandle* node, nsIAtom* popName, nsHtml5HtmlAttributes* attributes)
    1.93 +  : flags(flags),
    1.94 +    name(name),
    1.95 +    popName(popName),
    1.96 +    ns(ns),
    1.97 +    node(node),
    1.98 +    attributes(attributes),
    1.99 +    refcount(1)
   1.100 +{
   1.101 +  MOZ_COUNT_CTOR(nsHtml5StackNode);
   1.102 +}
   1.103 +
   1.104 +
   1.105 +nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node)
   1.106 +  : flags(elementName->getFlags()),
   1.107 +    name(elementName->name),
   1.108 +    popName(elementName->name),
   1.109 +    ns(kNameSpaceID_XHTML),
   1.110 +    node(node),
   1.111 +    attributes(nullptr),
   1.112 +    refcount(1)
   1.113 +{
   1.114 +  MOZ_COUNT_CTOR(nsHtml5StackNode);
   1.115 +  MOZ_ASSERT(!elementName->isCustom(), "Don't use this constructor for custom elements.");
   1.116 +}
   1.117 +
   1.118 +
   1.119 +nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsHtml5HtmlAttributes* attributes)
   1.120 +  : flags(elementName->getFlags()),
   1.121 +    name(elementName->name),
   1.122 +    popName(elementName->name),
   1.123 +    ns(kNameSpaceID_XHTML),
   1.124 +    node(node),
   1.125 +    attributes(attributes),
   1.126 +    refcount(1)
   1.127 +{
   1.128 +  MOZ_COUNT_CTOR(nsHtml5StackNode);
   1.129 +  MOZ_ASSERT(!elementName->isCustom(), "Don't use this constructor for custom elements.");
   1.130 +}
   1.131 +
   1.132 +
   1.133 +nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsIAtom* popName)
   1.134 +  : flags(elementName->getFlags()),
   1.135 +    name(elementName->name),
   1.136 +    popName(popName),
   1.137 +    ns(kNameSpaceID_XHTML),
   1.138 +    node(node),
   1.139 +    attributes(nullptr),
   1.140 +    refcount(1)
   1.141 +{
   1.142 +  MOZ_COUNT_CTOR(nsHtml5StackNode);
   1.143 +}
   1.144 +
   1.145 +
   1.146 +nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIAtom* popName, nsIContentHandle* node)
   1.147 +  : flags(prepareSvgFlags(elementName->getFlags())),
   1.148 +    name(elementName->name),
   1.149 +    popName(popName),
   1.150 +    ns(kNameSpaceID_SVG),
   1.151 +    node(node),
   1.152 +    attributes(nullptr),
   1.153 +    refcount(1)
   1.154 +{
   1.155 +  MOZ_COUNT_CTOR(nsHtml5StackNode);
   1.156 +}
   1.157 +
   1.158 +
   1.159 +nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsIAtom* popName, bool markAsIntegrationPoint)
   1.160 +  : flags(prepareMathFlags(elementName->getFlags(), markAsIntegrationPoint)),
   1.161 +    name(elementName->name),
   1.162 +    popName(popName),
   1.163 +    ns(kNameSpaceID_MathML),
   1.164 +    node(node),
   1.165 +    attributes(nullptr),
   1.166 +    refcount(1)
   1.167 +{
   1.168 +  MOZ_COUNT_CTOR(nsHtml5StackNode);
   1.169 +}
   1.170 +
   1.171 +int32_t 
   1.172 +nsHtml5StackNode::prepareSvgFlags(int32_t flags)
   1.173 +{
   1.174 +  flags &= ~(NS_HTML5ELEMENT_NAME_FOSTER_PARENTING | NS_HTML5ELEMENT_NAME_SCOPING | NS_HTML5ELEMENT_NAME_SPECIAL | NS_HTML5ELEMENT_NAME_OPTIONAL_END_TAG);
   1.175 +  if ((flags & NS_HTML5ELEMENT_NAME_SCOPING_AS_SVG)) {
   1.176 +    flags |= (NS_HTML5ELEMENT_NAME_SCOPING | NS_HTML5ELEMENT_NAME_SPECIAL | NS_HTML5ELEMENT_NAME_HTML_INTEGRATION_POINT);
   1.177 +  }
   1.178 +  return flags;
   1.179 +}
   1.180 +
   1.181 +int32_t 
   1.182 +nsHtml5StackNode::prepareMathFlags(int32_t flags, bool markAsIntegrationPoint)
   1.183 +{
   1.184 +  flags &= ~(NS_HTML5ELEMENT_NAME_FOSTER_PARENTING | NS_HTML5ELEMENT_NAME_SCOPING | NS_HTML5ELEMENT_NAME_SPECIAL | NS_HTML5ELEMENT_NAME_OPTIONAL_END_TAG);
   1.185 +  if ((flags & NS_HTML5ELEMENT_NAME_SCOPING_AS_MATHML)) {
   1.186 +    flags |= (NS_HTML5ELEMENT_NAME_SCOPING | NS_HTML5ELEMENT_NAME_SPECIAL);
   1.187 +  }
   1.188 +  if (markAsIntegrationPoint) {
   1.189 +    flags |= NS_HTML5ELEMENT_NAME_HTML_INTEGRATION_POINT;
   1.190 +  }
   1.191 +  return flags;
   1.192 +}
   1.193 +
   1.194 +
   1.195 +nsHtml5StackNode::~nsHtml5StackNode()
   1.196 +{
   1.197 +  MOZ_COUNT_DTOR(nsHtml5StackNode);
   1.198 +  delete attributes;
   1.199 +}
   1.200 +
   1.201 +void 
   1.202 +nsHtml5StackNode::dropAttributes()
   1.203 +{
   1.204 +  attributes = nullptr;
   1.205 +}
   1.206 +
   1.207 +void 
   1.208 +nsHtml5StackNode::retain()
   1.209 +{
   1.210 +  refcount++;
   1.211 +}
   1.212 +
   1.213 +void 
   1.214 +nsHtml5StackNode::release()
   1.215 +{
   1.216 +  refcount--;
   1.217 +  if (!refcount) {
   1.218 +    delete this;
   1.219 +  }
   1.220 +}
   1.221 +
   1.222 +void
   1.223 +nsHtml5StackNode::initializeStatics()
   1.224 +{
   1.225 +}
   1.226 +
   1.227 +void
   1.228 +nsHtml5StackNode::releaseStatics()
   1.229 +{
   1.230 +}
   1.231 +
   1.232 +

mercurial