[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
paroga at webkit.org
paroga at webkit.org
Sun Feb 20 22:50:24 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit db657842b8aaf6bb3540e8747e93d4dc34710a3f
Author: paroga at webkit.org <paroga at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Jan 12 01:26:04 2011 +0000
2011-01-11 Patrick Gansterer <paroga at webkit.org>
Reviewed by Eric Seidel.
Add Document::setContent()
https://bugs.webkit.org/show_bug.cgi?id=52085
Add a method to Document to set the whole content at once.
This removes the hack of the insert method in the xml parser
and is a predecessor to feed the xml parser with raw data.
* dom/Document.cpp:
(WebCore::Document::setContent):
* dom/Document.h:
* dom/XMLDocumentParser.cpp:
(WebCore::XMLDocumentParser::insert): Added ASSERT_NOT_REACHED().
* loader/cache/CachedFont.cpp:
(WebCore::CachedFont::ensureSVGFontData): Use setContent.
* xml/DOMParser.cpp:
(WebCore::DOMParser::parseFromString): Ditto.
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::responseXML): Ditto.
* xml/XSLTProcessor.cpp:
(WebCore::XSLTProcessor::createDocumentFromSource): Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75577 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 82b0971..ab2adf0 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,28 @@
+2011-01-11 Patrick Gansterer <paroga at webkit.org>
+
+ Reviewed by Eric Seidel.
+
+ Add Document::setContent()
+ https://bugs.webkit.org/show_bug.cgi?id=52085
+
+ Add a method to Document to set the whole content at once.
+ This removes the hack of the insert method in the xml parser
+ and is a predecessor to feed the xml parser with raw data.
+
+ * dom/Document.cpp:
+ (WebCore::Document::setContent):
+ * dom/Document.h:
+ * dom/XMLDocumentParser.cpp:
+ (WebCore::XMLDocumentParser::insert): Added ASSERT_NOT_REACHED().
+ * loader/cache/CachedFont.cpp:
+ (WebCore::CachedFont::ensureSVGFontData): Use setContent.
+ * xml/DOMParser.cpp:
+ (WebCore::DOMParser::parseFromString): Ditto.
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::responseXML): Ditto.
+ * xml/XSLTProcessor.cpp:
+ (WebCore::XSLTProcessor::createDocumentFromSource): Ditto.
+
2011-01-11 Brent Fulgham <bfulgham at webkit.org>
Unreviewed build fix.
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp
index 1e12958..42a6868 100644
--- a/Source/WebCore/dom/Document.cpp
+++ b/Source/WebCore/dom/Document.cpp
@@ -1167,6 +1167,16 @@ KURL Document::baseURI() const
return m_baseURL;
}
+void Document::setContent(const String& content)
+{
+ removeAllChildren();
+
+ open();
+ m_parser->append(content);
+ m_parser->finish();
+ close();
+}
+
// FIXME: We need to discuss the DOM API here at some point. Ideas:
// * making it receive a rect as parameter, i.e. nodesFromRect(x, y, w, h);
// * making it receive the expading size of each direction separately,
diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h
index fb1ae31..2863175 100644
--- a/Source/WebCore/dom/Document.h
+++ b/Source/WebCore/dom/Document.h
@@ -349,6 +349,8 @@ public:
void setCharset(const String&);
+ void setContent(const String&);
+
String contentLanguage() const { return m_contentLanguage; }
void setContentLanguage(const String& lang) { m_contentLanguage = lang; }
diff --git a/Source/WebCore/dom/XMLDocumentParser.cpp b/Source/WebCore/dom/XMLDocumentParser.cpp
index 68c8dd9..a5d3c08 100644
--- a/Source/WebCore/dom/XMLDocumentParser.cpp
+++ b/Source/WebCore/dom/XMLDocumentParser.cpp
@@ -116,13 +116,9 @@ void XMLDocumentParser::clearCurrentNodeStack()
}
}
-void XMLDocumentParser::insert(const SegmentedString& source)
+void XMLDocumentParser::insert(const SegmentedString&)
{
- // FIXME: This is a hack to work around the fact that XMLHttpRequest
- // responseXML() calls Document::write() which in turn calls insert(). In
- // HTML, that's correct, as insert() implies a synchronous parse. For XML,
- // all parsing is synchronous but document.write shouldn't be supported.
- append(source);
+ ASSERT_NOT_REACHED();
}
void XMLDocumentParser::append(const SegmentedString& s)
diff --git a/Source/WebCore/loader/cache/CachedFont.cpp b/Source/WebCore/loader/cache/CachedFont.cpp
index d6967bf..fe3281e 100644
--- a/Source/WebCore/loader/cache/CachedFont.cpp
+++ b/Source/WebCore/loader/cache/CachedFont.cpp
@@ -137,18 +137,13 @@ bool CachedFont::ensureSVGFontData()
ASSERT(m_isSVGFont);
if (!m_externalSVGDocument && !errorOccurred() && !isLoading() && m_data) {
m_externalSVGDocument = SVGDocument::create(0, KURL());
- m_externalSVGDocument->open();
RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("application/xml");
- m_externalSVGDocument->write(decoder->decode(m_data->data(), m_data->size()));
- m_externalSVGDocument->write(decoder->flush());
- if (decoder->sawError()) {
- m_externalSVGDocument.clear();
- return 0;
- }
-
- m_externalSVGDocument->finishParsing();
- m_externalSVGDocument->close();
+
+ m_externalSVGDocument->setContent(decoder->decode(m_data->data(), m_data->size()) + decoder->flush());
+
+ if (decoder->sawError())
+ m_externalSVGDocument = 0;
}
return m_externalSVGDocument;
diff --git a/Source/WebCore/xml/DOMParser.cpp b/Source/WebCore/xml/DOMParser.cpp
index e6aa3b0..c0d146c 100644
--- a/Source/WebCore/xml/DOMParser.cpp
+++ b/Source/WebCore/xml/DOMParser.cpp
@@ -24,20 +24,15 @@
#include "PlatformString.h"
namespace WebCore {
-
+
PassRefPtr<Document> DOMParser::parseFromString(const String& str, const String& contentType)
{
if (!DOMImplementation::isXMLMIMEType(contentType))
return 0;
RefPtr<Document> doc = DOMImplementation::createDocument(contentType, 0, KURL(), false);
-
- doc->open();
- doc->write(str);
- doc->finishParsing();
- doc->close();
-
+ doc->setContent(str);
return doc.release();
}
-}
+} // namespace WebCore
diff --git a/Source/WebCore/xml/XMLHttpRequest.cpp b/Source/WebCore/xml/XMLHttpRequest.cpp
index fc7eb9e..5786176 100644
--- a/Source/WebCore/xml/XMLHttpRequest.cpp
+++ b/Source/WebCore/xml/XMLHttpRequest.cpp
@@ -245,12 +245,8 @@ Document* XMLHttpRequest::responseXML(ExceptionCode& ec)
m_responseXML = 0;
} else {
m_responseXML = Document::create(0, m_url);
- m_responseXML->open();
// FIXME: Set Last-Modified.
- m_responseXML->write(m_responseBuilder.toStringPreserveCapacity());
- m_responseXML->finishParsing();
- m_responseXML->close();
-
+ m_responseXML->setContent(m_responseBuilder.toStringPreserveCapacity());
if (!m_responseXML->wellFormed())
m_responseXML = 0;
}
diff --git a/Source/WebCore/xml/XSLTProcessor.cpp b/Source/WebCore/xml/XSLTProcessor.cpp
index 9b6a067..fe5f420 100644
--- a/Source/WebCore/xml/XSLTProcessor.cpp
+++ b/Source/WebCore/xml/XSLTProcessor.cpp
@@ -88,14 +88,11 @@ PassRefPtr<Document> XSLTProcessor::createDocumentFromSource(const String& sourc
frame->setDocument(result);
}
- result->open();
-
RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create(sourceMIMEType);
decoder->setEncoding(sourceEncoding.isEmpty() ? UTF8Encoding() : TextEncoding(sourceEncoding), TextResourceDecoder::EncodingFromXMLHeader);
result->setDecoder(decoder.release());
- result->write(documentSource);
- result->close();
+ result->setContent(documentSource);
return result.release();
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list