Bug 1690340 - Part 1: Hide all the panel tools in the developer tools menu. r=jdescottes
[gecko.git] / parser / html / nsHtml5MetaScanner.h
blobd64caa92af122ab0d92b7a4474738a853c640b09
1 /*
2 * Copyright (c) 2007 Henri Sivonen
3 * Copyright (c) 2008-2015 Mozilla Foundation
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:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
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.
25 * THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
26 * Please edit MetaScanner.java instead and regenerate.
29 #ifndef nsHtml5MetaScanner_h
30 #define nsHtml5MetaScanner_h
32 #include "nsAtom.h"
33 #include "nsHtml5AtomTable.h"
34 #include "nsHtml5String.h"
35 #include "nsNameSpaceManager.h"
36 #include "nsIContent.h"
37 #include "nsTraceRefcnt.h"
38 #include "jArray.h"
39 #include "nsHtml5ArrayCopy.h"
40 #include "nsAHtml5TreeBuilderState.h"
41 #include "nsGkAtoms.h"
42 #include "nsHtml5ByteReadable.h"
43 #include "nsHtml5Macros.h"
44 #include "nsIContentHandle.h"
45 #include "nsHtml5Portability.h"
46 #include "nsHtml5ContentCreatorFunction.h"
48 class nsHtml5StreamParser;
50 class nsHtml5AttributeName;
51 class nsHtml5ElementName;
52 class nsHtml5Tokenizer;
53 class nsHtml5TreeBuilder;
54 class nsHtml5UTF16Buffer;
55 class nsHtml5StateSnapshot;
56 class nsHtml5Portability;
58 class nsHtml5MetaScanner {
59 private:
60 static staticJArray<char16_t, int32_t> CHARSET;
61 static staticJArray<char16_t, int32_t> CONTENT;
62 static staticJArray<char16_t, int32_t> HTTP_EQUIV;
63 static staticJArray<char16_t, int32_t> CONTENT_TYPE;
64 static const int32_t NO = 0;
66 static const int32_t M = 1;
68 static const int32_t E = 2;
70 static const int32_t T = 3;
72 static const int32_t A = 4;
74 static const int32_t DATA = 0;
76 static const int32_t TAG_OPEN = 1;
78 static const int32_t SCAN_UNTIL_GT = 2;
80 static const int32_t TAG_NAME = 3;
82 static const int32_t BEFORE_ATTRIBUTE_NAME = 4;
84 static const int32_t ATTRIBUTE_NAME = 5;
86 static const int32_t AFTER_ATTRIBUTE_NAME = 6;
88 static const int32_t BEFORE_ATTRIBUTE_VALUE = 7;
90 static const int32_t ATTRIBUTE_VALUE_DOUBLE_QUOTED = 8;
92 static const int32_t ATTRIBUTE_VALUE_SINGLE_QUOTED = 9;
94 static const int32_t ATTRIBUTE_VALUE_UNQUOTED = 10;
96 static const int32_t AFTER_ATTRIBUTE_VALUE_QUOTED = 11;
98 static const int32_t MARKUP_DECLARATION_OPEN = 13;
100 static const int32_t MARKUP_DECLARATION_HYPHEN = 14;
102 static const int32_t COMMENT_START = 15;
104 static const int32_t COMMENT_START_DASH = 16;
106 static const int32_t COMMENT = 17;
108 static const int32_t COMMENT_END_DASH = 18;
110 static const int32_t COMMENT_END = 19;
112 static const int32_t SELF_CLOSING_START_TAG = 20;
114 static const int32_t HTTP_EQUIV_NOT_SEEN = 0;
116 static const int32_t HTTP_EQUIV_CONTENT_TYPE = 1;
118 static const int32_t HTTP_EQUIV_OTHER = 2;
120 protected:
121 nsHtml5ByteReadable* readable;
123 private:
124 int32_t metaState;
125 int32_t contentIndex;
126 int32_t charsetIndex;
127 int32_t httpEquivIndex;
128 int32_t contentTypeIndex;
130 protected:
131 int32_t stateSave;
133 private:
134 int32_t strBufLen;
135 autoJArray<char16_t, int32_t> strBuf;
136 nsHtml5String content;
137 nsHtml5String charset;
138 int32_t httpEquivState;
139 nsHtml5TreeBuilder* treeBuilder;
141 public:
142 explicit nsHtml5MetaScanner(nsHtml5TreeBuilder* tb);
143 ~nsHtml5MetaScanner();
145 protected:
146 void stateLoop(int32_t state);
148 private:
149 void handleCharInAttributeValue(int32_t c);
150 inline int32_t toAsciiLowerCase(int32_t c) {
151 if (c >= 'A' && c <= 'Z') {
152 return c + 0x20;
154 return c;
157 void addToBuffer(int32_t c);
158 void handleAttributeValue();
159 bool handleTag();
160 bool handleTagInner();
162 protected:
163 bool tryCharset(nsHtml5String encoding);
165 public:
166 static void initializeStatics();
167 static void releaseStatics();
169 #include "nsHtml5MetaScannerHSupplement.h"
172 #endif