summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/editing/MarkupAccumulator.h
diff options
context:
space:
mode:
authorKulanthaivel Palanichamy <kulanthaivel@codeaurora.org>2012-08-15 17:14:48 -0700
committerSteve Kondik <shade@chemlab.org>2013-01-20 18:38:34 -0800
commit91437969ddb28bc81b3652986a67aae7e2465db2 (patch)
tree4d09df4e02a483e573700d8bfacb6fec8b658a7c /Source/WebCore/editing/MarkupAccumulator.h
parent0f5d4355d7a384679722338d55f65bbb92350cfc (diff)
downloadexternal_webkit-91437969ddb28bc81b3652986a67aae7e2465db2.zip
external_webkit-91437969ddb28bc81b3652986a67aae7e2465db2.tar.gz
external_webkit-91437969ddb28bc81b3652986a67aae7e2465db2.tar.bz2
[WebKit] Browsermark DomAdvSearch and DomSearch optimizations
This patch is a combination of the following optimizations. Optimize appendCharactersReplacingEntities [Performance] Optimize innerHTML and outerHTML https://bugs.webkit.org/show_bug.cgi?id=81214 Optimize Dromaeo/dom-query.html by caching NodeRareData on Document https://bugs.webkit.org/show_bug.cgi?id=90059 Optimize Dromaeo/dom-attr.html by speeding up Element::getAttribute() https://bugs.webkit.org/show_bug.cgi?id=90174 Change argument types of Element::getAttribute*() from String to AtomicString https://bugs.webkit.org/show_bug.cgi?id=90246 Conflicts: Source/WebCore/ChangeLog Source/WebCore/dom/Document.cpp Source/WebCore/dom/Document.h Conflicts: Source/WebCore/ChangeLog Change-Id: I9ca3d2e883155e2ad08c3cb0c5912b935ebe9406
Diffstat (limited to 'Source/WebCore/editing/MarkupAccumulator.h')
-rw-r--r--Source/WebCore/editing/MarkupAccumulator.h39
1 files changed, 20 insertions, 19 deletions
diff --git a/Source/WebCore/editing/MarkupAccumulator.h b/Source/WebCore/editing/MarkupAccumulator.h
index 0bfc6e6..ba28288 100644
--- a/Source/WebCore/editing/MarkupAccumulator.h
+++ b/Source/WebCore/editing/MarkupAccumulator.h
@@ -30,6 +30,7 @@
#include "markup.h"
#include <wtf/HashMap.h>
#include <wtf/Vector.h>
+#include <wtf/text/StringBuilder.h>
namespace WebCore {
@@ -76,28 +77,28 @@ protected:
void appendStartTag(Node*, Namespaces* = 0);
void appendEndTag(Node*);
static size_t totalLength(const Vector<String>&);
- size_t length() const { return totalLength(m_succeedingMarkup); }
- void concatenateMarkup(Vector<UChar>& out);
- void appendAttributeValue(Vector<UChar>& result, const String& attribute, bool documentIsHTML);
- void appendQuotedURLAttributeValue(Vector<UChar>& result, const String& urlString);
- void appendNodeValue(Vector<UChar>& out, const Node*, const Range*, EntityMask);
+ size_t length() const { return m_markup.length(); }
+ void concatenateMarkup(StringBuilder& out);
+ void appendAttributeValue(StringBuilder& result, const String& attribute, bool documentIsHTML);
+ void appendQuotedURLAttributeValue(StringBuilder& result, const String& urlString);
+ void appendNodeValue(StringBuilder& out, const Node*, const Range*, EntityMask);
bool shouldAddNamespaceElement(const Element*);
bool shouldAddNamespaceAttribute(const Attribute&, Namespaces&);
- void appendNamespace(Vector<UChar>& result, const AtomicString& prefix, const AtomicString& namespaceURI, Namespaces&);
+ void appendNamespace(StringBuilder& result, const AtomicString& prefix, const AtomicString& namespaceURI, Namespaces&);
EntityMask entityMaskForText(Text* text) const;
- virtual void appendText(Vector<UChar>& out, Text*);
- void appendComment(Vector<UChar>& out, const String& comment);
- void appendDocumentType(Vector<UChar>& result, const DocumentType*);
- void appendProcessingInstruction(Vector<UChar>& out, const String& target, const String& data);
- virtual void appendElement(Vector<UChar>& out, Element*, Namespaces*);
- void appendOpenTag(Vector<UChar>& out, Element* element, Namespaces*);
- void appendCloseTag(Vector<UChar>& out, Element* element);
- void appendAttribute(Vector<UChar>& out, Element* element, const Attribute&, Namespaces*);
- void appendCDATASection(Vector<UChar>& out, const String& section);
- void appendStartMarkup(Vector<UChar>& result, const Node*, Namespaces*);
+ virtual void appendText(StringBuilder& out, Text*);
+ void appendComment(StringBuilder& out, const String& comment);
+ void appendDocumentType(StringBuilder& result, const DocumentType*);
+ void appendProcessingInstruction(StringBuilder& out, const String& target, const String& data);
+ virtual void appendElement(StringBuilder& out, Element*, Namespaces*);
+ void appendOpenTag(StringBuilder& out, Element* element, Namespaces*);
+ void appendCloseTag(StringBuilder& out, Element* element);
+ void appendAttribute(StringBuilder& out, Element* element, const Attribute&, Namespaces*);
+ void appendCDATASection(StringBuilder& out, const String& section);
+ void appendStartMarkup(StringBuilder& result, const Node*, Namespaces*);
bool shouldSelfClose(const Node*);
bool elementCannotHaveEndTag(const Node* node);
- void appendEndMarkup(Vector<UChar>& result, const Node*);
+ void appendEndMarkup(StringBuilder&, const Node*);
bool shouldResolveURLs() { return m_shouldResolveURLs == AbsoluteURLs; }
@@ -107,12 +108,12 @@ protected:
private:
void serializeNodesWithNamespaces(Node*, Node* nodeToSkip, EChildrenOnly, const Namespaces*);
- Vector<String> m_succeedingMarkup;
+ StringBuilder m_markup;
const bool m_shouldResolveURLs;
};
// FIXME: This method should be integrated with MarkupAccumulator.
-void appendCharactersReplacingEntities(Vector<UChar>& out, const UChar* content, size_t length, EntityMask entityMask);
+void appendCharactersReplacingEntities(StringBuilder& out, const UChar* content, size_t length, EntityMask entityMask);
}