| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ | 3 * Copyright (C) 2009 Torch Mobile, Inc. http://www.torchmobile.com/ |
| 4 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 4 * Copyright (C) 2010 Google, Inc. All Rights Reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 HTML_ADVANCE_TO(ScriptDataLessThanSignState); | 236 HTML_ADVANCE_TO(ScriptDataLessThanSignState); |
| 237 else if (cc == kEndOfFileMarker) | 237 else if (cc == kEndOfFileMarker) |
| 238 return emitEndOfFile(source); | 238 return emitEndOfFile(source); |
| 239 else { | 239 else { |
| 240 bufferCharacter(cc); | 240 bufferCharacter(cc); |
| 241 HTML_ADVANCE_TO(ScriptDataState); | 241 HTML_ADVANCE_TO(ScriptDataState); |
| 242 } | 242 } |
| 243 } | 243 } |
| 244 END_STATE() | 244 END_STATE() |
| 245 | 245 |
| 246 HTML_BEGIN_STATE(PLAINTEXTState) { | |
| 247 if (cc == kEndOfFileMarker) | |
| 248 return emitEndOfFile(source); | |
| 249 bufferCharacter(cc); | |
| 250 HTML_ADVANCE_TO(PLAINTEXTState); | |
| 251 } | |
| 252 END_STATE() | |
| 253 | |
| 254 HTML_BEGIN_STATE(TagOpenState) { | 246 HTML_BEGIN_STATE(TagOpenState) { |
| 255 if (cc == '!') | 247 if (cc == '!') |
| 256 HTML_ADVANCE_TO(MarkupDeclarationOpenState); | 248 HTML_ADVANCE_TO(MarkupDeclarationOpenState); |
| 257 else if (cc == '/') | 249 else if (cc == '/') |
| 258 HTML_ADVANCE_TO(EndTagOpenState); | 250 HTML_ADVANCE_TO(EndTagOpenState); |
| 259 else if (isASCIIUpper(cc)) { | 251 else if (isASCIIUpper(cc)) { |
| 260 m_token->beginStartTag(toLowerCase(cc)); | 252 m_token->beginStartTag(toLowerCase(cc)); |
| 261 HTML_ADVANCE_TO(TagNameState); | 253 HTML_ADVANCE_TO(TagNameState); |
| 262 } else if (isASCIILower(cc)) { | 254 } else if (isASCIILower(cc)) { |
| 263 m_token->beginStartTag(cc); | 255 m_token->beginStartTag(cc); |
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 } | 1062 } |
| 1071 } | 1063 } |
| 1072 END_STATE() | 1064 END_STATE() |
| 1073 | 1065 |
| 1074 } | 1066 } |
| 1075 | 1067 |
| 1076 ASSERT_NOT_REACHED(); | 1068 ASSERT_NOT_REACHED(); |
| 1077 return false; | 1069 return false; |
| 1078 } | 1070 } |
| 1079 | 1071 |
| 1080 String HTMLTokenizer::bufferedCharacters() const | |
| 1081 { | |
| 1082 // FIXME: Add an assert about m_state. | |
| 1083 StringBuilder characters; | |
| 1084 characters.reserveCapacity(numberOfBufferedCharacters()); | |
| 1085 characters.append('<'); | |
| 1086 characters.append('/'); | |
| 1087 characters.append(m_temporaryBuffer.data(), m_temporaryBuffer.size()); | |
| 1088 return characters.toString(); | |
| 1089 } | |
| 1090 | |
| 1091 void HTMLTokenizer::updateStateFor(const String& tagName) | |
| 1092 { | |
| 1093 if (threadSafeMatch(tagName, HTMLNames::scriptTag)) | |
| 1094 setState(HTMLTokenizer::ScriptDataState); | |
| 1095 else if (threadSafeMatch(tagName, HTMLNames::styleTag)) | |
| 1096 setState(HTMLTokenizer::RAWTEXTState); | |
| 1097 } | |
| 1098 | |
| 1099 inline bool HTMLTokenizer::temporaryBufferIs(const String& expectedString) | 1072 inline bool HTMLTokenizer::temporaryBufferIs(const String& expectedString) |
| 1100 { | 1073 { |
| 1101 return vectorEqualsString(m_temporaryBuffer, expectedString); | 1074 return vectorEqualsString(m_temporaryBuffer, expectedString); |
| 1102 } | 1075 } |
| 1103 | 1076 |
| 1104 inline void HTMLTokenizer::addToPossibleEndTag(LChar cc) | 1077 inline void HTMLTokenizer::addToPossibleEndTag(LChar cc) |
| 1105 { | 1078 { |
| 1106 ASSERT(isEndTagBufferingState(m_state)); | 1079 ASSERT(isEndTagBufferingState(m_state)); |
| 1107 m_bufferedEndTagName.append(cc); | 1080 m_bufferedEndTagName.append(cc); |
| 1108 } | 1081 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1121 | 1094 |
| 1122 return true; | 1095 return true; |
| 1123 } | 1096 } |
| 1124 | 1097 |
| 1125 inline void HTMLTokenizer::parseError() | 1098 inline void HTMLTokenizer::parseError() |
| 1126 { | 1099 { |
| 1127 notImplemented(); | 1100 notImplemented(); |
| 1128 } | 1101 } |
| 1129 | 1102 |
| 1130 } | 1103 } |
| OLD | NEW |