summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/html/HTMLAllCollection.cpp
diff options
context:
space:
mode:
authorNaiem Shaik <snaiem@codeaurora.org>2012-07-19 10:45:56 -0700
committerSteve Kondik <shade@chemlab.org>2013-01-20 18:38:33 -0800
commit0f5d4355d7a384679722338d55f65bbb92350cfc (patch)
treedf4a638aa4e81152ee68f0d523ed706128a251ff /Source/WebCore/html/HTMLAllCollection.cpp
parent8f6cf525ead3381029545c1d292c8586ec45ddb0 (diff)
downloadexternal_webkit-0f5d4355d7a384679722338d55f65bbb92350cfc.zip
external_webkit-0f5d4355d7a384679722338d55f65bbb92350cfc.tar.gz
external_webkit-0f5d4355d7a384679722338d55f65bbb92350cfc.tar.bz2
DOM Optimizations
DOM traversal optimizations DOM Core optimizations Prefetch optimization for DOM Tree Traversal Conflicts: Source/WebKit/android/jni/WebViewCore.cpp Change-Id: Icbb8a7229ee9cff1a5401b57c8181f18b9a6d6e0
Diffstat (limited to 'Source/WebCore/html/HTMLAllCollection.cpp')
-rw-r--r--Source/WebCore/html/HTMLAllCollection.cpp43
1 files changed, 39 insertions, 4 deletions
diff --git a/Source/WebCore/html/HTMLAllCollection.cpp b/Source/WebCore/html/HTMLAllCollection.cpp
index dbfed28..8c92a00 100644
--- a/Source/WebCore/html/HTMLAllCollection.cpp
+++ b/Source/WebCore/html/HTMLAllCollection.cpp
@@ -26,17 +26,18 @@
#include "config.h"
#include "HTMLAllCollection.h"
+#include "Element.h"
#include "Node.h"
namespace WebCore {
-PassRefPtr<HTMLAllCollection> HTMLAllCollection::create(PassRefPtr<Node> base)
+PassRefPtr<HTMLAllCollection> HTMLAllCollection::create(PassRefPtr<Node> base, CollectionType type)
{
- return adoptRef(new HTMLAllCollection(base));
+ return adoptRef(new HTMLAllCollection(base, type));
}
-HTMLAllCollection::HTMLAllCollection(PassRefPtr<Node> base)
- : HTMLCollection(base, DocAll)
+HTMLAllCollection::HTMLAllCollection(PassRefPtr<Node> base, CollectionType type)
+ : HTMLCollection(base, type)
{
}
@@ -44,4 +45,38 @@ HTMLAllCollection::~HTMLAllCollection()
{
}
+Element* HTMLAllCollection::itemAfter(Element* previous) const
+{
+ bool includeChildren = (type() == DocAll);
+ Node* current;
+ Node* root = base();
+ if (!previous)
+ current = root->firstChild();
+ else
+ current = includeChildren ? previous->traverseNextNode(root) : previous->traverseNextSibling(root);
+
+ if (includeChildren) {
+ Node * lastDecendant = info()->lastDecendantOfBase;
+ if (!lastDecendant) {
+ info()->lastDecendantOfBase = root->lastDescendantNode();
+ lastDecendant = info()->lastDecendantOfBase;
+ }
+
+ for (; current; current = current->traverseNextNodeFastPath()) {
+ if (current->isElementNode())
+ return static_cast<Element*>(current);
+ if (current == lastDecendant)
+ break;
+ }
+ } else {
+ for (; current; current = current->traverseNextSibling(root)) {
+ if (current->isElementNode())
+ return static_cast<Element*>(current);
+ }
+ }
+
+ return 0;
+}
+
+
} // namespace WebCore