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

Side by Side Diff: webkit/pending/TreeWalker.h

Issue 4097: Implement better JS exception handling by abstracting KJS::ExecState into an ... (Closed) Base URL: svn://chrome-svn/chrome/branches/chrome_webkit_merge_branch/
Patch Set: '' Created 12 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « webkit/pending/Traversal.cpp ('k') | webkit/pending/TreeWalker.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef TreeWalker_h 25 #ifndef TreeWalker_h
26 #define TreeWalker_h 26 #define TreeWalker_h
27 27
28 #if USE(JSC) 28 #include "ExceptionContext.h"
29 #include "JSDOMBinding.h"
30 #endif
31 #include "NodeFilter.h" 29 #include "NodeFilter.h"
32 #include "Traversal.h" 30 #include "Traversal.h"
33 #include <wtf/PassRefPtr.h> 31 #include <wtf/PassRefPtr.h>
34 #include <wtf/RefCounted.h> 32 #include <wtf/RefCounted.h>
35 33
36 namespace WebCore { 34 namespace WebCore {
37 35
38 typedef int ExceptionCode; 36 typedef int ExceptionCode;
39 37
40 class TreeWalker : public RefCounted<TreeWalker>, public Traversal { 38 class TreeWalker : public RefCounted<TreeWalker>, public Traversal {
41 public: 39 public:
42 static PassRefPtr<TreeWalker> create(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences) 40 static PassRefPtr<TreeWalker> create(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences)
43 { 41 {
44 return adoptRef(new TreeWalker(rootNode, whatToShow, filter, expandE ntityReferences)); 42 return adoptRef(new TreeWalker(rootNode, whatToShow, filter, expandE ntityReferences));
45 } 43 }
46 44
47 Node* currentNode() const { return m_current.get(); } 45 Node* currentNode() const { return m_current.get(); }
48 void setCurrentNode(PassRefPtr<Node>, ExceptionCode&); 46 void setCurrentNode(PassRefPtr<Node>, ExceptionCode&);
49 47
50 #if USE(JSC) 48 Node* parentNode(ExceptionContext*);
51 Node* parentNode(KJS::ExecState*); 49 Node* firstChild(ExceptionContext*);
52 Node* firstChild(KJS::ExecState*); 50 Node* lastChild(ExceptionContext*);
53 Node* lastChild(KJS::ExecState*); 51 Node* previousSibling(ExceptionContext*);
54 Node* previousSibling(KJS::ExecState*); 52 Node* nextSibling(ExceptionContext*);
55 Node* nextSibling(KJS::ExecState*); 53 Node* previousNode(ExceptionContext*);
56 Node* previousNode(KJS::ExecState*); 54 Node* nextNode(ExceptionContext*);
57 Node* nextNode(KJS::ExecState*);
58 55
59 // For non-JS bindings. Silently ignores the JavaScript exception if any . 56 // For non-JS bindings. Silently ignores the JavaScript exception if any .
60 Node* parentNode() { return parentNode(execStateFromNode(m_current.get() )); } 57 Node* parentNode() { return parentNode(ExceptionContext::createFromNode( m_current.get())); }
61 Node* firstChild() { return firstChild(execStateFromNode(m_current.get() )); } 58 Node* firstChild() { return firstChild(ExceptionContext::createFromNode( m_current.get())); }
62 Node* lastChild() { return lastChild(execStateFromNode(m_current.get())) ; } 59 Node* lastChild() { return lastChild(ExceptionContext::createFromNode(m_ current.get())); }
63 Node* previousSibling() { return previousSibling(execStateFromNode(m_cur rent.get())); } 60 Node* previousSibling() { return previousSibling(ExceptionContext::creat eFromNode(m_current.get())); }
64 Node* nextSibling() { return nextSibling(execStateFromNode(m_current.get ())); } 61 Node* nextSibling() { return nextSibling(ExceptionContext::createFromNod e(m_current.get())); }
65 Node* previousNode() { return previousNode(execStateFromNode(m_current.g et())); } 62 Node* previousNode() { return previousNode(ExceptionContext::createFromN ode(m_current.get())); }
66 Node* nextNode() { return nextNode(execStateFromNode(m_current.get())); } 63 Node* nextNode() { return nextNode(ExceptionContext::createFromNode(m_cu rrent.get())); }
67 #endif
68 64
69 private: 65 private:
70 TreeWalker(PassRefPtr<Node>, unsigned whatToShow, PassRefPtr<NodeFilter> , bool expandEntityReferences); 66 TreeWalker(PassRefPtr<Node>, unsigned whatToShow, PassRefPtr<NodeFilter> , bool expandEntityReferences);
71 67
72 Node* setCurrent(PassRefPtr<Node>); 68 Node* setCurrent(PassRefPtr<Node>);
73 69
74 RefPtr<Node> m_current; 70 RefPtr<Node> m_current;
75 }; 71 };
76 72
77 } // namespace WebCore 73 } // namespace WebCore
78 74
79 #endif // TreeWalker_h 75 #endif // TreeWalker_h
OLDNEW
« no previous file with comments | « webkit/pending/Traversal.cpp ('k') | webkit/pending/TreeWalker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698