/src/mozilla-central/parser/html/nsHtml5MetaScanner.h
Line | Count | Source (jump to first uncovered line) |
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 "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" |
47 | | |
48 | | class nsHtml5StreamParser; |
49 | | |
50 | | class nsHtml5AttributeName; |
51 | | class nsHtml5ElementName; |
52 | | class nsHtml5Tokenizer; |
53 | | class nsHtml5TreeBuilder; |
54 | | class nsHtml5UTF16Buffer; |
55 | | class nsHtml5StateSnapshot; |
56 | | class nsHtml5Portability; |
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 | | |
124 | | private: |
125 | | int32_t metaState; |
126 | | int32_t contentIndex; |
127 | | int32_t charsetIndex; |
128 | | int32_t httpEquivIndex; |
129 | | int32_t contentTypeIndex; |
130 | | |
131 | | protected: |
132 | | int32_t stateSave; |
133 | | |
134 | | private: |
135 | | int32_t strBufLen; |
136 | | autoJArray<char16_t, int32_t> strBuf; |
137 | | nsHtml5String content; |
138 | | nsHtml5String charset; |
139 | | int32_t httpEquivState; |
140 | | nsHtml5TreeBuilder* treeBuilder; |
141 | | |
142 | | public: |
143 | | explicit nsHtml5MetaScanner(nsHtml5TreeBuilder* tb); |
144 | | ~nsHtml5MetaScanner(); |
145 | | |
146 | | protected: |
147 | | void stateLoop(int32_t state); |
148 | | |
149 | | private: |
150 | | void handleCharInAttributeValue(int32_t c); |
151 | | inline int32_t toAsciiLowerCase(int32_t c) |
152 | 0 | { |
153 | 0 | if (c >= 'A' && c <= 'Z') { |
154 | 0 | return c + 0x20; |
155 | 0 | } |
156 | 0 | return c; |
157 | 0 | } |
158 | | |
159 | | void addToBuffer(int32_t c); |
160 | | void handleAttributeValue(); |
161 | | bool handleTag(); |
162 | | bool handleTagInner(); |
163 | | |
164 | | protected: |
165 | | bool tryCharset(nsHtml5String encoding); |
166 | | |
167 | | public: |
168 | | static void initializeStatics(); |
169 | | static void releaseStatics(); |
170 | | |
171 | | #include "nsHtml5MetaScannerHSupplement.h" |
172 | | }; |
173 | | |
174 | | #endif |