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

Unified Diff: Source/core/xml/parser/XMLDocumentParser.cpp

Issue 22150003: XMLTreeViewer should be created only in the XML viewer mode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/xml/XMLTreeViewer.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/parser/XMLDocumentParser.cpp
diff --git a/Source/core/xml/parser/XMLDocumentParser.cpp b/Source/core/xml/parser/XMLDocumentParser.cpp
index 34cd18877cede843e6358f7102b6118c71e95412..af2980695922864fd0c0faa037e520a4ff24206f 100644
--- a/Source/core/xml/parser/XMLDocumentParser.cpp
+++ b/Source/core/xml/parser/XMLDocumentParser.cpp
@@ -97,6 +97,20 @@ static inline AtomicString toAtomicString(const xmlChar* string)
return AtomicString::fromUTF8(reinterpret_cast<const char*>(string));
}
+static inline bool hasNoStyleInformation(Document* document)
+{
+ if (document->sawElementsInKnownNamespaces() || document->transformSourceDocument())
+ return false;
+
+ if (!document->frame() || !document->frame()->page())
+ return false;
+
+ if (document->frame()->tree()->parent())
+ return false; // This document is not in a top frame
+
+ return true;
+}
+
class PendingStartElementNSCallback FINAL : public XMLDocumentParser::PendingCallback {
public:
PendingStartElementNSCallback(const AtomicString& localName, const AtomicString& prefix, const AtomicString& uri,
@@ -1439,9 +1453,9 @@ void XMLDocumentParser::doEnd()
}
}
- XMLTreeViewer xmlTreeViewer(document());
- bool xmlViewerMode = !m_sawError && !m_sawCSS && !m_sawXSLTransform && xmlTreeViewer.hasNoStyleInformation();
+ bool xmlViewerMode = !m_sawError && !m_sawCSS && !m_sawXSLTransform && hasNoStyleInformation(document());
if (xmlViewerMode) {
+ XMLTreeViewer xmlTreeViewer(document());
xmlTreeViewer.transformDocumentToTreeView();
} else if (m_sawXSLTransform) {
xmlDocPtr doc = xmlDocPtrForString(document()->fetcher(), m_originalSourceForTransform.toString(), document()->url().string());
« no previous file with comments | « Source/core/xml/XMLTreeViewer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698