Commit 67b87d0b authored by andersca's avatar andersca

2006-01-04 Anders Carlsson <andersca@mac.com>

        Reviewed by Eric.

        Based on a patch by Eric.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6180
        "text" output in fragment produced by XSLTProccessor is wrong (has xhtml garbage)

        * khtml/xsl/xslt_processorimpl.cpp:
        (DOM::xsltParamArrayFromParameterMap):
        (DOM::freeXsltParamArray):
        Use fastMalloc/fastFree.

        (DOM::createFragmentFromSource):
        If the output is "text", just create a text node and add
        it to the fragment.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@11876 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 021e4c94
2006-01-04 Anders Carlsson <andersca@mac.com>
Reviewed by Eric.
Based on a patch by Eric.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6180
"text" output in fragment produced by XSLTProccessor is wrong (has xhtml garbage)
* khtml/xsl/xslt_processorimpl.cpp:
(DOM::xsltParamArrayFromParameterMap):
(DOM::freeXsltParamArray):
Use fastMalloc/fastFree.
(DOM::createFragmentFromSource):
If the output is "text", just create a text node and add
it to the fragment.
2006-01-04 Geoffrey Garen <ggaren@apple.com>
Reviewed by darin.
......
......@@ -25,6 +25,7 @@
#include "xslt_processorimpl.h"
#include "xsl_stylesheetimpl.h"
#include "xml_tokenizer.h"
#include "dom_textimpl.h"
#include "htmltokenizer.h"
#include "html_documentimpl.h"
#include "loader.h"
......@@ -152,7 +153,7 @@ static const char **xsltParamArrayFromParameterMap(XSLTProcessorImpl::ParameterM
if (parameters.isEmpty())
return 0;
const char **parameterArray = (const char **)malloc(((parameters.size() * 2) + 1) * sizeof(char *));
const char **parameterArray = (const char **)fastMalloc(((parameters.size() * 2) + 1) * sizeof(char *));
XSLTProcessorImpl::ParameterMap::iterator end = parameters.end();
unsigned index = 0;
......@@ -172,10 +173,10 @@ static void freeXsltParamArray(const char **params)
return;
while (*temp) {
free((void *)*(temp++));
free((void *)*(temp++)); // strdup returns malloc'd blocks, so we have to use free() here
free((void *)*(temp++));
}
free(params);
fastFree(params);
}
......@@ -226,16 +227,16 @@ RefPtr<DocumentImpl> XSLTProcessorImpl::createDocumentFromSource(const QString &
return result;
}
static inline RefPtr<DocumentFragmentImpl> createFragmentFromSource(QString sourceString, QString sourceMIMEType, NodeImpl *sourceNode, DocumentImpl *ouputDoc)
static inline RefPtr<DocumentFragmentImpl> createFragmentFromSource(QString sourceString, QString sourceMIMEType, NodeImpl *sourceNode, DocumentImpl *outputDoc)
{
RefPtr<DocumentFragmentImpl> fragment = new DocumentFragmentImpl(ouputDoc);
RefPtr<DocumentFragmentImpl> fragment = new DocumentFragmentImpl(outputDoc);
if (sourceMIMEType == "text/html")
parseHTMLDocumentFragment(sourceString, fragment.get());
else if (sourceMIMEType == "text/plain")
fragment->addChild(new TextImpl(outputDoc, sourceString));
else {
if (sourceMIMEType == "text/plain")
transformTextStringToXHTMLDocumentString(sourceString);
bool successfulParse = parseXMLDocumentFragment(sourceString, fragment.get(), ouputDoc->documentElement());
bool successfulParse = parseXMLDocumentFragment(sourceString, fragment.get(), outputDoc->documentElement());
if (!successfulParse)
return 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment