Line data Source code
1 : /*
2 : * Copyright (c) 2007 Henri Sivonen
3 : * Copyright (c) 2008-2015 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 MetaScanner.java instead and regenerate.
27 : */
28 :
29 : #ifndef nsHtml5MetaScanner_h
30 : #define nsHtml5MetaScanner_h
31 :
32 : #include "nsIAtom.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 :
47 : class nsHtml5StreamParser;
48 :
49 : class nsHtml5AttributeName;
50 : class nsHtml5ElementName;
51 : class nsHtml5Tokenizer;
52 : class nsHtml5TreeBuilder;
53 : class nsHtml5UTF16Buffer;
54 : class nsHtml5StateSnapshot;
55 : class nsHtml5Portability;
56 :
57 :
58 : class nsHtml5MetaScanner
59 : {
60 : private:
61 : static staticJArray<char16_t,int32_t> CHARSET;
62 : static staticJArray<char16_t,int32_t> CONTENT;
63 : static staticJArray<char16_t,int32_t> HTTP_EQUIV;
64 : static staticJArray<char16_t,int32_t> CONTENT_TYPE;
65 : static const int32_t NO = 0;
66 :
67 : static const int32_t M = 1;
68 :
69 : static const int32_t E = 2;
70 :
71 : static const int32_t T = 3;
72 :
73 : static const int32_t A = 4;
74 :
75 : static const int32_t DATA = 0;
76 :
77 : static const int32_t TAG_OPEN = 1;
78 :
79 : static const int32_t SCAN_UNTIL_GT = 2;
80 :
81 : static const int32_t TAG_NAME = 3;
82 :
83 : static const int32_t BEFORE_ATTRIBUTE_NAME = 4;
84 :
85 : static const int32_t ATTRIBUTE_NAME = 5;
86 :
87 : static const int32_t AFTER_ATTRIBUTE_NAME = 6;
88 :
89 : static const int32_t BEFORE_ATTRIBUTE_VALUE = 7;
90 :
91 : static const int32_t ATTRIBUTE_VALUE_DOUBLE_QUOTED = 8;
92 :
93 : static const int32_t ATTRIBUTE_VALUE_SINGLE_QUOTED = 9;
94 :
95 : static const int32_t ATTRIBUTE_VALUE_UNQUOTED = 10;
96 :
97 : static const int32_t AFTER_ATTRIBUTE_VALUE_QUOTED = 11;
98 :
99 : static const int32_t MARKUP_DECLARATION_OPEN = 13;
100 :
101 : static const int32_t MARKUP_DECLARATION_HYPHEN = 14;
102 :
103 : static const int32_t COMMENT_START = 15;
104 :
105 : static const int32_t COMMENT_START_DASH = 16;
106 :
107 : static const int32_t COMMENT = 17;
108 :
109 : static const int32_t COMMENT_END_DASH = 18;
110 :
111 : static const int32_t COMMENT_END = 19;
112 :
113 : static const int32_t SELF_CLOSING_START_TAG = 20;
114 :
115 : static const int32_t HTTP_EQUIV_NOT_SEEN = 0;
116 :
117 : static const int32_t HTTP_EQUIV_CONTENT_TYPE = 1;
118 :
119 : static const int32_t HTTP_EQUIV_OTHER = 2;
120 :
121 : protected:
122 : nsHtml5ByteReadable* readable;
123 : private:
124 : int32_t metaState;
125 : int32_t contentIndex;
126 : int32_t charsetIndex;
127 : int32_t httpEquivIndex;
128 : int32_t contentTypeIndex;
129 : protected:
130 : int32_t stateSave;
131 : private:
132 : int32_t strBufLen;
133 : autoJArray<char16_t,int32_t> strBuf;
134 : nsHtml5String content;
135 : nsHtml5String charset;
136 : int32_t httpEquivState;
137 : nsHtml5TreeBuilder* treeBuilder;
138 : public:
139 : explicit nsHtml5MetaScanner(nsHtml5TreeBuilder* tb);
140 : ~nsHtml5MetaScanner();
141 : protected:
142 : void stateLoop(int32_t state);
143 : private:
144 : void handleCharInAttributeValue(int32_t c);
145 0 : inline int32_t toAsciiLowerCase(int32_t c)
146 : {
147 0 : if (c >= 'A' && c <= 'Z') {
148 0 : return c + 0x20;
149 : }
150 0 : return c;
151 : }
152 :
153 : void addToBuffer(int32_t c);
154 : void handleAttributeValue();
155 : bool handleTag();
156 : bool handleTagInner();
157 : protected:
158 : bool tryCharset(nsHtml5String encoding);
159 : public:
160 : static void initializeStatics();
161 : static void releaseStatics();
162 :
163 : #include "nsHtml5MetaScannerHSupplement.h"
164 : };
165 :
166 : #endif
167 :
|