Commit e1be1a16 authored by andersca's avatar andersca

2005-12-30 Anders Carlsson <andersca@mac.com>

        Reviewed by Eric.

		- Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6297
		XMLSerializer should use createMarkup.

        * khtml/ecma/xmlserializer.cpp:
        (KJS::XMLSerializerProtoFunc::callAsFunction):
		Use createMarkup instead of NodeImpl::toString.

        * khtml/editing/markup.cpp:
        (khtml::startMarkup):
		escape attribute values and ignore document fragment nodes.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@11839 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bb900e13
2005-12-30 Anders Carlsson <andersca@mac.com>
Reviewed by Eric.
- Fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6297
XMLSerializer should use createMarkup.
* khtml/ecma/xmlserializer.cpp:
(KJS::XMLSerializerProtoFunc::callAsFunction):
Use createMarkup instead of NodeImpl::toString.
* khtml/editing/markup.cpp:
(khtml::startMarkup):
escape attribute values and ignore document fragment nodes.
2005-12-30 Eric Seidel <eseidel@apple.com>
Reviewed by mjs.
......
......@@ -27,6 +27,8 @@
#include "dom/dom_exception.h"
#include "xml/dom_docimpl.h"
#include "markup.h"
#include <kdebug.h>
using DOM::NodeImpl;
......@@ -88,7 +90,7 @@ JSValue *XMLSerializerProtoFunc::callAsFunction(ExecState *exec, JSObject *thisO
}
NodeImpl *node = static_cast<NodeImpl *>(static_cast<DOMNode *>(args[0]->toObject(exec))->impl());
return jsStringOrNull(node->toString());
return jsStringOrNull(createMarkup(node));
}
}
......
......@@ -67,7 +67,7 @@ namespace khtml {
static inline bool doesHTMLForbidEndTag(const NodeImpl *node);
static inline bool shouldSelfClose(const NodeImpl *node);
static QString escapeHTML(const QString &in)
static QString escapeTextForMarkup(const QString &in)
{
QString s = "";
......@@ -178,7 +178,7 @@ static QString startMarkup(const NodeImpl *node, const RangeImpl *range, EAnnota
node->parentNode()->hasTagName(textareaTag))
return stringValueForRange(node, range).qstring();
}
QString markup = annotate ? escapeHTML(renderedText(node, range)) : escapeHTML(stringValueForRange(node, range).qstring());
QString markup = annotate ? escapeTextForMarkup(renderedText(node, range)) : escapeTextForMarkup(stringValueForRange(node, range).qstring());
if (defaultStyle) {
NodeImpl *element = node->parentNode();
if (element) {
......@@ -197,6 +197,7 @@ static QString startMarkup(const NodeImpl *node, const RangeImpl *range, EAnnota
case Node::COMMENT_NODE:
return static_cast<const CommentImpl *>(node)->toString().qstring();
case Node::DOCUMENT_NODE:
case Node::DOCUMENT_FRAGMENT_NODE:
return "";
case Node::PROCESSING_INSTRUCTION_NODE:
return static_cast<const ProcessingInstructionImpl *>(node)->toString().qstring();
......@@ -233,7 +234,7 @@ static QString startMarkup(const NodeImpl *node, const RangeImpl *range, EAnnota
markup += " " + attr->name().localName().qstring();
else
markup += " " + attr->name().toString().qstring();
markup += "=\"" + value.qstring() + "\"";
markup += "=\"" + escapeTextForMarkup(value.qstring()) + "\"";
}
}
}
......
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