summaryrefslogtreecommitdiffstats
path: root/WebCore/dom/TreeWalker.cpp
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-05 14:34:32 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-05 14:34:32 -0800
commit635860845790a19bf50bbc51ba8fb66a96dde068 (patch)
treeef6ad9ff73a5b57f65249d4232a202fa77e6a140 /WebCore/dom/TreeWalker.cpp
parent8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2 (diff)
downloadexternal_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.zip
external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.tar.gz
external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.tar.bz2
auto import from //depot/cupcake/@136594
Diffstat (limited to 'WebCore/dom/TreeWalker.cpp')
-rw-r--r--WebCore/dom/TreeWalker.cpp66
1 files changed, 32 insertions, 34 deletions
diff --git a/WebCore/dom/TreeWalker.cpp b/WebCore/dom/TreeWalker.cpp
index 7960fae..de06363 100644
--- a/WebCore/dom/TreeWalker.cpp
+++ b/WebCore/dom/TreeWalker.cpp
@@ -25,14 +25,12 @@
#include "config.h"
#include "TreeWalker.h"
-#include <runtime/ExecState.h>
#include "ExceptionCode.h"
#include "ContainerNode.h"
#include "NodeFilter.h"
+#include "ScriptState.h"
#include <wtf/PassRefPtr.h>
-using namespace JSC;
-
namespace WebCore {
TreeWalker::TreeWalker(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences)
@@ -56,15 +54,15 @@ inline Node* TreeWalker::setCurrent(PassRefPtr<Node> node)
return m_current.get();
}
-Node* TreeWalker::parentNode(ExecState* exec)
+Node* TreeWalker::parentNode(ScriptState* state)
{
RefPtr<Node> node = m_current;
while (node != root()) {
node = node->parentNode();
if (!node)
return 0;
- short acceptNodeResult = acceptNode(exec, node.get());
- if (exec && exec->hadException())
+ short acceptNodeResult = acceptNode(state, node.get());
+ if (state && state->hadException())
return 0;
if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
return setCurrent(node.release());
@@ -72,11 +70,11 @@ Node* TreeWalker::parentNode(ExecState* exec)
return 0;
}
-Node* TreeWalker::firstChild(ExecState* exec)
+Node* TreeWalker::firstChild(ScriptState* state)
{
for (RefPtr<Node> node = m_current->firstChild(); node; ) {
- short acceptNodeResult = acceptNode(exec, node.get());
- if (exec && exec->hadException())
+ short acceptNodeResult = acceptNode(state, node.get());
+ if (state && state->hadException())
return 0;
switch (acceptNodeResult) {
case NodeFilter::FILTER_ACCEPT:
@@ -105,11 +103,11 @@ Node* TreeWalker::firstChild(ExecState* exec)
return 0;
}
-Node* TreeWalker::lastChild(ExecState* exec)
+Node* TreeWalker::lastChild(ScriptState* state)
{
for (RefPtr<Node> node = m_current->lastChild(); node; ) {
- short acceptNodeResult = acceptNode(exec, node.get());
- if (exec && exec->hadException())
+ short acceptNodeResult = acceptNode(state, node.get());
+ if (state && state->hadException())
return 0;
switch (acceptNodeResult) {
case NodeFilter::FILTER_ACCEPT:
@@ -138,15 +136,15 @@ Node* TreeWalker::lastChild(ExecState* exec)
return 0;
}
-Node* TreeWalker::previousSibling(ExecState* exec)
+Node* TreeWalker::previousSibling(ScriptState* state)
{
RefPtr<Node> node = m_current;
if (node == root())
return 0;
while (1) {
for (RefPtr<Node> sibling = node->previousSibling(); sibling; ) {
- short acceptNodeResult = acceptNode(exec, sibling.get());
- if (exec && exec->hadException())
+ short acceptNodeResult = acceptNode(state, sibling.get());
+ if (state && state->hadException())
return 0;
switch (acceptNodeResult) {
case NodeFilter::FILTER_ACCEPT:
@@ -166,23 +164,23 @@ Node* TreeWalker::previousSibling(ExecState* exec)
node = node->parentNode();
if (!node || node == root())
return 0;
- short acceptNodeResult = acceptNode(exec, node.get());
- if (exec && exec->hadException())
+ short acceptNodeResult = acceptNode(state, node.get());
+ if (state && state->hadException())
return 0;
if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
return 0;
}
}
-Node* TreeWalker::nextSibling(ExecState* exec)
+Node* TreeWalker::nextSibling(ScriptState* state)
{
RefPtr<Node> node = m_current;
if (node == root())
return 0;
while (1) {
for (RefPtr<Node> sibling = node->nextSibling(); sibling; ) {
- short acceptNodeResult = acceptNode(exec, sibling.get());
- if (exec && exec->hadException())
+ short acceptNodeResult = acceptNode(state, sibling.get());
+ if (state && state->hadException())
return 0;
switch (acceptNodeResult) {
case NodeFilter::FILTER_ACCEPT:
@@ -202,29 +200,29 @@ Node* TreeWalker::nextSibling(ExecState* exec)
node = node->parentNode();
if (!node || node == root())
return 0;
- short acceptNodeResult = acceptNode(exec, node.get());
- if (exec && exec->hadException())
+ short acceptNodeResult = acceptNode(state, node.get());
+ if (state && state->hadException())
return 0;
if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
return 0;
}
}
-Node* TreeWalker::previousNode(ExecState* exec)
+Node* TreeWalker::previousNode(ScriptState* state)
{
RefPtr<Node> node = m_current;
while (node != root()) {
while (Node* previousSibling = node->previousSibling()) {
node = previousSibling;
- short acceptNodeResult = acceptNode(exec, node.get());
- if (exec && exec->hadException())
+ short acceptNodeResult = acceptNode(state, node.get());
+ if (state && state->hadException())
return 0;
if (acceptNodeResult == NodeFilter::FILTER_REJECT)
continue;
while (Node* lastChild = node->lastChild()) {
node = lastChild;
- acceptNodeResult = acceptNode(exec, node.get());
- if (exec && exec->hadException())
+ acceptNodeResult = acceptNode(state, node.get());
+ if (state && state->hadException())
return 0;
if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
continue;
@@ -240,8 +238,8 @@ Node* TreeWalker::previousNode(ExecState* exec)
if (!parent)
return 0;
node = parent;
- short acceptNodeResult = acceptNode(exec, node.get());
- if (exec && exec->hadException())
+ short acceptNodeResult = acceptNode(state, node.get());
+ if (state && state->hadException())
return 0;
if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
return setCurrent(node.release());
@@ -249,14 +247,14 @@ Node* TreeWalker::previousNode(ExecState* exec)
return 0;
}
-Node* TreeWalker::nextNode(ExecState* exec)
+Node* TreeWalker::nextNode(ScriptState* state)
{
RefPtr<Node> node = m_current;
Children:
while (Node* firstChild = node->firstChild()) {
node = firstChild;
- short acceptNodeResult = acceptNode(exec, node.get());
- if (exec && exec->hadException())
+ short acceptNodeResult = acceptNode(state, node.get());
+ if (state && state->hadException())
return 0;
if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
return setCurrent(node.release());
@@ -265,8 +263,8 @@ Children:
}
while (Node* nextSibling = node->traverseNextSibling(root())) {
node = nextSibling;
- short acceptNodeResult = acceptNode(exec, node.get());
- if (exec && exec->hadException())
+ short acceptNodeResult = acceptNode(state, node.get());
+ if (state && state->hadException())
return 0;
if (acceptNodeResult == NodeFilter::FILTER_ACCEPT)
return setCurrent(node.release());