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 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 |
11 * modify it under the terms of the GNU Library General Public | 11 * modify it under the terms of the GNU Library General Public |
12 * License as published by the Free Software Foundation; either | 12 * License as published by the Free Software Foundation; either |
13 * version 2 of the License, or (at your option) any later version. | 13 * version 2 of the License, or (at your option) any later version. |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 } | 498 } |
499 | 499 |
500 bool XMLDocumentParser::parseDocumentFragment(const String& chunk, DocumentFragm
ent* fragment, Element* contextElement, ParserContentPolicy parserContentPolicy) | 500 bool XMLDocumentParser::parseDocumentFragment(const String& chunk, DocumentFragm
ent* fragment, Element* contextElement, ParserContentPolicy parserContentPolicy) |
501 { | 501 { |
502 if (!chunk.length()) | 502 if (!chunk.length()) |
503 return true; | 503 return true; |
504 | 504 |
505 // FIXME: We need to implement the HTML5 XML Fragment parsing algorithm: | 505 // FIXME: We need to implement the HTML5 XML Fragment parsing algorithm: |
506 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-xhtml-syn
tax.html#xml-fragment-parsing-algorithm | 506 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-xhtml-syn
tax.html#xml-fragment-parsing-algorithm |
507 // For now we have a hack for script/style innerHTML support: | 507 // For now we have a hack for script/style innerHTML support: |
508 if (contextElement && (contextElement->hasLocalName(HTMLNames::scriptTag) ||
contextElement->hasLocalName(HTMLNames::styleTag))) { | 508 if (contextElement && (contextElement->hasLocalName(scriptTag.localName()) |
| contextElement->hasLocalName(styleTag.localName()))) { |
509 fragment->parserAppendChild(fragment->document().createTextNode(chunk)); | 509 fragment->parserAppendChild(fragment->document().createTextNode(chunk)); |
510 return true; | 510 return true; |
511 } | 511 } |
512 | 512 |
513 RefPtrWillBeRawPtr<XMLDocumentParser> parser = XMLDocumentParser::create(fra
gment, contextElement, parserContentPolicy); | 513 RefPtrWillBeRawPtr<XMLDocumentParser> parser = XMLDocumentParser::create(fra
gment, contextElement, parserContentPolicy); |
514 bool wellFormed = parser->appendFragmentSource(chunk); | 514 bool wellFormed = parser->appendFragmentSource(chunk); |
515 | 515 |
516 // Do not call finish(). Current finish() and doEnd() implementations touch | 516 // Do not call finish(). Current finish() and doEnd() implementations touch |
517 // the main Document/loader and can cause crashes in the fragment case. | 517 // the main Document/loader and can cause crashes in the fragment case. |
518 | 518 |
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 sax.initialized = XML_SAX2_MAGIC; | 1631 sax.initialized = XML_SAX2_MAGIC; |
1632 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax,
&state); | 1632 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax,
&state); |
1633 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; | 1633 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; |
1634 parseChunk(parser->context(), parseString); | 1634 parseChunk(parser->context(), parseString); |
1635 finishParsing(parser->context()); | 1635 finishParsing(parser->context()); |
1636 attrsOK = state.gotAttributes; | 1636 attrsOK = state.gotAttributes; |
1637 return state.attributes; | 1637 return state.attributes; |
1638 } | 1638 } |
1639 | 1639 |
1640 } // namespace blink | 1640 } // namespace blink |
OLD | NEW |