michael@0: /* michael@0: * Copyright (c) 2007 Henri Sivonen michael@0: * Copyright (c) 2007-2011 Mozilla Foundation michael@0: * michael@0: * Permission is hereby granted, free of charge, to any person obtaining a michael@0: * copy of this software and associated documentation files (the "Software"), michael@0: * to deal in the Software without restriction, including without limitation michael@0: * the rights to use, copy, modify, merge, publish, distribute, sublicense, michael@0: * and/or sell copies of the Software, and to permit persons to whom the michael@0: * Software is furnished to do so, subject to the following conditions: michael@0: * michael@0: * The above copyright notice and this permission notice shall be included in michael@0: * all copies or substantial portions of the Software. michael@0: * michael@0: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR michael@0: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, michael@0: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL michael@0: * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER michael@0: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING michael@0: * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER michael@0: * DEALINGS IN THE SOFTWARE. michael@0: */ michael@0: michael@0: /* michael@0: * THIS IS A GENERATED FILE. PLEASE DO NOT EDIT. michael@0: * Please edit StackNode.java instead and regenerate. michael@0: */ michael@0: michael@0: #define nsHtml5StackNode_cpp__ michael@0: michael@0: #include "nsIAtom.h" michael@0: #include "nsHtml5AtomTable.h" michael@0: #include "nsString.h" michael@0: #include "nsNameSpaceManager.h" michael@0: #include "nsIContent.h" michael@0: #include "nsTraceRefcnt.h" michael@0: #include "jArray.h" michael@0: #include "nsHtml5ArrayCopy.h" michael@0: #include "nsAHtml5TreeBuilderState.h" michael@0: #include "nsHtml5Atoms.h" michael@0: #include "nsHtml5ByteReadable.h" michael@0: #include "nsIUnicodeDecoder.h" michael@0: #include "nsHtml5Macros.h" michael@0: #include "nsIContentHandle.h" michael@0: michael@0: #include "nsHtml5Tokenizer.h" michael@0: #include "nsHtml5TreeBuilder.h" michael@0: #include "nsHtml5MetaScanner.h" michael@0: #include "nsHtml5AttributeName.h" michael@0: #include "nsHtml5ElementName.h" michael@0: #include "nsHtml5HtmlAttributes.h" michael@0: #include "nsHtml5UTF16Buffer.h" michael@0: #include "nsHtml5StateSnapshot.h" michael@0: #include "nsHtml5Portability.h" michael@0: michael@0: #include "nsHtml5StackNode.h" michael@0: michael@0: int32_t michael@0: nsHtml5StackNode::getGroup() michael@0: { michael@0: return flags & NS_HTML5ELEMENT_NAME_GROUP_MASK; michael@0: } michael@0: michael@0: bool michael@0: nsHtml5StackNode::isScoping() michael@0: { michael@0: return (flags & NS_HTML5ELEMENT_NAME_SCOPING); michael@0: } michael@0: michael@0: bool michael@0: nsHtml5StackNode::isSpecial() michael@0: { michael@0: return (flags & NS_HTML5ELEMENT_NAME_SPECIAL); michael@0: } michael@0: michael@0: bool michael@0: nsHtml5StackNode::isFosterParenting() michael@0: { michael@0: return (flags & NS_HTML5ELEMENT_NAME_FOSTER_PARENTING); michael@0: } michael@0: michael@0: bool michael@0: nsHtml5StackNode::isHtmlIntegrationPoint() michael@0: { michael@0: return (flags & NS_HTML5ELEMENT_NAME_HTML_INTEGRATION_POINT); michael@0: } michael@0: michael@0: michael@0: nsHtml5StackNode::nsHtml5StackNode(int32_t flags, int32_t ns, nsIAtom* name, nsIContentHandle* node, nsIAtom* popName, nsHtml5HtmlAttributes* attributes) michael@0: : flags(flags), michael@0: name(name), michael@0: popName(popName), michael@0: ns(ns), michael@0: node(node), michael@0: attributes(attributes), michael@0: refcount(1) michael@0: { michael@0: MOZ_COUNT_CTOR(nsHtml5StackNode); michael@0: } michael@0: michael@0: michael@0: nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node) michael@0: : flags(elementName->getFlags()), michael@0: name(elementName->name), michael@0: popName(elementName->name), michael@0: ns(kNameSpaceID_XHTML), michael@0: node(node), michael@0: attributes(nullptr), michael@0: refcount(1) michael@0: { michael@0: MOZ_COUNT_CTOR(nsHtml5StackNode); michael@0: MOZ_ASSERT(!elementName->isCustom(), "Don't use this constructor for custom elements."); michael@0: } michael@0: michael@0: michael@0: nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsHtml5HtmlAttributes* attributes) michael@0: : flags(elementName->getFlags()), michael@0: name(elementName->name), michael@0: popName(elementName->name), michael@0: ns(kNameSpaceID_XHTML), michael@0: node(node), michael@0: attributes(attributes), michael@0: refcount(1) michael@0: { michael@0: MOZ_COUNT_CTOR(nsHtml5StackNode); michael@0: MOZ_ASSERT(!elementName->isCustom(), "Don't use this constructor for custom elements."); michael@0: } michael@0: michael@0: michael@0: nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsIAtom* popName) michael@0: : flags(elementName->getFlags()), michael@0: name(elementName->name), michael@0: popName(popName), michael@0: ns(kNameSpaceID_XHTML), michael@0: node(node), michael@0: attributes(nullptr), michael@0: refcount(1) michael@0: { michael@0: MOZ_COUNT_CTOR(nsHtml5StackNode); michael@0: } michael@0: michael@0: michael@0: nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIAtom* popName, nsIContentHandle* node) michael@0: : flags(prepareSvgFlags(elementName->getFlags())), michael@0: name(elementName->name), michael@0: popName(popName), michael@0: ns(kNameSpaceID_SVG), michael@0: node(node), michael@0: attributes(nullptr), michael@0: refcount(1) michael@0: { michael@0: MOZ_COUNT_CTOR(nsHtml5StackNode); michael@0: } michael@0: michael@0: michael@0: nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContentHandle* node, nsIAtom* popName, bool markAsIntegrationPoint) michael@0: : flags(prepareMathFlags(elementName->getFlags(), markAsIntegrationPoint)), michael@0: name(elementName->name), michael@0: popName(popName), michael@0: ns(kNameSpaceID_MathML), michael@0: node(node), michael@0: attributes(nullptr), michael@0: refcount(1) michael@0: { michael@0: MOZ_COUNT_CTOR(nsHtml5StackNode); michael@0: } michael@0: michael@0: int32_t michael@0: nsHtml5StackNode::prepareSvgFlags(int32_t flags) michael@0: { michael@0: flags &= ~(NS_HTML5ELEMENT_NAME_FOSTER_PARENTING | NS_HTML5ELEMENT_NAME_SCOPING | NS_HTML5ELEMENT_NAME_SPECIAL | NS_HTML5ELEMENT_NAME_OPTIONAL_END_TAG); michael@0: if ((flags & NS_HTML5ELEMENT_NAME_SCOPING_AS_SVG)) { michael@0: flags |= (NS_HTML5ELEMENT_NAME_SCOPING | NS_HTML5ELEMENT_NAME_SPECIAL | NS_HTML5ELEMENT_NAME_HTML_INTEGRATION_POINT); michael@0: } michael@0: return flags; michael@0: } michael@0: michael@0: int32_t michael@0: nsHtml5StackNode::prepareMathFlags(int32_t flags, bool markAsIntegrationPoint) michael@0: { michael@0: flags &= ~(NS_HTML5ELEMENT_NAME_FOSTER_PARENTING | NS_HTML5ELEMENT_NAME_SCOPING | NS_HTML5ELEMENT_NAME_SPECIAL | NS_HTML5ELEMENT_NAME_OPTIONAL_END_TAG); michael@0: if ((flags & NS_HTML5ELEMENT_NAME_SCOPING_AS_MATHML)) { michael@0: flags |= (NS_HTML5ELEMENT_NAME_SCOPING | NS_HTML5ELEMENT_NAME_SPECIAL); michael@0: } michael@0: if (markAsIntegrationPoint) { michael@0: flags |= NS_HTML5ELEMENT_NAME_HTML_INTEGRATION_POINT; michael@0: } michael@0: return flags; michael@0: } michael@0: michael@0: michael@0: nsHtml5StackNode::~nsHtml5StackNode() michael@0: { michael@0: MOZ_COUNT_DTOR(nsHtml5StackNode); michael@0: delete attributes; michael@0: } michael@0: michael@0: void michael@0: nsHtml5StackNode::dropAttributes() michael@0: { michael@0: attributes = nullptr; michael@0: } michael@0: michael@0: void michael@0: nsHtml5StackNode::retain() michael@0: { michael@0: refcount++; michael@0: } michael@0: michael@0: void michael@0: nsHtml5StackNode::release() michael@0: { michael@0: refcount--; michael@0: if (!refcount) { michael@0: delete this; michael@0: } michael@0: } michael@0: michael@0: void michael@0: nsHtml5StackNode::initializeStatics() michael@0: { michael@0: } michael@0: michael@0: void michael@0: nsHtml5StackNode::releaseStatics() michael@0: { michael@0: } michael@0: michael@0: