Bug 1690340 - Part 1: Hide all the panel tools in the developer tools menu. r=jdescottes
[gecko.git] / parser / html / javasrc / StateSnapshot.java
blobcba711f7149bd7155354b949968117a09444c267
1 /*
2 * Copyright (c) 2009-2010 Mozilla Foundation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
23 package nu.validator.htmlparser.impl;
25 import nu.validator.htmlparser.annotation.Auto;
28 public class StateSnapshot<T> implements TreeBuilderState<T> {
30 private final @Auto StackNode<T>[] stack;
32 private final @Auto StackNode<T>[] listOfActiveFormattingElements;
34 private final @Auto int[] templateModeStack;
36 private final T formPointer;
38 private final T headPointer;
40 private final int mode;
42 private final int originalMode;
44 private final boolean framesetOk;
46 private final boolean needToDropLF;
48 private final boolean quirks;
50 /**
51 * @param stack
52 * @param listOfActiveFormattingElements
53 * @param templateModeStack
54 * @param formPointer
55 * @param headPointer
56 * @param deepTreeSurrogateParent
57 * @param mode
58 * @param originalMode
59 * @param framesetOk
60 * @param needToDropLF
61 * @param quirks
63 StateSnapshot(StackNode<T>[] stack,
64 StackNode<T>[] listOfActiveFormattingElements, int[] templateModeStack, T formPointer,
65 T headPointer, int mode, int originalMode,
66 boolean framesetOk, boolean needToDropLF, boolean quirks) {
67 this.stack = stack;
68 this.listOfActiveFormattingElements = listOfActiveFormattingElements;
69 this.templateModeStack = templateModeStack;
70 this.formPointer = formPointer;
71 this.headPointer = headPointer;
72 this.mode = mode;
73 this.originalMode = originalMode;
74 this.framesetOk = framesetOk;
75 this.needToDropLF = needToDropLF;
76 this.quirks = quirks;
79 /**
80 * @see nu.validator.htmlparser.impl.TreeBuilderState#getStack()
82 @Override
83 public StackNode<T>[] getStack() {
84 return stack;
87 /**
88 * @see nu.validator.htmlparser.impl.TreeBuilderState#getTemplateModeStack()
90 @Override
91 public int[] getTemplateModeStack() {
92 return templateModeStack;
95 /**
96 * @see nu.validator.htmlparser.impl.TreeBuilderState#getListOfActiveFormattingElements()
98 @Override
99 public StackNode<T>[] getListOfActiveFormattingElements() {
100 return listOfActiveFormattingElements;
104 * @see nu.validator.htmlparser.impl.TreeBuilderState#getFormPointer()
106 @Override
107 public T getFormPointer() {
108 return formPointer;
112 * Returns the headPointer.
114 * @return the headPointer
116 @Override
117 public T getHeadPointer() {
118 return headPointer;
122 * Returns the mode.
124 * @return the mode
126 @Override
127 public int getMode() {
128 return mode;
132 * Returns the originalMode.
134 * @return the originalMode
136 @Override
137 public int getOriginalMode() {
138 return originalMode;
142 * Returns the framesetOk.
144 * @return the framesetOk
146 @Override
147 public boolean isFramesetOk() {
148 return framesetOk;
152 * Returns the needToDropLF.
154 * @return the needToDropLF
156 @Override
157 public boolean isNeedToDropLF() {
158 return needToDropLF;
162 * Returns the quirks.
164 * @return the quirks
166 @Override
167 public boolean isQuirks() {
168 return quirks;
172 * @see nu.validator.htmlparser.impl.TreeBuilderState#getListOfActiveFormattingElementsLength()
174 @Override
175 public int getListOfActiveFormattingElementsLength() {
176 return listOfActiveFormattingElements.length;
180 * @see nu.validator.htmlparser.impl.TreeBuilderState#getStackLength()
182 @Override
183 public int getStackLength() {
184 return stack.length;
188 * @see nu.validator.htmlparser.impl.TreeBuilderState#getTemplateModeStackLength()
190 @Override
191 public int getTemplateModeStackLength() {
192 return templateModeStack.length;
195 @SuppressWarnings("unused") private void destructor() {
196 for (int i = 0; i < stack.length; i++) {
197 stack[i].release(null);
199 for (int i = 0; i < listOfActiveFormattingElements.length; i++) {
200 if (listOfActiveFormattingElements[i] != null) {
201 listOfActiveFormattingElements[i].release(null);