2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
4 * Copyright (C) 2001 Peter Kelly (pmk@post.com)
5 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2004, 2008, 2009 Apple Inc. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
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
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
28 #include "bindings/core/v8/ScriptWrappable.h"
29 #include "core/dom/NodeFilterCondition.h"
30 #include "platform/heap/Handle.h"
31 #include "wtf/RefPtr.h"
35 class NodeFilter final : public RefCountedWillBeGarbageCollected<NodeFilter>, public ScriptWrappable {
36 DEFINE_WRAPPERTYPEINFO();
39 * The following constants are returned by the acceptNode()
49 * These are the available values for the whatToShow parameter.
50 * They are the same as the set of possible types for Node, and
51 * their values are derived by using a bit position corresponding
52 * to the value of NodeType for the equivalent node type.
55 SHOW_ALL = 0xFFFFFFFF,
56 SHOW_ELEMENT = 0x00000001,
57 SHOW_ATTRIBUTE = 0x00000002,
58 SHOW_TEXT = 0x00000004,
59 SHOW_CDATA_SECTION = 0x00000008,
60 SHOW_ENTITY_REFERENCE = 0x00000010,
61 SHOW_ENTITY = 0x00000020,
62 SHOW_PROCESSING_INSTRUCTION = 0x00000040,
63 SHOW_COMMENT = 0x00000080,
64 SHOW_DOCUMENT = 0x00000100,
65 SHOW_DOCUMENT_TYPE = 0x00000200,
66 SHOW_DOCUMENT_FRAGMENT = 0x00000400,
67 SHOW_NOTATION = 0x00000800
70 static PassRefPtrWillBeRawPtr<NodeFilter> create(PassRefPtrWillBeRawPtr<NodeFilterCondition> condition)
72 return adoptRefWillBeNoop(new NodeFilter(condition));
75 static PassRefPtrWillBeRawPtr<NodeFilter> create()
77 return adoptRefWillBeNoop(new NodeFilter());
80 short acceptNode(Node*, ExceptionState&) const;
82 void setCondition(PassRefPtrWillBeRawPtr<NodeFilterCondition> condition)
84 m_condition = condition;
90 explicit NodeFilter(PassRefPtrWillBeRawPtr<NodeFilterCondition> condition) : m_condition(condition) { }
94 RefPtrWillBeMember<NodeFilterCondition> m_condition;
99 #endif // NodeFilter_h