| OLD | NEW |
| 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 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #include "config.h" | 25 #include "config.h" |
| 26 #include "core/dom/Traversal.h" | 26 #include "core/dom/Traversal.h" |
| 27 | 27 |
| 28 #include "core/dom/Node.h" | 28 #include "core/dom/Node.h" |
| 29 #include "core/dom/NodeFilter.h" | 29 #include "core/dom/NodeFilter.h" |
| 30 | 30 |
| 31 namespace WebCore { | 31 namespace WebCore { |
| 32 | 32 |
| 33 Traversal::Traversal(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<
NodeFilter> nodeFilter, bool expandEntityReferences) | 33 Traversal::Traversal(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<
NodeFilter> nodeFilter) |
| 34 : m_root(rootNode) | 34 : m_root(rootNode) |
| 35 , m_whatToShow(whatToShow) | 35 , m_whatToShow(whatToShow) |
| 36 , m_filter(nodeFilter) | 36 , m_filter(nodeFilter) |
| 37 , m_expandEntityReferences(expandEntityReferences) | |
| 38 { | 37 { |
| 39 } | 38 } |
| 40 | 39 |
| 41 short Traversal::acceptNode(ScriptState* state, Node* node) const | 40 short Traversal::acceptNode(ScriptState* state, Node* node) const |
| 42 { | 41 { |
| 43 // FIXME: To handle XML properly we would have to check m_expandEntityRefere
nces. | |
| 44 | |
| 45 // The bit twiddling here is done to map DOM node types, which are given as
integers from | 42 // The bit twiddling here is done to map DOM node types, which are given as
integers from |
| 46 // 1 through 14, to whatToShow bit masks. | 43 // 1 through 14, to whatToShow bit masks. |
| 47 if (!(((1 << (node->nodeType() - 1)) & m_whatToShow))) | 44 if (!(((1 << (node->nodeType() - 1)) & m_whatToShow))) |
| 48 return NodeFilter::FILTER_SKIP; | 45 return NodeFilter::FILTER_SKIP; |
| 49 if (!m_filter) | 46 if (!m_filter) |
| 50 return NodeFilter::FILTER_ACCEPT; | 47 return NodeFilter::FILTER_ACCEPT; |
| 51 return m_filter->acceptNode(state, node); | 48 return m_filter->acceptNode(state, node); |
| 52 } | 49 } |
| 53 | 50 |
| 54 } // namespace WebCore | 51 } // namespace WebCore |
| OLD | NEW |