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