summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/xml
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-25 19:08:45 +0100
committerSteve Block <steveblock@google.com>2011-06-08 13:51:31 +0100
commit2bde8e466a4451c7319e3a072d118917957d6554 (patch)
tree28f4a1b869a513e565c7760d0e6a06e7cf1fe95a /Source/WebCore/xml
parent6939c99b71d9372d14a0c74a772108052e8c48c8 (diff)
downloadexternal_webkit-2bde8e466a4451c7319e3a072d118917957d6554.zip
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.gz
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.bz2
Merge WebKit at r82507: Initial merge by git
Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e
Diffstat (limited to 'Source/WebCore/xml')
-rw-r--r--Source/WebCore/xml/XMLTreeViewer.cpp12
-rw-r--r--Source/WebCore/xml/XMLTreeViewer.h2
-rw-r--r--Source/WebCore/xml/XMLViewer.xsl13
-rw-r--r--Source/WebCore/xml/XPathResult.cpp2
-rw-r--r--Source/WebCore/xml/XPathResult.h2
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