Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: Source/core/inspector/DOMPatchSupport.cpp

Issue 18808004: Refactoring: Extract DocumentInit for capture Document construction parameter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed webkit_unit_tests build failure. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/TextDocument.cpp ('k') | Source/core/loader/DocumentLoader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 , m_document(document) 79 , m_document(document)
80 { 80 {
81 } 81 }
82 82
83 DOMPatchSupport::~DOMPatchSupport() { } 83 DOMPatchSupport::~DOMPatchSupport() { }
84 84
85 void DOMPatchSupport::patchDocument(const String& markup) 85 void DOMPatchSupport::patchDocument(const String& markup)
86 { 86 {
87 RefPtr<Document> newDocument; 87 RefPtr<Document> newDocument;
88 if (m_document->isHTMLDocument()) 88 if (m_document->isHTMLDocument())
89 newDocument = HTMLDocument::create(0, KURL()); 89 newDocument = HTMLDocument::create();
90 else if (m_document->isXHTMLDocument()) 90 else if (m_document->isXHTMLDocument())
91 newDocument = HTMLDocument::createXHTML(0, KURL()); 91 newDocument = HTMLDocument::createXHTML();
92 else if (m_document->isSVGDocument()) 92 else if (m_document->isSVGDocument())
93 newDocument = Document::create(0, KURL()); 93 newDocument = Document::create();
94 94
95 ASSERT(newDocument); 95 ASSERT(newDocument);
96 newDocument->setContextFeatures(m_document->contextFeatures()); 96 newDocument->setContextFeatures(m_document->contextFeatures());
97 RefPtr<DocumentParser> parser; 97 RefPtr<DocumentParser> parser;
98 if (m_document->isHTMLDocument()) 98 if (m_document->isHTMLDocument())
99 parser = HTMLDocumentParser::create(static_cast<HTMLDocument*>(newDocume nt.get()), false); 99 parser = HTMLDocumentParser::create(static_cast<HTMLDocument*>(newDocume nt.get()), false);
100 else 100 else
101 parser = XMLDocumentParser::create(newDocument.get(), 0); 101 parser = XMLDocumentParser::create(newDocument.get(), 0);
102 parser->insert(markup); // Use insert() so that the parser will not yield. 102 parser->insert(markup); // Use insert() so that the parser will not yield.
103 parser->finish(); 103 parser->finish();
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name) 509 void DOMPatchSupport::dumpMap(const ResultMap& map, const String& name)
510 { 510 {
511 fprintf(stderr, "\n\n"); 511 fprintf(stderr, "\n\n");
512 for (size_t i = 0; i < map.size(); ++i) 512 for (size_t i = 0; i < map.size(); ++i)
513 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); 513 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);
514 } 514 }
515 #endif 515 #endif
516 516
517 } // namespace WebCore 517 } // namespace WebCore
518 518
OLDNEW
« no previous file with comments | « Source/core/html/TextDocument.cpp ('k') | Source/core/loader/DocumentLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698