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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 436 |
437 // doEnd() call above can detach the parser and null out its document. | 437 // doEnd() call above can detach the parser and null out its document. |
438 // In that case, we just bail out. | 438 // In that case, we just bail out. |
439 if (isDetached()) | 439 if (isDetached()) |
440 return; | 440 return; |
441 | 441 |
442 // doEnd() could process a script tag, thus pausing parsing. | 442 // doEnd() could process a script tag, thus pausing parsing. |
443 if (m_parserPaused) | 443 if (m_parserPaused) |
444 return; | 444 return; |
445 | 445 |
446 if (m_sawError) { | 446 if (m_sawError) |
447 insertErrorMessageBlock(); | 447 insertErrorMessageBlock(); |
448 } else { | 448 else |
449 updateLeafTextNode(); | 449 updateLeafTextNode(); |
450 // Do not bail out if in a stopped state, but notify document that | |
451 // parsing has finished. | |
452 document()->styleEngine().resolverChanged(FullStyleUpdate); | |
453 } | |
454 | 450 |
455 if (isParsing()) | 451 if (isParsing()) |
456 prepareToStopParsing(); | 452 prepareToStopParsing(); |
457 document()->setReadyState(Document::Interactive); | 453 document()->setReadyState(Document::Interactive); |
458 clearCurrentNodeStack(); | 454 clearCurrentNodeStack(); |
459 document()->finishedParsing(); | 455 document()->finishedParsing(); |
460 } | 456 } |
461 | 457 |
462 void XMLDocumentParser::finish() | 458 void XMLDocumentParser::finish() |
463 { | 459 { |
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 } | 1525 } |
1530 | 1526 |
1531 bool xmlViewerMode = !m_sawError && !m_sawCSS && !m_sawXSLTransform && hasNo
StyleInformation(document()); | 1527 bool xmlViewerMode = !m_sawError && !m_sawCSS && !m_sawXSLTransform && hasNo
StyleInformation(document()); |
1532 if (xmlViewerMode) { | 1528 if (xmlViewerMode) { |
1533 const char noStyleMessage[] = "This XML file does not appear to have any
style information associated with it. The document tree is shown below."; | 1529 const char noStyleMessage[] = "This XML file does not appear to have any
style information associated with it. The document tree is shown below."; |
1534 document()->setIsViewSource(true); | 1530 document()->setIsViewSource(true); |
1535 V8Document::PrivateScript::transformDocumentToTreeViewMethod(document()-
>frame(), document(), noStyleMessage); | 1531 V8Document::PrivateScript::transformDocumentToTreeViewMethod(document()-
>frame(), document(), noStyleMessage); |
1536 } else if (m_sawXSLTransform) { | 1532 } else if (m_sawXSLTransform) { |
1537 xmlDocPtr doc = xmlDocPtrForString(document(), m_originalSourceForTransf
orm.toString(), document()->url().getString()); | 1533 xmlDocPtr doc = xmlDocPtrForString(document(), m_originalSourceForTransf
orm.toString(), document()->url().getString()); |
1538 document()->setTransformSource(adoptPtr(new TransformSource(doc))); | 1534 document()->setTransformSource(adoptPtr(new TransformSource(doc))); |
1539 // Make the document think it's done, so it will apply XSL stylesheets. | |
1540 document()->setParsingState(Document::FinishedParsing); | |
1541 document()->styleEngine().resolverChanged(FullStyleUpdate); | |
1542 | |
1543 // resolverChanged() call can detach the parser and null out its | |
1544 // document. In that case, we just bail out. | |
1545 if (isDetached()) | |
1546 return; | |
1547 | |
1548 document()->setParsingState(Document::Parsing); | |
1549 DocumentParser::stopParsing(); | 1535 DocumentParser::stopParsing(); |
1550 } | 1536 } |
1551 } | 1537 } |
1552 | 1538 |
1553 xmlDocPtr xmlDocPtrForString(Document* document, const String& source, const Str
ing& url) | 1539 xmlDocPtr xmlDocPtrForString(Document* document, const String& source, const Str
ing& url) |
1554 { | 1540 { |
1555 if (source.isEmpty()) | 1541 if (source.isEmpty()) |
1556 return 0; | 1542 return 0; |
1557 // Parse in a single chunk into an xmlDocPtr | 1543 // Parse in a single chunk into an xmlDocPtr |
1558 // FIXME: Hook up error handlers so that a failure to parse the main | 1544 // FIXME: Hook up error handlers so that a failure to parse the main |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1695 sax.initialized = XML_SAX2_MAGIC; | 1681 sax.initialized = XML_SAX2_MAGIC; |
1696 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax,
&state); | 1682 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax,
&state); |
1697 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; | 1683 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; |
1698 parseChunk(parser->context(), parseString); | 1684 parseChunk(parser->context(), parseString); |
1699 finishParsing(parser->context()); | 1685 finishParsing(parser->context()); |
1700 attrsOK = state.gotAttributes; | 1686 attrsOK = state.gotAttributes; |
1701 return state.attributes; | 1687 return state.attributes; |
1702 } | 1688 } |
1703 | 1689 |
1704 } // namespace blink | 1690 } // namespace blink |
OLD | NEW |