Commit 3411ea05 authored by oliver's avatar oliver

WebCore:

        Reviewed by Oliver.

        - Use Vector<UChar> instead of DeprecatedString for innerHTML, for 35% speedup on CK DOM test
        http://bugs.webkit.org/show_bug.cgi?id=15339

        Rewrote both versions of createMarkup to build based on
        Vector<UChar> instead of String. Also other miscellaneous
        speedups (mainly content strings are now encoded in a way that
        doesn't take a function call per character, and switch is avoided).

        This also causes a functional change - we no longer escape '>' since this was unnecessary and it's faster
        to avoid testing for it. See updated test results.

        * editing/markup.cpp:
        (WebCore::appendString):
        (WebCore::appendAttributeValue):
        (WebCore::escapeContentText):
        (WebCore::appendEscapedContent):
        (WebCore::appendDeprecatedString):
        (WebCore::appendQuotedURLAttributeValue):
        (WebCore::stringValueForRange):
        (WebCore::ucharRange):
        (WebCore::appendUCharRange):
        (WebCore::appendNamespace):
        (WebCore::appendStartMarkup):
        (WebCore::getStartMarkup):
        (WebCore::appendEndMarkup):
        (WebCore::getEndMarkup):
        (WebCore::appendMarkup):
        (WebCore::joinMarkups):
        (WebCore::createMarkup):
        * editing/markup.h:
        * page/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge markupStringFromNode:nodes:]):
        (-[WebCoreFrameBridge markupStringFromRange:nodes:]):

LayoutTests:

        Reviewed by Oliver.

        - test updates for "file:///Volumes/Data/mjs/Work/src/Safari/OpenSource/LayoutTests/fast/dom/serialize-attribute.xhtml"
        http://bugs.webkit.org/show_bug.cgi?id=15339

        We no longer entity-escape the '>' character in content or attribute values since this is unnecessary.

        * fast/dom/dom-parse-serialize-expected.txt:
        * fast/dom/serialize-attribute.xhtml:
        * fast/xsl/xslt-processor-expected.txt:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@26474 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent dedfb4bb
