parser/html/nsHtml5MetaScanner.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*
michael@0 2 * Copyright (c) 2007 Henri Sivonen
michael@0 3 * Copyright (c) 2008-2010 Mozilla Foundation
michael@0 4 *
michael@0 5 * Permission is hereby granted, free of charge, to any person obtaining a
michael@0 6 * copy of this software and associated documentation files (the "Software"),
michael@0 7 * to deal in the Software without restriction, including without limitation
michael@0 8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
michael@0 9 * and/or sell copies of the Software, and to permit persons to whom the
michael@0 10 * Software is furnished to do so, subject to the following conditions:
michael@0 11 *
michael@0 12 * The above copyright notice and this permission notice shall be included in
michael@0 13 * all copies or substantial portions of the Software.
michael@0 14 *
michael@0 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
michael@0 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
michael@0 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
michael@0 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
michael@0 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
michael@0 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
michael@0 21 * DEALINGS IN THE SOFTWARE.
michael@0 22 */
michael@0 23
michael@0 24 /*
michael@0 25 * THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
michael@0 26 * Please edit MetaScanner.java instead and regenerate.
michael@0 27 */
michael@0 28
michael@0 29 #ifndef nsHtml5MetaScanner_h
michael@0 30 #define nsHtml5MetaScanner_h
michael@0 31
michael@0 32 #include "nsIAtom.h"
michael@0 33 #include "nsHtml5AtomTable.h"
michael@0 34 #include "nsString.h"
michael@0 35 #include "nsNameSpaceManager.h"
michael@0 36 #include "nsIContent.h"
michael@0 37 #include "nsTraceRefcnt.h"
michael@0 38 #include "jArray.h"
michael@0 39 #include "nsHtml5ArrayCopy.h"
michael@0 40 #include "nsAHtml5TreeBuilderState.h"
michael@0 41 #include "nsHtml5Atoms.h"
michael@0 42 #include "nsHtml5ByteReadable.h"
michael@0 43 #include "nsIUnicodeDecoder.h"
michael@0 44 #include "nsHtml5Macros.h"
michael@0 45 #include "nsIContentHandle.h"
michael@0 46
michael@0 47 class nsHtml5StreamParser;
michael@0 48
michael@0 49 class nsHtml5Tokenizer;
michael@0 50 class nsHtml5TreeBuilder;
michael@0 51 class nsHtml5AttributeName;
michael@0 52 class nsHtml5ElementName;
michael@0 53 class nsHtml5HtmlAttributes;
michael@0 54 class nsHtml5UTF16Buffer;
michael@0 55 class nsHtml5StateSnapshot;
michael@0 56 class nsHtml5Portability;
michael@0 57
michael@0 58
michael@0 59 class nsHtml5MetaScanner
michael@0 60 {
michael@0 61 private:
michael@0 62 static staticJArray<char16_t,int32_t> CHARSET;
michael@0 63 static staticJArray<char16_t,int32_t> CONTENT;
michael@0 64 static staticJArray<char16_t,int32_t> HTTP_EQUIV;
michael@0 65 static staticJArray<char16_t,int32_t> CONTENT_TYPE;
michael@0 66 protected:
michael@0 67 nsHtml5ByteReadable* readable;
michael@0 68 private:
michael@0 69 int32_t metaState;
michael@0 70 int32_t contentIndex;
michael@0 71 int32_t charsetIndex;
michael@0 72 int32_t httpEquivIndex;
michael@0 73 int32_t contentTypeIndex;
michael@0 74 protected:
michael@0 75 int32_t stateSave;
michael@0 76 private:
michael@0 77 int32_t strBufLen;
michael@0 78 autoJArray<char16_t,int32_t> strBuf;
michael@0 79 nsString* content;
michael@0 80 nsString* charset;
michael@0 81 int32_t httpEquivState;
michael@0 82 public:
michael@0 83 nsHtml5MetaScanner();
michael@0 84 ~nsHtml5MetaScanner();
michael@0 85 protected:
michael@0 86 void stateLoop(int32_t state);
michael@0 87 private:
michael@0 88 void handleCharInAttributeValue(int32_t c);
michael@0 89 inline int32_t toAsciiLowerCase(int32_t c)
michael@0 90 {
michael@0 91 if (c >= 'A' && c <= 'Z') {
michael@0 92 return c + 0x20;
michael@0 93 }
michael@0 94 return c;
michael@0 95 }
michael@0 96
michael@0 97 void addToBuffer(int32_t c);
michael@0 98 void handleAttributeValue();
michael@0 99 bool handleTag();
michael@0 100 bool handleTagInner();
michael@0 101 protected:
michael@0 102 bool tryCharset(nsString* encoding);
michael@0 103 public:
michael@0 104 static void initializeStatics();
michael@0 105 static void releaseStatics();
michael@0 106
michael@0 107 #include "nsHtml5MetaScannerHSupplement.h"
michael@0 108 };
michael@0 109
michael@0 110 #define NS_HTML5META_SCANNER_NO 0
michael@0 111 #define NS_HTML5META_SCANNER_M 1
michael@0 112 #define NS_HTML5META_SCANNER_E 2
michael@0 113 #define NS_HTML5META_SCANNER_T 3
michael@0 114 #define NS_HTML5META_SCANNER_A 4
michael@0 115 #define NS_HTML5META_SCANNER_DATA 0
michael@0 116 #define NS_HTML5META_SCANNER_TAG_OPEN 1
michael@0 117 #define NS_HTML5META_SCANNER_SCAN_UNTIL_GT 2
michael@0 118 #define NS_HTML5META_SCANNER_TAG_NAME 3
michael@0 119 #define NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_NAME 4
michael@0 120 #define NS_HTML5META_SCANNER_ATTRIBUTE_NAME 5
michael@0 121 #define NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_NAME 6
michael@0 122 #define NS_HTML5META_SCANNER_BEFORE_ATTRIBUTE_VALUE 7
michael@0 123 #define NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_DOUBLE_QUOTED 8
michael@0 124 #define NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_SINGLE_QUOTED 9
michael@0 125 #define NS_HTML5META_SCANNER_ATTRIBUTE_VALUE_UNQUOTED 10
michael@0 126 #define NS_HTML5META_SCANNER_AFTER_ATTRIBUTE_VALUE_QUOTED 11
michael@0 127 #define NS_HTML5META_SCANNER_MARKUP_DECLARATION_OPEN 13
michael@0 128 #define NS_HTML5META_SCANNER_MARKUP_DECLARATION_HYPHEN 14
michael@0 129 #define NS_HTML5META_SCANNER_COMMENT_START 15
michael@0 130 #define NS_HTML5META_SCANNER_COMMENT_START_DASH 16
michael@0 131 #define NS_HTML5META_SCANNER_COMMENT 17
michael@0 132 #define NS_HTML5META_SCANNER_COMMENT_END_DASH 18
michael@0 133 #define NS_HTML5META_SCANNER_COMMENT_END 19
michael@0 134 #define NS_HTML5META_SCANNER_SELF_CLOSING_START_TAG 20
michael@0 135 #define NS_HTML5META_SCANNER_HTTP_EQUIV_NOT_SEEN 0
michael@0 136 #define NS_HTML5META_SCANNER_HTTP_EQUIV_CONTENT_TYPE 1
michael@0 137 #define NS_HTML5META_SCANNER_HTTP_EQUIV_OTHER 2
michael@0 138
michael@0 139
michael@0 140 #endif
michael@0 141

mercurial