summaryrefslogtreecommitdiffstats
path: root/WebCore/dom/Traversal.cpp
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:15 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:15 -0800
commit1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353 (patch)
tree4457a7306ea5acb43fe05bfe0973b1f7faf97ba2 /WebCore/dom/Traversal.cpp
parent9364f22aed35e1a1e9d07c121510f80be3ab0502 (diff)
downloadexternal_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.zip
external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.gz
external_webkit-1cbdecfa9fc428ac2d8aca0fa91c9580b3d57353.tar.bz2
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'WebCore/dom/Traversal.cpp')
-rw-r--r--WebCore/dom/Traversal.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/WebCore/dom/Traversal.cpp b/WebCore/dom/Traversal.cpp
index 5e1aa03..c2c91d4 100644
--- a/WebCore/dom/Traversal.cpp
+++ b/WebCore/dom/Traversal.cpp
@@ -1,11 +1,9 @@
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* Copyright (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
* Copyright (C) 2001 Peter Kelly (pmk@post.com)
* Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
- * Copyright (C) 2004 Apple Computer, Inc.
+ * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -29,11 +27,12 @@
#include "Node.h"
#include "NodeFilter.h"
-#include <wtf/PassRefPtr.h>
+
+using namespace JSC;
namespace WebCore {
-Traversal::Traversal(Node* rootNode, unsigned whatToShow, PassRefPtr<NodeFilter> nodeFilter, bool expandEntityReferences)
+Traversal::Traversal(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<NodeFilter> nodeFilter, bool expandEntityReferences)
: m_root(rootNode)
, m_whatToShow(whatToShow)
, m_filter(nodeFilter)
@@ -41,19 +40,17 @@ Traversal::Traversal(Node* rootNode, unsigned whatToShow, PassRefPtr<NodeFilter>
{
}
-Traversal::~Traversal()
+short Traversal::acceptNode(ExecState* exec, Node* node) const
{
-}
+ // FIXME: To handle XML properly we would have to check m_expandEntityReferences.
-short Traversal::acceptNode(Node* node) const
-{
- // FIXME: If XML is implemented we have to check expandEntityRerefences in this function.
- // The bid twiddling here is done to map DOM node types, which are given as integers from
+ // The bit twiddling here is done to map DOM node types, which are given as integers from
// 1 through 12, to whatToShow bit masks.
- if (node && ((1 << (node->nodeType()-1)) & m_whatToShow))
- // cast to short silences "enumeral and non-enumeral types in return" warning
- return m_filter ? m_filter->acceptNode(node) : static_cast<short>(NodeFilter::FILTER_ACCEPT);
- return NodeFilter::FILTER_SKIP;
+ if (!(((1 << (node->nodeType() - 1)) & m_whatToShow)))
+ return NodeFilter::FILTER_SKIP;
+ if (!m_filter)
+ return NodeFilter::FILTER_ACCEPT;
+ return m_filter->acceptNode(exec, node);
}
} // namespace WebCore