2007-10-02 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- test updates for "file:///Volumes/Data/mjs/Work/src/Safari/OpenSource/LayoutTests/fast/dom/serialize-attribute.xhtml"
http://bugs.webkit.org/show_bug.cgi?id=15339
We no longer entity-escape the '>' character in content or attribute values since this is unnecessary.
* fast/dom/dom-parse-serialize-expected.txt:
* fast/dom/serialize-attribute.xhtml:
* fast/xsl/xslt-processor-expected.txt:
2007-10-02 Nicholas Shanks <webkit@nickshanks.com>
Reviewed by eseidel & hyatt.
......@@ -11,7 +11,9 @@ function test() {
try {
serialized = (new XMLSerializer()).serializeToString(document.getElementById("testDiv\"'&<>"));
if (serialized == "<div xmlns=\"http://www.w3.org/1999/xhtml\" id=\"testDiv&quot;'&amp;&lt;&gt;\"/>" ||
serialized == "<div xmlns=\"http://www.w3.org/1999/xhtml\" id=\"testDiv&quot;'&amp;&lt;&gt;\"></div>")
serialized == "<div xmlns=\"http://www.w3.org/1999/xhtml\" id=\"testDiv&quot;'&amp;&lt;&gt;\"></div>" ||
serialized == "<div xmlns=\"http://www.w3.org/1999/xhtml\" id=\"testDiv&quot;'&amp;&lt;>\"/>" ||
serialized == "<div xmlns=\"http://www.w3.org/1999/xhtml\" id=\"testDiv&quot;'&amp;&lt;>\"></div>")
document.getElementById("result").textContent = "SUCCESS";
else
document.getElementById("result").textContent = "FAIL: " + (new XMLSerializer()).serializeToString(document.getElementsByTagName('div')[1]);
......
0.1 original xml:
<?xml-stylesheet type="text/xsl" href="xslt-text.xsl"?><TEST>SOURCE XML: &lt;&lt;&lt;&amp;тест&amp;&gt;&gt;&gt;</TEST>
<?xml-stylesheet type="text/xsl" href="xslt-text.xsl"?><TEST>SOURCE XML: &lt;&lt;&lt;&amp;тест&amp;>>></TEST>
0.2 xsl1:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" encoding="KOI8-R"/>
<xsl:template match="TEST">CHARACTERS IN XSLT: &lt;&lt;&lt;&amp;тест&amp;&gt;&gt;&gt;
<xsl:template match="TEST">CHARACTERS IN XSLT: &lt;&lt;&lt;&amp;тест&amp;>>>
<xsl:apply-templates/><xsl:text>
</xsl:text></xsl:template>
......@@ -37,14 +37,14 @@
1.1 Import two different stylesheets:
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body>
CHARACTERS IN XSLT: ééééééééééé <br><br>SOURCE XML: &lt;&lt;&lt;&amp;тест&amp;&gt;&gt;&gt;
CHARACTERS IN XSLT: ééééééééééé <br><br>SOURCE XML: &lt;&lt;&lt;&amp;тест&amp;>>>
</body></html>
1.2 Import same stylesheet twice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head><title></title></head>
<body>
<pre>CHARACTERS IN XSLT: &lt;&lt;&lt;&amp;тест&amp;&gt;&gt;&gt;
SOURCE XML: &lt;&lt;&lt;&amp;тест&amp;&gt;&gt;&gt;
<pre>CHARACTERS IN XSLT: &lt;&lt;&lt;&amp;тест&amp;>>>
SOURCE XML: &lt;&lt;&lt;&amp;тест&amp;>>>
</pre>
</body>
</html>
......
2007-10-02 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
- Use Vector<UChar> instead of DeprecatedString for innerHTML, for 35% speedup on CK DOM test
http://bugs.webkit.org/show_bug.cgi?id=15339
Rewrote both versions of createMarkup to build based on
Vector<UChar> instead of String. Also other miscellaneous
speedups (mainly content strings are now encoded in a way that
doesn't take a function call per character, and switch is avoided).
This also causes a functional change - we no longer escape '>' since this was unnecessary and it's faster
to avoid testing for it. See updated test results.
* editing/markup.cpp:
(WebCore::appendString):
(WebCore::appendAttributeValue):
(WebCore::escapeContentText):
(WebCore::appendEscapedContent):
(WebCore::appendDeprecatedString):
(WebCore::appendQuotedURLAttributeValue):
(WebCore::stringValueForRange):
(WebCore::ucharRange):
(WebCore::appendUCharRange):
(WebCore::appendNamespace):
(WebCore::appendStartMarkup):
(WebCore::getStartMarkup):
(WebCore::appendEndMarkup):
(WebCore::getEndMarkup):
(WebCore::appendMarkup):
(WebCore::joinMarkups):
(WebCore::createMarkup):
* editing/markup.h:
* page/mac/WebCoreFrameBridge.mm:
(-[WebCoreFrameBridge markupStringFromNode:nodes:]):
(-[WebCoreFrameBridge markupStringFromRange:nodes:]):
2007-10-02 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
......@@ -13202,6 +13202,7 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
knownRegions = (
English,
This diff is collapsed.
......@@ -44,10 +44,9 @@ namespace WebCore {
PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document*, const String& markup, const String& baseURL);
PassRefPtr<DocumentFragment> createFragmentFromNodes(Document*, const Vector<Node*>&);
DeprecatedString createMarkup(const Range*,
String createMarkup(const Range*,
Vector<Node*>* = 0, EAnnotateForInterchange = DoNotAnnotateForInterchange, bool convertBlocksToInlines = false);
DeprecatedString createMarkup(const Node*, EChildrenOnly = IncludeNode,
Vector<Node*>* = 0, EAnnotateForInterchange = DoNotAnnotateForInterchange);
String createMarkup(const Node*, EChildrenOnly = IncludeNode, Vector<Node*>* = 0);
}
......
......@@ -343,7 +343,7 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
{
// FIXME: This is never "for interchange". Is that right? See the next method.
Vector<Node*> nodeList;
NSString *markupString = createMarkup([node _node], IncludeNode, nodes ? &nodeList : 0).getNSString();
NSString *markupString = createMarkup([node _node], IncludeNode, nodes ? &nodeList : 0);
if (nodes)
*nodes = [self nodesFromList:&nodeList];
......@@ -354,7 +354,7 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
{
// FIXME: This is always "for interchange". Is that right? See the previous method.
Vector<Node*> nodeList;
NSString *markupString = createMarkup([range _range], nodes ? &nodeList : 0, AnnotateForInterchange).getNSString();
NSString *markupString = createMarkup([range _range], nodes ? &nodeList : 0, AnnotateForInterchange);
if (nodes)
*nodes = [self nodesFromList:&nodeList];
......
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