Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: third_party/WebKit/Source/core/dom/NodeIteratorBase.cpp

Issue 2840163002: DOM: NodeIterator.filter and TreeWalker.filter should return values which were specified to createN… (Closed)
Patch Set: Move ToV8() to ToV8ForCore.h, etc. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2000 Frederik Holljen (frederik.holljen@hig.no) 3 * Copyright (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
4 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 4 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
5 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * 12 *
13 * This library is distributed in the hope that it will be useful, 13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details. 16 * Library General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Library General Public License 18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to 19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 * 22 *
23 */ 23 */
24 24
25 #include "core/dom/NodeIteratorBase.h" 25 #include "core/dom/NodeIteratorBase.h"
26 26
27 #include "bindings/core/v8/ExceptionState.h" 27 #include "bindings/core/v8/ExceptionState.h"
28 #include "bindings/core/v8/V8NodeFilterCondition.h"
28 #include "core/dom/Node.h" 29 #include "core/dom/Node.h"
29 #include "core/dom/NodeFilter.h" 30 #include "core/dom/NodeFilter.h"
30 31
31 namespace blink { 32 namespace blink {
32 33
33 NodeIteratorBase::NodeIteratorBase(void* child_this, 34 NodeIteratorBase::NodeIteratorBase(void* child_this,
34 Node* root_node, 35 Node* root_node,
35 unsigned what_to_show, 36 unsigned what_to_show,
36 NodeFilter* node_filter) 37 V8NodeFilterCondition* node_filter)
37 : root_(root_node), 38 : root_(root_node),
38 what_to_show_(what_to_show), 39 what_to_show_(what_to_show),
39 filter_(child_this, node_filter) {} 40 filter_(child_this, node_filter) {}
40 41
41 unsigned NodeIteratorBase::AcceptNode(Node* node, 42 unsigned NodeIteratorBase::AcceptNode(Node* node,
42 ExceptionState& exception_state) const { 43 ExceptionState& exception_state) const {
43 // The bit twiddling here is done to map DOM node types, which are given as 44 // The bit twiddling here is done to map DOM node types, which are given as
44 // integers from 1 through 14, to whatToShow bit masks. 45 // integers from 1 through 14, to whatToShow bit masks.
45 if (!(((1 << (node->getNodeType() - 1)) & what_to_show_))) 46 if (!(((1 << (node->getNodeType() - 1)) & what_to_show_)))
46 return NodeFilter::kFilterSkip; 47 return NodeFilter::kFilterSkip;
47 if (!filter_) 48 if (!filter_)
48 return NodeFilter::kFilterAccept; 49 return NodeFilter::kFilterAccept;
49 return filter_->acceptNode(node, exception_state); 50 return filter_->acceptNode(node, exception_state);
50 } 51 }
51 52
52 DEFINE_TRACE(NodeIteratorBase) { 53 DEFINE_TRACE(NodeIteratorBase) {
53 visitor->Trace(root_); 54 visitor->Trace(root_);
54 visitor->Trace(filter_); 55 visitor->Trace(filter_);
55 } 56 }
56 57
57 DEFINE_TRACE_WRAPPERS(NodeIteratorBase) { 58 DEFINE_TRACE_WRAPPERS(NodeIteratorBase) {
58 visitor->TraceWrappers(filter_); 59 visitor->TraceWrappers(filter_);
59 } 60 }
60 61
61 } // namespace blink 62 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/NodeIteratorBase.h ('k') | third_party/WebKit/Source/core/dom/TreeWalker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698