diff options
Diffstat (limited to 'Source/WebCore/xml')
-rw-r--r-- | Source/WebCore/xml/XMLTreeViewer.cpp | 12 | ||||
-rw-r--r-- | Source/WebCore/xml/XMLTreeViewer.h | 2 | ||||
-rw-r--r-- | Source/WebCore/xml/XMLViewer.xsl | 13 | ||||
-rw-r--r-- | Source/WebCore/xml/XPathResult.cpp | 2 | ||||
-rw-r--r-- | Source/WebCore/xml/XPathResult.h | 2 |
5 files changed, 22 insertions, 9 deletions
diff --git a/Source/WebCore/xml/XMLTreeViewer.cpp b/Source/WebCore/xml/XMLTreeViewer.cpp index 7a893f6..f1e2c0f 100644 --- a/Source/WebCore/xml/XMLTreeViewer.cpp +++ b/Source/WebCore/xml/XMLTreeViewer.cpp @@ -14,7 +14,7 @@ * distribution. * * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS - * “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, @@ -33,6 +33,7 @@ #include "Base64.h" +#include "Element.h" #include "Document.h" #include "Frame.h" #include "HTMLNames.h" @@ -88,7 +89,7 @@ bool XMLTreeViewer::hasNoStyleInformation() const void XMLTreeViewer::transformDocumentToTreeView() { - String sheetString(reinterpret_cast<char*>(XMLViewer_xsl), sizeof(XMLViewer_xsl)); + String sheetString(reinterpret_cast<const char*>(XMLViewer_xsl), sizeof(XMLViewer_xsl)); RefPtr<XSLStyleSheet> styleSheet = XSLStyleSheet::createForXMLTreeViewer(m_document, sheetString); RefPtr<XSLTProcessor> processor = XSLTProcessor::create(); @@ -104,9 +105,16 @@ void XMLTreeViewer::transformDocumentToTreeView() // FIXME: We should introduce error handling if (processor->transformToString(m_document, resultMIMEType, newSource, resultEncoding)) processor->createDocumentFromSource(newSource, resultEncoding, resultMIMEType, m_document, frame); + + // Adding source xml for dealing with namespaces and CDATA issues and for extensions use. + Element* sourceXmlElement = frame->document()->getElementById(AtomicString("source-xml")); + if (sourceXmlElement) + m_document->cloneChildNodes(sourceXmlElement); + // New document should have been loaded in frame. Tell it to use view source styles. frame->document()->setUsesViewSourceStyles(true); frame->document()->styleSelectorChanged(RecalcStyleImmediately); + } } // namespace WebCore diff --git a/Source/WebCore/xml/XMLTreeViewer.h b/Source/WebCore/xml/XMLTreeViewer.h index 7fde7bc..84297ea 100644 --- a/Source/WebCore/xml/XMLTreeViewer.h +++ b/Source/WebCore/xml/XMLTreeViewer.h @@ -14,7 +14,7 @@ * distribution. * * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS - * “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC. * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, diff --git a/Source/WebCore/xml/XMLViewer.xsl b/Source/WebCore/xml/XMLViewer.xsl index cb66858..4ee3ca8 100644 --- a/Source/WebCore/xml/XMLViewer.xsl +++ b/Source/WebCore/xml/XMLViewer.xsl @@ -248,16 +248,16 @@ <xsl:call-template name="style"/> <xsl:call-template name="script"/> </head> - <body onload="onload()"> + <body onload="onWebKitXMLViewerLoad()"> <div class="header"> - <span> <xsl:value-of select="$xml_has_no_style_message"/> </span> + <span> <xsl:value-of select="$xml_has_no_style_message"/> </span> <br/> </div> <div class="pretty-print"> <xsl:apply-templates/> </div> - <div> </div> + <div id="source-xml"></div> </body> </html> </xsl:template> @@ -265,7 +265,7 @@ <xsl:template name="script"> <script type="text/javascript"> <xsl:text> - function onload() + function onWebKitXMLViewerLoad() { drawArrows(); initButtons(); @@ -339,7 +339,6 @@ // To prevent selection on double click e.preventDefault(); } - </xsl:text> </script> </xsl:template> @@ -363,6 +362,10 @@ font-size: 13px; } + #source-xml { + display: none; + } + .collapsable-content { margin-left: 1em; } diff --git a/Source/WebCore/xml/XPathResult.cpp b/Source/WebCore/xml/XPathResult.cpp index b608280..1dcde2e 100644 --- a/Source/WebCore/xml/XPathResult.cpp +++ b/Source/WebCore/xml/XPathResult.cpp @@ -41,6 +41,8 @@ using namespace XPath; XPathResult::XPathResult(Document* document, const Value& value) : m_value(value) + , m_nodeSetPosition(0) + , m_domTreeVersion(0) { switch (m_value.type()) { case Value::BooleanValue: diff --git a/Source/WebCore/xml/XPathResult.h b/Source/WebCore/xml/XPathResult.h index cbb51f5..e45916c 100644 --- a/Source/WebCore/xml/XPathResult.h +++ b/Source/WebCore/xml/XPathResult.h @@ -80,7 +80,7 @@ namespace WebCore { XPath::NodeSet m_nodeSet; // FIXME: why duplicate the node set stored in m_value? unsigned short m_resultType; RefPtr<Document> m_document; - unsigned m_domTreeVersion; + uint64_t m_domTreeVersion; }; } // namespace WebCore |