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 "prtypes.h"
32 : #include "nsIAtom.h"
33 : #include "nsHtml5AtomTable.h"
34 : #include "nsString.h"
35 : #include "nsINameSpaceManager.h"
36 : #include "nsIContent.h"
37 : #include "nsTraceRefcnt.h"
38 : #include "jArray.h"
39 : #include "nsHtml5ArrayCopy.h"
40 : #include "nsAHtml5TreeBuilderState.h"
41 : #include "nsHtml5Atoms.h"
42 : #include "nsHtml5ByteReadable.h"
43 : #include "nsIUnicodeDecoder.h"
44 : #include "nsHtml5Macros.h"
45 :
46 : #include "nsHtml5Tokenizer.h"
47 : #include "nsHtml5TreeBuilder.h"
48 : #include "nsHtml5MetaScanner.h"
49 : #include "nsHtml5AttributeName.h"
50 : #include "nsHtml5ElementName.h"
51 : #include "nsHtml5HtmlAttributes.h"
52 : #include "nsHtml5UTF16Buffer.h"
53 : #include "nsHtml5StateSnapshot.h"
54 : #include "nsHtml5Portability.h"
55 :
56 : #include "nsHtml5StackNode.h"
57 :
58 : PRInt32
59 56 : nsHtml5StackNode::getGroup()
60 : {
61 56 : return flags & NS_HTML5ELEMENT_NAME_GROUP_MASK;
62 : }
63 :
64 : bool
65 50 : nsHtml5StackNode::isScoping()
66 : {
67 50 : return (flags & NS_HTML5ELEMENT_NAME_SCOPING);
68 : }
69 :
70 : bool
71 6 : nsHtml5StackNode::isSpecial()
72 : {
73 6 : return (flags & NS_HTML5ELEMENT_NAME_SPECIAL);
74 : }
75 :
76 : bool
77 78 : nsHtml5StackNode::isFosterParenting()
78 : {
79 78 : return (flags & NS_HTML5ELEMENT_NAME_FOSTER_PARENTING);
80 : }
81 :
82 : bool
83 0 : nsHtml5StackNode::isHtmlIntegrationPoint()
84 : {
85 0 : return (flags & NS_HTML5ELEMENT_NAME_HTML_INTEGRATION_POINT);
86 : }
87 :
88 :
89 0 : nsHtml5StackNode::nsHtml5StackNode(PRInt32 flags, PRInt32 ns, nsIAtom* name, nsIContent** node, nsIAtom* popName, nsHtml5HtmlAttributes* attributes)
90 : : flags(flags),
91 : name(name),
92 : popName(popName),
93 : ns(ns),
94 : node(node),
95 : attributes(attributes),
96 0 : refcount(1)
97 : {
98 0 : MOZ_COUNT_CTOR(nsHtml5StackNode);
99 0 : }
100 :
101 :
102 702 : nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContent** node)
103 702 : : flags(elementName->getFlags()),
104 : name(elementName->name),
105 : popName(elementName->name),
106 : ns(kNameSpaceID_XHTML),
107 : node(node),
108 : attributes(nsnull),
109 702 : refcount(1)
110 : {
111 702 : MOZ_COUNT_CTOR(nsHtml5StackNode);
112 :
113 702 : }
114 :
115 :
116 0 : nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContent** node, nsHtml5HtmlAttributes* attributes)
117 0 : : flags(elementName->getFlags()),
118 : name(elementName->name),
119 : popName(elementName->name),
120 : ns(kNameSpaceID_XHTML),
121 : node(node),
122 : attributes(attributes),
123 0 : refcount(1)
124 : {
125 0 : MOZ_COUNT_CTOR(nsHtml5StackNode);
126 :
127 0 : }
128 :
129 :
130 35 : nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContent** node, nsIAtom* popName)
131 35 : : flags(elementName->getFlags()),
132 : name(elementName->name),
133 : popName(popName),
134 : ns(kNameSpaceID_XHTML),
135 : node(node),
136 : attributes(nsnull),
137 35 : refcount(1)
138 : {
139 35 : MOZ_COUNT_CTOR(nsHtml5StackNode);
140 35 : }
141 :
142 :
143 0 : nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIAtom* popName, nsIContent** node)
144 0 : : flags(prepareSvgFlags(elementName->getFlags())),
145 : name(elementName->name),
146 : popName(popName),
147 : ns(kNameSpaceID_SVG),
148 : node(node),
149 : attributes(nsnull),
150 0 : refcount(1)
151 : {
152 0 : MOZ_COUNT_CTOR(nsHtml5StackNode);
153 0 : }
154 :
155 :
156 0 : nsHtml5StackNode::nsHtml5StackNode(nsHtml5ElementName* elementName, nsIContent** node, nsIAtom* popName, bool markAsIntegrationPoint)
157 0 : : flags(prepareMathFlags(elementName->getFlags(), markAsIntegrationPoint)),
158 : name(elementName->name),
159 : popName(popName),
160 : ns(kNameSpaceID_MathML),
161 : node(node),
162 : attributes(nsnull),
163 0 : refcount(1)
164 : {
165 0 : MOZ_COUNT_CTOR(nsHtml5StackNode);
166 0 : }
167 :
168 : PRInt32
169 0 : nsHtml5StackNode::prepareSvgFlags(PRInt32 flags)
170 : {
171 0 : flags &= ~(NS_HTML5ELEMENT_NAME_FOSTER_PARENTING | NS_HTML5ELEMENT_NAME_SCOPING | NS_HTML5ELEMENT_NAME_SPECIAL | NS_HTML5ELEMENT_NAME_OPTIONAL_END_TAG);
172 0 : if ((flags & NS_HTML5ELEMENT_NAME_SCOPING_AS_SVG)) {
173 0 : flags |= (NS_HTML5ELEMENT_NAME_SCOPING | NS_HTML5ELEMENT_NAME_SPECIAL | NS_HTML5ELEMENT_NAME_HTML_INTEGRATION_POINT);
174 : }
175 0 : return flags;
176 : }
177 :
178 : PRInt32
179 0 : nsHtml5StackNode::prepareMathFlags(PRInt32 flags, bool markAsIntegrationPoint)
180 : {
181 0 : flags &= ~(NS_HTML5ELEMENT_NAME_FOSTER_PARENTING | NS_HTML5ELEMENT_NAME_SCOPING | NS_HTML5ELEMENT_NAME_SPECIAL | NS_HTML5ELEMENT_NAME_OPTIONAL_END_TAG);
182 0 : if ((flags & NS_HTML5ELEMENT_NAME_SCOPING_AS_MATHML)) {
183 0 : flags |= (NS_HTML5ELEMENT_NAME_SCOPING | NS_HTML5ELEMENT_NAME_SPECIAL);
184 : }
185 0 : if (markAsIntegrationPoint) {
186 0 : flags |= NS_HTML5ELEMENT_NAME_HTML_INTEGRATION_POINT;
187 : }
188 0 : return flags;
189 : }
190 :
191 :
192 737 : nsHtml5StackNode::~nsHtml5StackNode()
193 : {
194 737 : MOZ_COUNT_DTOR(nsHtml5StackNode);
195 737 : delete attributes;
196 737 : }
197 :
198 : void
199 0 : nsHtml5StackNode::dropAttributes()
200 : {
201 0 : attributes = nsnull;
202 0 : }
203 :
204 : void
205 0 : nsHtml5StackNode::retain()
206 : {
207 0 : refcount++;
208 0 : }
209 :
210 : void
211 737 : nsHtml5StackNode::release()
212 : {
213 737 : refcount--;
214 737 : if (!refcount) {
215 737 : delete this;
216 : }
217 737 : }
218 :
219 : void
220 1404 : nsHtml5StackNode::initializeStatics()
221 : {
222 1404 : }
223 :
224 : void
225 1403 : nsHtml5StackNode::releaseStatics()
226 : {
227 1403 : }
228 :
229 :
|