|
1 /* |
|
2 * Copyright (c) 2007 Henri Sivonen |
|
3 * Copyright (c) 2008-2010 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 "nsString.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 "nsHtml5Atoms.h" |
|
42 #include "nsHtml5ByteReadable.h" |
|
43 #include "nsIUnicodeDecoder.h" |
|
44 #include "nsHtml5Macros.h" |
|
45 #include "nsIContentHandle.h" |
|
46 |
|
47 class nsHtml5StreamParser; |
|
48 |
|
49 class nsHtml5Tokenizer; |
|
50 class nsHtml5TreeBuilder; |
|
51 class nsHtml5AttributeName; |
|
52 class nsHtml5ElementName; |
|
53 class nsHtml5HtmlAttributes; |
|
54 class nsHtml5UTF16Buffer; |
|
55 class nsHtml5StateSnapshot; |
|
56 class nsHtml5Portability; |
|
57 |
|
58 |
|
59 class nsHtml5MetaScanner |
|
60 { |
|
61 private: |
|
62 static staticJArray<char16_t,int32_t> CHARSET; |
|
63 static staticJArray<char16_t,int32_t> CONTENT; |
|
64 static staticJArray<char16_t,int32_t> HTTP_EQUIV; |
|
65 static staticJArray<char16_t,int32_t> CONTENT_TYPE; |
|
66 protected: |
|
67 nsHtml5ByteReadable* readable; |
|
68 private: |
|
69 int32_t metaState; |
|
70 int32_t contentIndex; |
|
71 int32_t charsetIndex; |
|
72 int32_t httpEquivIndex; |
|
73 int32_t contentTypeIndex; |
|
74 protected: |
|
75 int32_t stateSave; |
|
76 private: |
|
77 int32_t strBufLen; |
|
78 autoJArray<char16_t,int32_t> strBuf; |
|
79 nsString* content; |
|
80 nsString* charset; |
|
81 int32_t httpEquivState; |
|
82 public: |
|
83 nsHtml5MetaScanner(); |
|
84 ~nsHtml5MetaScanner(); |
|
85 protected: |
|
86 void stateLoop(int32_t state); |
|
87 private: |
|
88 void handleCharInAttributeValue(int32_t c); |
|
89 inline int32_t toAsciiLowerCase(int32_t c) |
|
90 { |
|
91 if (c >= 'A' && c <= 'Z') { |
|
92 return c + 0x20; |
|
93 } |
|
94 return c; |
|
95 } |
|
96 |
|
97 void addToBuffer(int32_t c); |
|
98 void handleAttributeValue(); |
|
99 bool handleTag(); |
|
100 bool handleTagInner(); |
|
101 protected: |
|
102 bool tryCharset(nsString* encoding); |
|
103 public: |
|
104 static void initializeStatics(); |
|
105 static void releaseStatics(); |
|
106 |
|
107 #include "nsHtml5MetaScannerHSupplement.h" |
|
108 }; |
|
109 |
|
110 #define NS_HTML5META_SCANNER_NO 0 |
|
111 #define NS_HTML5META_SCANNER_M 1 |
|
112 #define NS_HTML5META_SCANNER_E 2 |
|
113 #define NS_HTML5META_SCANNER_T 3 |
|
114 #define NS_HTML5META_SCANNER_A 4 |
|
115 #define NS_HTML5META_SCANNER_DATA 0 |
|
116 #define NS_HTML5META_SCANNER_TAG_OPEN 1 |
|
117 #define NS_HTML5META_SCANNER_SCAN_UNTIL_GT 2 |
|
118 #define NS_HTML5META_SCANNER_TAG_NAME 3 |
|
119 #define NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME 4 |
|
120 #define NS_HTML5META_SCANNER_ATTRIBUTE_NAME 5 |
|
121 #define NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_NAME 6 |
|
122 #define NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_VALUE 7 |
|
123 #define NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_DOUBLE_QUOTED 8 |
|
124 #define NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_SINGLE_QUOTED 9 |
|
125 #define NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_UNQUOTED 10 |
|
126 #define NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_VALUE_QUOTED 11 |
|
127 #define NS_HTML5META_SCANNER_MARKUP_DECLARATION_OPEN 13 |
|
128 #define NS_HTML5META_SCANNER_MARKUP_DECLARATION_HYPHEN 14 |
|
129 #define NS_HTML5META_SCANNER_COMMENT_START 15 |
|
130 #define NS_HTML5META_SCANNER_COMMENT_START_DASH 16 |
|
131 #define NS_HTML5META_SCANNER_COMMENT 17 |
|
132 #define NS_HTML5META_SCANNER_COMMENT_END_DASH 18 |
|
133 #define NS_HTML5META_SCANNER_COMMENT_END 19 |
|
134 #define NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG 20 |
|
135 #define NS_HTML5META_SCANNER_HTTP_EQUIV_NOT_SEEN 0 |
|
136 #define NS_HTML5META_SCANNER_HTTP_EQUIV_CONTENT_TYPE 1 |
|
137 #define NS_HTML5META_SCANNER_HTTP_EQUIV_OTHER 2 |
|
138 |
|
139 |
|
140 #endif |
|
141 |