OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 , m_document(document) | 82 , m_document(document) |
83 { | 83 { |
84 } | 84 } |
85 | 85 |
86 DOMPatchSupport::~DOMPatchSupport() { } | 86 DOMPatchSupport::~DOMPatchSupport() { } |
87 | 87 |
88 void DOMPatchSupport::patchDocument(const String& markup) | 88 void DOMPatchSupport::patchDocument(const String& markup) |
89 { | 89 { |
90 RefPtr<Document> newDocument; | 90 RefPtr<Document> newDocument; |
91 if (m_document->isHTMLDocument()) | 91 if (m_document->isHTMLDocument()) |
92 newDocument = HTMLDocument::create(0, KURL()); | 92 newDocument = HTMLDocument::create(); |
93 else if (m_document->isXHTMLDocument()) | 93 else if (m_document->isXHTMLDocument()) |
94 newDocument = HTMLDocument::createXHTML(0, KURL()); | 94 newDocument = HTMLDocument::createXHTML(); |
95 else if (m_document->isSVGDocument()) | 95 else if (m_document->isSVGDocument()) |
96 newDocument = Document::create(0, KURL()); | 96 newDocument = Document::create(); |
97 | 97 |
98 ASSERT(newDocument); | 98 ASSERT(newDocument); |
99 newDocument->setContextFeatures(m_document->contextFeatures()); | 99 newDocument->setContextFeatures(m_document->contextFeatures()); |
100 RefPtr<DocumentParser> parser; | 100 RefPtr<DocumentParser> parser; |
101 if (m_document->isHTMLDocument()) | 101 if (m_document->isHTMLDocument()) |
102 parser = HTMLDocumentParser::create(static_cast<HTMLDocument*>(newDocume
nt.get()), false); | 102 parser = HTMLDocumentParser::create(static_cast<HTMLDocument*>(newDocume
nt.get()), false); |
103 else | 103 else |
104 parser = XMLDocumentParser::create(newDocument.get(), 0); | 104 parser = XMLDocumentParser::create(newDocument.get(), 0); |
105 parser->insert(markup); // Use insert() so that the parser will not yield. | 105 parser->insert(markup); // Use insert() so that the parser will not yield. |
106 parser->finish(); | 106 parser->finish(); |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name) | 512 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name) |
513 { | 513 { |
514 fprintf(stderr, "\n\n"); | 514 fprintf(stderr, "\n\n"); |
515 for (size_t i = 0; i < map.size(); ++i) | 515 for (size_t i = 0; i < map.size(); ++i) |
516 fprintf(stderr, "%s[%lu]: %s (%p) - [%lu]\n", name.utf8().data(), i, map
[i].first ? nodeName(map[i].first->m_node).utf8().data() : "", map[i].first, map
[i].second); | 516 fprintf(stderr, "%s[%lu]: %s (%p) - [%lu]\n", name.utf8().data(), i, map
[i].first ? nodeName(map[i].first->m_node).utf8().data() : "", map[i].first, map
[i].second); |
517 } | 517 } |
518 #endif | 518 #endif |
519 | 519 |
520 } // namespace WebCore | 520 } // namespace WebCore |
521 | 521 |
OLD | NEW |