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 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 else if (cc == kEndOfFileMarker) | 1065 else if (cc == kEndOfFileMarker) |
1066 return emitAndReconsumeIn(source, HTMLTokenizer::DataState); | 1066 return emitAndReconsumeIn(source, HTMLTokenizer::DataState); |
1067 else { | 1067 else { |
1068 m_token->appendToComment(cc); | 1068 m_token->appendToComment(cc); |
1069 HTML_ADVANCE_TO(ContinueBogusCommentState); | 1069 HTML_ADVANCE_TO(ContinueBogusCommentState); |
1070 } | 1070 } |
1071 } | 1071 } |
1072 END_STATE() | 1072 END_STATE() |
1073 | 1073 |
1074 HTML_BEGIN_STATE(MarkupDeclarationOpenState) { | 1074 HTML_BEGIN_STATE(MarkupDeclarationOpenState) { |
1075 DEFINE_STATIC_LOCAL(String, dashDashString, (ASCIILiteral("--"))); | 1075 DEFINE_STATIC_LOCAL(String, dashDashString, ("--")); |
1076 DEFINE_STATIC_LOCAL(String, doctypeString, (ASCIILiteral("doctype"))); | 1076 DEFINE_STATIC_LOCAL(String, doctypeString, ("doctype")); |
1077 DEFINE_STATIC_LOCAL(String, cdataString, (ASCIILiteral("[CDATA["))); | 1077 DEFINE_STATIC_LOCAL(String, cdataString, ("[CDATA[")); |
1078 if (cc == '-') { | 1078 if (cc == '-') { |
1079 SegmentedString::LookAheadResult result = source.lookAhead(dashDashS
tring); | 1079 SegmentedString::LookAheadResult result = source.lookAhead(dashDashS
tring); |
1080 if (result == SegmentedString::DidMatch) { | 1080 if (result == SegmentedString::DidMatch) { |
1081 source.advanceAndASSERT('-'); | 1081 source.advanceAndASSERT('-'); |
1082 source.advanceAndASSERT('-'); | 1082 source.advanceAndASSERT('-'); |
1083 m_token->beginComment(); | 1083 m_token->beginComment(); |
1084 HTML_SWITCH_TO(CommentStartState); | 1084 HTML_SWITCH_TO(CommentStartState); |
1085 } else if (result == SegmentedString::NotEnoughCharacters) | 1085 } else if (result == SegmentedString::NotEnoughCharacters) |
1086 return haveBufferedCharacterToken(); | 1086 return haveBufferedCharacterToken(); |
1087 } else if (cc == 'D' || cc == 'd') { | 1087 } else if (cc == 'D' || cc == 'd') { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 HTML_BEGIN_STATE(AfterDOCTYPENameState) { | 1268 HTML_BEGIN_STATE(AfterDOCTYPENameState) { |
1269 if (isTokenizerWhitespace(cc)) | 1269 if (isTokenizerWhitespace(cc)) |
1270 HTML_ADVANCE_TO(AfterDOCTYPENameState); | 1270 HTML_ADVANCE_TO(AfterDOCTYPENameState); |
1271 if (cc == '>') | 1271 if (cc == '>') |
1272 return emitAndResumeIn(source, HTMLTokenizer::DataState); | 1272 return emitAndResumeIn(source, HTMLTokenizer::DataState); |
1273 else if (cc == kEndOfFileMarker) { | 1273 else if (cc == kEndOfFileMarker) { |
1274 parseError(); | 1274 parseError(); |
1275 m_token->setForceQuirks(); | 1275 m_token->setForceQuirks(); |
1276 return emitAndReconsumeIn(source, HTMLTokenizer::DataState); | 1276 return emitAndReconsumeIn(source, HTMLTokenizer::DataState); |
1277 } else { | 1277 } else { |
1278 DEFINE_STATIC_LOCAL(String, publicString, (ASCIILiteral("public"))); | 1278 DEFINE_STATIC_LOCAL(String, publicString, ("public")); |
1279 DEFINE_STATIC_LOCAL(String, systemString, (ASCIILiteral("system"))); | 1279 DEFINE_STATIC_LOCAL(String, systemString, ("system")); |
1280 if (cc == 'P' || cc == 'p') { | 1280 if (cc == 'P' || cc == 'p') { |
1281 SegmentedString::LookAheadResult result = source.lookAheadIgnori
ngCase(publicString); | 1281 SegmentedString::LookAheadResult result = source.lookAheadIgnori
ngCase(publicString); |
1282 if (result == SegmentedString::DidMatch) { | 1282 if (result == SegmentedString::DidMatch) { |
1283 advanceStringAndASSERTIgnoringCase(source, "public"); | 1283 advanceStringAndASSERTIgnoringCase(source, "public"); |
1284 HTML_SWITCH_TO(AfterDOCTYPEPublicKeywordState); | 1284 HTML_SWITCH_TO(AfterDOCTYPEPublicKeywordState); |
1285 } else if (result == SegmentedString::NotEnoughCharacters) | 1285 } else if (result == SegmentedString::NotEnoughCharacters) |
1286 return haveBufferedCharacterToken(); | 1286 return haveBufferedCharacterToken(); |
1287 } else if (cc == 'S' || cc == 's') { | 1287 } else if (cc == 'S' || cc == 's') { |
1288 SegmentedString::LookAheadResult result = source.lookAheadIgnori
ngCase(systemString); | 1288 SegmentedString::LookAheadResult result = source.lookAheadIgnori
ngCase(systemString); |
1289 if (result == SegmentedString::DidMatch) { | 1289 if (result == SegmentedString::DidMatch) { |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 | 1639 |
1640 return true; | 1640 return true; |
1641 } | 1641 } |
1642 | 1642 |
1643 inline void HTMLTokenizer::parseError() | 1643 inline void HTMLTokenizer::parseError() |
1644 { | 1644 { |
1645 notImplemented(); | 1645 notImplemented(); |
1646 } | 1646 } |
1647 | 1647 |
1648 } | 1648 } |
OLD | NEW |