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 "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 nsHtml5TreeBuilder* treeBuilder; 83 public: 84 explicit nsHtml5MetaScanner(nsHtml5TreeBuilder* tb); 85 ~nsHtml5MetaScanner(); 86 protected: 87 void stateLoop(int32_t state); 88 private: 89 void handleCharInAttributeValue(int32_t c); toAsciiLowerCase(int32_t c)90 inline int32_t toAsciiLowerCase(int32_t c) 91 { 92 if (c >= 'A' && c <= 'Z') { 93 return c + 0x20; 94 } 95 return c; 96 } 97 98 void addToBuffer(int32_t c); 99 void handleAttributeValue(); 100 bool handleTag(); 101 bool handleTagInner(); 102 protected: 103 bool tryCharset(nsString* encoding); 104 public: 105 static void initializeStatics(); 106 static void releaseStatics(); 107 108 #include "nsHtml5MetaScannerHSupplement.h" 109 }; 110 111 #define NS_HTML5META_SCANNER_NO 0 112 #define NS_HTML5META_SCANNER_M 1 113 #define NS_HTML5META_SCANNER_E 2 114 #define NS_HTML5META_SCANNER_T 3 115 #define NS_HTML5META_SCANNER_A 4 116 #define NS_HTML5META_SCANNER_DATA 0 117 #define NS_HTML5META_SCANNER_TAG_OPEN 1 118 #define NS_HTML5META_SCANNER_SCAN_UNTIL_GT 2 119 #define NS_HTML5META_SCANNER_TAG_NAME 3 120 #define NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME 4 121 #define NS_HTML5META_SCANNER_ATTRIBUTE_NAME 5 122 #define NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_NAME 6 123 #define NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_VALUE 7 124 #define NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_DOUBLE_QUOTED 8 125 #define NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_SINGLE_QUOTED 9 126 #define NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_UNQUOTED 10 127 #define NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_VALUE_QUOTED 11 128 #define NS_HTML5META_SCANNER_MARKUP_DECLARATION_OPEN 13 129 #define NS_HTML5META_SCANNER_MARKUP_DECLARATION_HYPHEN 14 130 #define NS_HTML5META_SCANNER_COMMENT_START 15 131 #define NS_HTML5META_SCANNER_COMMENT_START_DASH 16 132 #define NS_HTML5META_SCANNER_COMMENT 17 133 #define NS_HTML5META_SCANNER_COMMENT_END_DASH 18 134 #define NS_HTML5META_SCANNER_COMMENT_END 19 135 #define NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG 20 136 #define NS_HTML5META_SCANNER_HTTP_EQUIV_NOT_SEEN 0 137 #define NS_HTML5META_SCANNER_HTTP_EQUIV_CONTENT_TYPE 1 138 #define NS_HTML5META_SCANNER_HTTP_EQUIV_OTHER 2 139 140 141 #endif 142 143