Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLTokenizer.cpp

Issue 2576373002: Fix HTML parser CDATA edge-case and sync state names with spec (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLTokenizer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after
1488 if (cc == '>') 1488 if (cc == '>')
1489 return emitAndResumeIn(source, HTMLTokenizer::DataState); 1489 return emitAndResumeIn(source, HTMLTokenizer::DataState);
1490 else if (cc == kEndOfFileMarker) 1490 else if (cc == kEndOfFileMarker)
1491 return emitAndReconsumeIn(source, HTMLTokenizer::DataState); 1491 return emitAndReconsumeIn(source, HTMLTokenizer::DataState);
1492 HTML_ADVANCE_TO(BogusDOCTYPEState); 1492 HTML_ADVANCE_TO(BogusDOCTYPEState);
1493 } 1493 }
1494 END_STATE() 1494 END_STATE()
1495 1495
1496 HTML_BEGIN_STATE(CDATASectionState) { 1496 HTML_BEGIN_STATE(CDATASectionState) {
1497 if (cc == ']') 1497 if (cc == ']')
1498 HTML_ADVANCE_TO(CDATASectionRightSquareBracketState); 1498 HTML_ADVANCE_TO(CDATASectionBracketState);
1499 else if (cc == kEndOfFileMarker) 1499 else if (cc == kEndOfFileMarker)
1500 HTML_RECONSUME_IN(DataState); 1500 HTML_RECONSUME_IN(DataState);
1501 else { 1501 else {
1502 bufferCharacter(cc); 1502 bufferCharacter(cc);
1503 HTML_ADVANCE_TO(CDATASectionState); 1503 HTML_ADVANCE_TO(CDATASectionState);
1504 } 1504 }
1505 } 1505 }
1506 END_STATE() 1506 END_STATE()
1507 1507
1508 HTML_BEGIN_STATE(CDATASectionRightSquareBracketState) { 1508 HTML_BEGIN_STATE(CDATASectionBracketState) {
1509 if (cc == ']') 1509 if (cc == ']')
1510 HTML_ADVANCE_TO(CDATASectionDoubleRightSquareBracketState); 1510 HTML_ADVANCE_TO(CDATASectionEndState);
1511 else { 1511 else {
1512 bufferCharacter(']'); 1512 bufferCharacter(']');
1513 HTML_RECONSUME_IN(CDATASectionState); 1513 HTML_RECONSUME_IN(CDATASectionState);
1514 } 1514 }
1515 } 1515 }
1516 1516
1517 HTML_BEGIN_STATE(CDATASectionDoubleRightSquareBracketState) { 1517 HTML_BEGIN_STATE(CDATASectionEndState) {
1518 if (cc == '>') 1518 if (cc == ']') {
1519 bufferCharacter(']');
1520 HTML_ADVANCE_TO(CDATASectionEndState);
1521 } else if (cc == '>') {
1519 HTML_ADVANCE_TO(DataState); 1522 HTML_ADVANCE_TO(DataState);
1520 else { 1523 } else {
1521 bufferCharacter(']'); 1524 bufferCharacter(']');
1522 bufferCharacter(']'); 1525 bufferCharacter(']');
1523 HTML_RECONSUME_IN(CDATASectionState); 1526 HTML_RECONSUME_IN(CDATASectionState);
1524 } 1527 }
1525 } 1528 }
1526 END_STATE() 1529 END_STATE()
1527 } 1530 }
1528 1531
1529 ASSERT_NOT_REACHED(); 1532 ASSERT_NOT_REACHED();
1530 return false; 1533 return false;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 } 1581 }
1579 1582
1580 return true; 1583 return true;
1581 } 1584 }
1582 1585
1583 inline void HTMLTokenizer::parseError() { 1586 inline void HTMLTokenizer::parseError() {
1584 DVLOG(1) << "Not implemented."; 1587 DVLOG(1) << "Not implemented.";
1585 } 1588 }
1586 1589
1587 } // namespace blink 1590 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLTokenizer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698