OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) | 2 * Copyright (C) 2000 Peter Kelly (pmk@post.com) |
3 * Copyright (C) 2005, 2006, 2008, 2014 Apple Inc. All rights reserved. | 3 * Copyright (C) 2005, 2006, 2008, 2014 Apple Inc. All rights reserved. |
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 5 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
7 * Copyright (C) 2008 Holger Hans Peter Freyther | 7 * Copyright (C) 2008 Holger Hans Peter Freyther |
8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 8 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
415 | 415 |
416 // doEnd() call above can detach the parser and null out its document. | 416 // doEnd() call above can detach the parser and null out its document. |
417 // In that case, we just bail out. | 417 // In that case, we just bail out. |
418 if (isDetached()) | 418 if (isDetached()) |
419 return; | 419 return; |
420 | 420 |
421 // doEnd() could process a script tag, thus pausing parsing. | 421 // doEnd() could process a script tag, thus pausing parsing. |
422 if (m_parserPaused) | 422 if (m_parserPaused) |
423 return; | 423 return; |
424 | 424 |
425 if (m_sawError) { | 425 // stopParsing() calls insertErrorMessageBlock() if there was a parsing |
426 // error. Avoid showing the error message block twice. | |
427 if (m_sawError && !isStopped()) { | |
426 insertErrorMessageBlock(); | 428 insertErrorMessageBlock(); |
Erik Dahlström (inactive)
2015/01/14 13:35:41
Under which circumstances would the parser be stop
| |
427 } else { | 429 } else { |
428 exitText(); | 430 exitText(); |
429 document()->styleResolverChanged(); | 431 document()->styleResolverChanged(); |
430 } | 432 } |
431 | 433 |
432 if (isParsing()) | 434 if (isParsing()) |
433 prepareToStopParsing(); | 435 prepareToStopParsing(); |
434 document()->setReadyState(Document::Interactive); | 436 document()->setReadyState(Document::Interactive); |
435 clearCurrentNodeStack(); | 437 clearCurrentNodeStack(); |
436 document()->finishedParsing(); | 438 document()->finishedParsing(); |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1525 TextPosition XMLDocumentParser::textPosition() const | 1527 TextPosition XMLDocumentParser::textPosition() const |
1526 { | 1528 { |
1527 xmlParserCtxtPtr context = this->context(); | 1529 xmlParserCtxtPtr context = this->context(); |
1528 if (!context) | 1530 if (!context) |
1529 return TextPosition::minimumPosition(); | 1531 return TextPosition::minimumPosition(); |
1530 return TextPosition(OrdinalNumber::fromOneBasedInt(context->input->line), Or dinalNumber::fromOneBasedInt(context->input->col)); | 1532 return TextPosition(OrdinalNumber::fromOneBasedInt(context->input->line), Or dinalNumber::fromOneBasedInt(context->input->col)); |
1531 } | 1533 } |
1532 | 1534 |
1533 void XMLDocumentParser::stopParsing() | 1535 void XMLDocumentParser::stopParsing() |
1534 { | 1536 { |
1537 if (!m_parsingFragment && m_sawError && !isStopped()) | |
Erik Dahlström (inactive)
2015/01/14 13:35:41
What about (m_parsingFragment && m_sawError && !is
| |
1538 insertErrorMessageBlock(); | |
1535 DocumentParser::stopParsing(); | 1539 DocumentParser::stopParsing(); |
1536 if (context()) | 1540 if (context()) |
1537 xmlStopParser(context()); | 1541 xmlStopParser(context()); |
1538 } | 1542 } |
1539 | 1543 |
1540 void XMLDocumentParser::resumeParsing() | 1544 void XMLDocumentParser::resumeParsing() |
1541 { | 1545 { |
1542 ASSERT(!isDetached()); | 1546 ASSERT(!isDetached()); |
1543 ASSERT(m_parserPaused); | 1547 ASSERT(m_parserPaused); |
1544 | 1548 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1645 sax.initialized = XML_SAX2_MAGIC; | 1649 sax.initialized = XML_SAX2_MAGIC; |
1646 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); | 1650 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax, &state); |
1647 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; | 1651 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; |
1648 parseChunk(parser->context(), parseString); | 1652 parseChunk(parser->context(), parseString); |
1649 finishParsing(parser->context()); | 1653 finishParsing(parser->context()); |
1650 attrsOK = state.gotAttributes; | 1654 attrsOK = state.gotAttributes; |
1651 return state.attributes; | 1655 return state.attributes; |
1652 } | 1656 } |
1653 | 1657 |
1654 } // namespace blink | 1658 } // namespace blink |
OLD | NEW |