|
Lines 314-320
HTMLTokenizer::State HTMLTokenizer::processListing(SegmentedString list, State s
a/WebCore/html/HTMLTokenizer.cpp_sec1
|
| 314 |
return state; |
314 |
return state; |
| 315 |
} |
315 |
} |
| 316 |
|
316 |
|
| 317 |
HTMLTokenizer::State HTMLTokenizer::parseSpecial(SegmentedString& src, State state) |
317 |
HTMLTokenizer::State HTMLTokenizer::parseNonHTMLText(SegmentedString& src, State state) |
| 318 |
{ |
318 |
{ |
| 319 |
ASSERT(state.inTextArea() || state.inTitle() || state.inIFrame() || !state.hasEntityState()); |
319 |
ASSERT(state.inTextArea() || state.inTitle() || state.inIFrame() || !state.hasEntityState()); |
| 320 |
ASSERT(!state.hasTagState()); |
320 |
ASSERT(!state.hasTagState()); |
|
Lines 1471-1476
HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
a/WebCore/html/HTMLTokenizer.cpp_sec2
|
| 1471 |
RefPtr<Node> n = processToken(); |
1471 |
RefPtr<Node> n = processToken(); |
| 1472 |
m_cBufferPos = cBufferPos; |
1472 |
m_cBufferPos = cBufferPos; |
| 1473 |
if (n || inViewSourceMode()) { |
1473 |
if (n || inViewSourceMode()) { |
|
|
1474 |
State savedState = state; |
| 1475 |
SegmentedString savedSrc = src; |
| 1476 |
long savedLineno = m_lineNumber; |
| 1474 |
if ((tagName == preTag || tagName == listingTag) && !inViewSourceMode()) { |
1477 |
if ((tagName == preTag || tagName == listingTag) && !inViewSourceMode()) { |
| 1475 |
if (beginTag) |
1478 |
if (beginTag) |
| 1476 |
state.setDiscardLF(true); // Discard the first LF after we open a pre. |
1479 |
state.setDiscardLF(true); // Discard the first LF after we open a pre. |
|
Lines 1483-1489
HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
a/WebCore/html/HTMLTokenizer.cpp_sec3
|
| 1483 |
m_searchStopper = scriptEnd; |
1486 |
m_searchStopper = scriptEnd; |
| 1484 |
m_searchStopperLength = 8; |
1487 |
m_searchStopperLength = 8; |
| 1485 |
state.setInScript(true); |
1488 |
state.setInScript(true); |
| 1486 |
state = parseSpecial(src, state); |
1489 |
state = parseNonHTMLText(src, state); |
| 1487 |
} else if (isSelfClosingScript) { // Handle <script src="foo"/> |
1490 |
} else if (isSelfClosingScript) { // Handle <script src="foo"/> |
| 1488 |
state.setInScript(true); |
1491 |
state.setInScript(true); |
| 1489 |
state = scriptHandler(state); |
1492 |
state = scriptHandler(state); |
|
Lines 1493-1545
HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state)
a/WebCore/html/HTMLTokenizer.cpp_sec4
|
| 1493 |
m_searchStopper = styleEnd; |
1496 |
m_searchStopper = styleEnd; |
| 1494 |
m_searchStopperLength = 7; |
1497 |
m_searchStopperLength = 7; |
| 1495 |
state.setInStyle(true); |
1498 |
state.setInStyle(true); |
| 1496 |
state = parseSpecial(src, state); |
1499 |
state = parseNonHTMLText(src, state); |
| 1497 |
} |
1500 |
} |
| 1498 |
} else if (tagName == textareaTag) { |
1501 |
} else if (tagName == textareaTag) { |
| 1499 |
if (beginTag) { |
1502 |
if (beginTag) { |
| 1500 |
m_searchStopper = textareaEnd; |
1503 |
m_searchStopper = textareaEnd; |
| 1501 |
m_searchStopperLength = 10; |
1504 |
m_searchStopperLength = 10; |
| 1502 |
state.setInTextArea(true); |
1505 |
state.setInTextArea(true); |
| 1503 |
state = parseSpecial(src, state); |
1506 |
state = parseNonHTMLText(src, state); |
| 1504 |
} |
1507 |
} |
| 1505 |
} else if (tagName == titleTag) { |
1508 |
} else if (tagName == titleTag) { |
| 1506 |
if (beginTag) { |
1509 |
if (beginTag) { |
| 1507 |
m_searchStopper = titleEnd; |
1510 |
m_searchStopper = titleEnd; |
| 1508 |
m_searchStopperLength = 7; |
1511 |
m_searchStopperLength = 7; |
| 1509 |
State savedState = state; |
|
|
| 1510 |
SegmentedString savedSrc = src; |
| 1511 |
long savedLineno = m_lineNumber; |
| 1512 |
state.setInTitle(true); |
1512 |
state.setInTitle(true); |
| 1513 |
state = parseSpecial(src, state); |
1513 |
state = parseNonHTMLText(src, state); |
| 1514 |
if (state.inTitle() && src.isEmpty()) { |
|
|
| 1515 |
// We just ate the rest of the document as the title #text node! |
| 1516 |
// Reset the state then retokenize without special title handling. |
| 1517 |
// Let the parser clean up the missing </title> tag. |
| 1518 |
// FIXME: This is incorrect, because src.isEmpty() doesn't mean we're |
| 1519 |
// at the end of the document unless m_noMoreData is also true. We need |
| 1520 |
// to detect this case elsewhere, and save the state somewhere other |
| 1521 |
// than a local variable. |
| 1522 |
state = savedState; |
| 1523 |
src = savedSrc; |
| 1524 |
m_lineNumber = savedLineno; |
| 1525 |
m_scriptCodeSize = 0; |
| 1526 |
} |
| 1527 |
} |
1514 |
} |
| 1528 |
} else if (tagName == xmpTag) { |
1515 |
} else if (tagName == xmpTag) { |
| 1529 |
if (beginTag) { |
1516 |
if (beginTag) { |
| 1530 |
m_searchStopper = xmpEnd; |
1517 |
m_searchStopper = xmpEnd; |
| 1531 |
m_searchStopperLength = 5; |
1518 |
m_searchStopperLength = 5; |
| 1532 |
state.setInXmp(true); |
1519 |
state.setInXmp(true); |
| 1533 |
state = parseSpecial(src, state); |
1520 |
state = parseNonHTMLText(src, state); |
| 1534 |
} |
1521 |
} |
| 1535 |
} else if (tagName == iframeTag) { |
1522 |
} else if (tagName == iframeTag) { |
| 1536 |
if (beginTag) { |
1523 |
if (beginTag) { |
| 1537 |
m_searchStopper = iframeEnd; |
1524 |
m_searchStopper = iframeEnd; |
| 1538 |
m_searchStopperLength = 8; |
1525 |
m_searchStopperLength = 8; |
| 1539 |
state.setInIFrame(true); |
1526 |
state.setInIFrame(true); |
| 1540 |
state = parseSpecial(src, state); |
1527 |
state = parseNonHTMLText(src, state); |
| 1541 |
} |
1528 |
} |
| 1542 |
} |
1529 |
} |
|
|
1530 |
if (src.isEmpty() && state.inAnyNonHTMLText() && !(state.inScript() && m_currentScriptTagStartLineNumber)) { |
| 1531 |
// We just ate the rest of the document as the #text node under the special tag! |
| 1532 |
// Reset the state then retokenize without special handling. |
| 1533 |
// Let the parser clean up the missing close tag. |
| 1534 |
// FIXME: This is incorrect, because src.isEmpty() doesn't mean we're |
| 1535 |
// at the end of the document unless m_noMoreData is also true. We need |
| 1536 |
// to detect this case elsewhere, and save the state somewhere other |
| 1537 |
// than a local variable. |
| 1538 |
state = savedState; |
| 1539 |
src = savedSrc; |
| 1540 |
m_lineNumber = savedLineno; |
| 1541 |
m_scriptCodeSize = 0; |
| 1542 |
} |
| 1543 |
} |
1543 |
} |
| 1544 |
if (tagName == plaintextTag) |
1544 |
if (tagName == plaintextTag) |
| 1545 |
state.setInPlainText(beginTag); |
1545 |
state.setInPlainText(beginTag); |
|
Lines 1655-1662
void HTMLTokenizer::write(const SegmentedString& str, bool appendData)
a/WebCore/html/HTMLTokenizer.cpp_sec5
|
| 1655 |
state = parseEntity(m_src, m_dest, state, m_cBufferPos, false, state.hasTagState()); |
1655 |
state = parseEntity(m_src, m_dest, state, m_cBufferPos, false, state.hasTagState()); |
| 1656 |
else if (state.inPlainText()) |
1656 |
else if (state.inPlainText()) |
| 1657 |
state = parseText(m_src, state); |
1657 |
state = parseText(m_src, state); |
| 1658 |
else if (state.inAnySpecial()) |
1658 |
else if (state.inAnyNonHTMLText()) |
| 1659 |
state = parseSpecial(m_src, state); |
1659 |
state = parseNonHTMLText(m_src, state); |
| 1660 |
else if (state.inComment()) |
1660 |
else if (state.inComment()) |
| 1661 |
state = parseComment(m_src, state); |
1661 |
state = parseComment(m_src, state); |
| 1662 |
else if (state.inDoctype()) |
1662 |
else if (state.inDoctype()) |