OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Harri Porten (porten@kde.org) | 2 * Copyright (C) 2000 Harri Porten (porten@kde.org) |
3 * Copyright (C) 2001 Peter Kelly (pmk@post.com) | 3 * Copyright (C) 2001 Peter Kelly (pmk@post.com) |
4 * Copyright (C) 2004-2006 Apple Computer, Inc. | 4 * Copyright (C) 2004-2006 Apple Computer, Inc. |
5 * Copyright (C) 2006 James G. Speth (speth@end.com) | 5 * Copyright (C) 2006 James G. Speth (speth@end.com) |
6 * Copyright (C) 2006 Samuel Weinig (sam@webkit.org) | 6 * Copyright (C) 2006 Samuel Weinig (sam@webkit.org) |
7 * Copyright 2007, 2008 Google Inc. All Rights Reserved. | 7 * Copyright 2007, 2008 Google Inc. All Rights Reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Lesser General Public | 10 * modify it under the terms of the GNU Lesser General Public |
(...skipping 2994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3005 } | 3005 } |
3006 | 3006 |
3007 | 3007 |
3008 // TreeWalker ------------------------------------------------------------------ | 3008 // TreeWalker ------------------------------------------------------------------ |
3009 | 3009 |
3010 CALLBACK_FUNC_DECL(TreeWalkerParentNode) { | 3010 CALLBACK_FUNC_DECL(TreeWalkerParentNode) { |
3011 INC_STATS(L"DOM.TreeWalker.parentNode()"); | 3011 INC_STATS(L"DOM.TreeWalker.parentNode()"); |
3012 TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( | 3012 TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( |
3013 V8ClassIndex::TREEWALKER, args.Holder()); | 3013 V8ClassIndex::TREEWALKER, args.Holder()); |
3014 | 3014 |
3015 OwnPtr<ExceptionContext> context(new ExceptionContext()); | 3015 ExceptionContext context(NULL); |
3016 RefPtr<Node> result = treeWalker->parentNode(context.get()); | 3016 RefPtr<Node> result = treeWalker->parentNode(&context); |
3017 if (context->hadException()) { | 3017 if (context.hadException()) { |
3018 v8::ThrowException(context->exception()); | 3018 v8::ThrowException(context.data()); |
3019 return v8::Undefined(); | 3019 return v8::Undefined(); |
3020 } | 3020 } |
3021 if (!result) return v8::Null(); | 3021 if (!result) return v8::Null(); |
3022 return V8Proxy::NodeToV8Object(result.get()); | 3022 return V8Proxy::NodeToV8Object(result.get()); |
3023 } | 3023 } |
3024 | 3024 |
3025 CALLBACK_FUNC_DECL(TreeWalkerFirstChild) { | 3025 CALLBACK_FUNC_DECL(TreeWalkerFirstChild) { |
3026 INC_STATS(L"DOM.TreeWalker.firstChild()"); | 3026 INC_STATS(L"DOM.TreeWalker.firstChild()"); |
3027 TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( | 3027 TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( |
3028 V8ClassIndex::TREEWALKER, args.Holder()); | 3028 V8ClassIndex::TREEWALKER, args.Holder()); |
3029 | 3029 |
3030 OwnPtr<ExceptionContext> context(new ExceptionContext()); | 3030 ExceptionContext context(NULL); |
3031 RefPtr<Node> result = treeWalker->firstChild(context.get()); | 3031 RefPtr<Node> result = treeWalker->firstChild(&context); |
3032 if (context->hadException()) { | 3032 if (context.hadException()) { |
3033 v8::ThrowException(context->exception()); | 3033 v8::ThrowException(context.data()); |
3034 return v8::Undefined(); | 3034 return v8::Undefined(); |
3035 } | 3035 } |
3036 if (!result) return v8::Null(); | 3036 if (!result) return v8::Null(); |
3037 return V8Proxy::NodeToV8Object(result.get()); | 3037 return V8Proxy::NodeToV8Object(result.get()); |
3038 } | 3038 } |
3039 | 3039 |
3040 CALLBACK_FUNC_DECL(TreeWalkerLastChild) { | 3040 CALLBACK_FUNC_DECL(TreeWalkerLastChild) { |
3041 INC_STATS(L"DOM.TreeWalker.lastChild()"); | 3041 INC_STATS(L"DOM.TreeWalker.lastChild()"); |
3042 TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( | 3042 TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( |
3043 V8ClassIndex::TREEWALKER, args.Holder()); | 3043 V8ClassIndex::TREEWALKER, args.Holder()); |
3044 | 3044 |
3045 OwnPtr<ExceptionContext> context(new ExceptionContext()); | 3045 ExceptionContext context(NULL); |
3046 RefPtr<Node> result = treeWalker->lastChild(context.get()); | 3046 RefPtr<Node> result = treeWalker->lastChild(&context); |
3047 if (context->hadException()) { | 3047 if (context.hadException()) { |
3048 v8::ThrowException(context->exception()); | 3048 v8::ThrowException(context.data()); |
3049 return v8::Undefined(); | 3049 return v8::Undefined(); |
3050 } | 3050 } |
3051 if (!result) return v8::Null(); | 3051 if (!result) return v8::Null(); |
3052 return V8Proxy::NodeToV8Object(result.get()); | 3052 return V8Proxy::NodeToV8Object(result.get()); |
3053 } | 3053 } |
3054 | 3054 |
3055 CALLBACK_FUNC_DECL(TreeWalkerNextNode) { | 3055 CALLBACK_FUNC_DECL(TreeWalkerNextNode) { |
3056 INC_STATS(L"DOM.TreeWalker.nextNode()"); | 3056 INC_STATS(L"DOM.TreeWalker.nextNode()"); |
3057 TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( | 3057 TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( |
3058 V8ClassIndex::TREEWALKER, args.Holder()); | 3058 V8ClassIndex::TREEWALKER, args.Holder()); |
3059 | 3059 |
3060 OwnPtr<ExceptionContext> context(new ExceptionContext()); | 3060 ExceptionContext context(NULL); |
3061 RefPtr<Node> result = treeWalker->nextNode(context.get()); | 3061 RefPtr<Node> result = treeWalker->nextNode(&context); |
3062 if (context->hadException()) { | 3062 if (context.hadException()) { |
3063 v8::ThrowException(context->exception()); | 3063 v8::ThrowException(context.data()); |
3064 return v8::Undefined(); | 3064 return v8::Undefined(); |
3065 } | 3065 } |
3066 if (!result) return v8::Null(); | 3066 if (!result) return v8::Null(); |
3067 return V8Proxy::NodeToV8Object(result.get()); | 3067 return V8Proxy::NodeToV8Object(result.get()); |
3068 } | 3068 } |
3069 | 3069 |
3070 CALLBACK_FUNC_DECL(TreeWalkerPreviousNode) { | 3070 CALLBACK_FUNC_DECL(TreeWalkerPreviousNode) { |
3071 INC_STATS(L"DOM.TreeWalker.previousNode()"); | 3071 INC_STATS(L"DOM.TreeWalker.previousNode()"); |
3072 TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( | 3072 TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( |
3073 V8ClassIndex::TREEWALKER, args.Holder()); | 3073 V8ClassIndex::TREEWALKER, args.Holder()); |
3074 | 3074 |
3075 OwnPtr<ExceptionContext> context(new ExceptionContext()); | 3075 ExceptionContext context(NULL); |
3076 RefPtr<Node> result = treeWalker->previousNode(context.get()); | 3076 RefPtr<Node> result = treeWalker->previousNode(&context); |
3077 if (context->hadException()) { | 3077 if (context.hadException()) { |
3078 v8::ThrowException(context->exception()); | 3078 v8::ThrowException(context.data()); |
3079 return v8::Undefined(); | 3079 return v8::Undefined(); |
3080 } | 3080 } |
3081 if (!result) return v8::Null(); | 3081 if (!result) return v8::Null(); |
3082 return V8Proxy::NodeToV8Object(result.get()); | 3082 return V8Proxy::NodeToV8Object(result.get()); |
3083 } | 3083 } |
3084 | 3084 |
3085 CALLBACK_FUNC_DECL(TreeWalkerNextSibling) { | 3085 CALLBACK_FUNC_DECL(TreeWalkerNextSibling) { |
3086 INC_STATS(L"DOM.TreeWalker.nextSibling()"); | 3086 INC_STATS(L"DOM.TreeWalker.nextSibling()"); |
3087 TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( | 3087 TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( |
3088 V8ClassIndex::TREEWALKER, args.Holder()); | 3088 V8ClassIndex::TREEWALKER, args.Holder()); |
3089 | 3089 |
3090 OwnPtr<ExceptionContext> context(new ExceptionContext()); | 3090 ExceptionContext context(NULL); |
3091 RefPtr<Node> result = treeWalker->nextSibling(context.get()); | 3091 RefPtr<Node> result = treeWalker->nextSibling(&context); |
3092 if (context->hadException()) { | 3092 if (context.hadException()) { |
3093 v8::ThrowException(context->exception()); | 3093 v8::ThrowException(context.data()); |
3094 return v8::Undefined(); | 3094 return v8::Undefined(); |
3095 } | 3095 } |
3096 if (!result) return v8::Null(); | 3096 if (!result) return v8::Null(); |
3097 return V8Proxy::NodeToV8Object(result.get()); | 3097 return V8Proxy::NodeToV8Object(result.get()); |
3098 } | 3098 } |
3099 | 3099 |
3100 CALLBACK_FUNC_DECL(TreeWalkerPreviousSibling) { | 3100 CALLBACK_FUNC_DECL(TreeWalkerPreviousSibling) { |
3101 INC_STATS(L"DOM.TreeWalker.previousSibling()"); | 3101 INC_STATS(L"DOM.TreeWalker.previousSibling()"); |
3102 TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( | 3102 TreeWalker* treeWalker = V8Proxy::ToNativeObject<TreeWalker>( |
3103 V8ClassIndex::TREEWALKER, args.Holder()); | 3103 V8ClassIndex::TREEWALKER, args.Holder()); |
3104 | 3104 |
3105 OwnPtr<ExceptionContext> context(new ExceptionContext()); | 3105 ExceptionContext context(NULL); |
3106 RefPtr<Node> result = treeWalker->previousSibling(context.get()); | 3106 RefPtr<Node> result = treeWalker->previousSibling(&context); |
3107 if (context->hadException()) { | 3107 if (context.hadException()) { |
3108 v8::ThrowException(context->exception()); | 3108 v8::ThrowException(context.data()); |
3109 return v8::Undefined(); | 3109 return v8::Undefined(); |
3110 } | 3110 } |
3111 if (!result) return v8::Null(); | 3111 if (!result) return v8::Null(); |
3112 return V8Proxy::NodeToV8Object(result.get()); | 3112 return V8Proxy::NodeToV8Object(result.get()); |
3113 } | 3113 } |
3114 | 3114 |
3115 CALLBACK_FUNC_DECL(NodeIteratorNextNode) { | 3115 CALLBACK_FUNC_DECL(NodeIteratorNextNode) { |
3116 INC_STATS(L"DOM.NodeIterator.nextNode()"); | 3116 INC_STATS(L"DOM.NodeIterator.nextNode()"); |
3117 NodeIterator* nodeIterator = V8Proxy::ToNativeObject<NodeIterator>( | 3117 NodeIterator* nodeIterator = V8Proxy::ToNativeObject<NodeIterator>( |
3118 V8ClassIndex::NODEITERATOR, args.Holder()); | 3118 V8ClassIndex::NODEITERATOR, args.Holder()); |
3119 | 3119 |
3120 ExceptionCode ec = 0; | 3120 ExceptionCode ec = 0; |
3121 OwnPtr<ExceptionContext> context(new ExceptionContext()); | 3121 ExceptionContext context(NULL); |
3122 RefPtr<Node> result = nodeIterator->nextNode(context.get(), ec); | 3122 RefPtr<Node> result = nodeIterator->nextNode(&context, ec); |
3123 if (ec != 0) { | 3123 if (ec != 0) { |
3124 V8Proxy::SetDOMException(ec); | 3124 V8Proxy::SetDOMException(ec); |
3125 return v8::Null(); | 3125 return v8::Null(); |
3126 } | 3126 } |
3127 if (context->hadException()) { | 3127 if (context.hadException()) { |
3128 v8::ThrowException(context->exception()); | 3128 v8::ThrowException(context.data()); |
3129 return v8::Undefined(); | 3129 return v8::Undefined(); |
3130 } | 3130 } |
3131 if (!result) return v8::Null(); | 3131 if (!result) return v8::Null(); |
3132 return V8Proxy::NodeToV8Object(result.get()); | 3132 return V8Proxy::NodeToV8Object(result.get()); |
3133 } | 3133 } |
3134 | 3134 |
3135 CALLBACK_FUNC_DECL(NodeIteratorPreviousNode) { | 3135 CALLBACK_FUNC_DECL(NodeIteratorPreviousNode) { |
3136 INC_STATS(L"DOM.NodeIterator.previousNode()"); | 3136 INC_STATS(L"DOM.NodeIterator.previousNode()"); |
3137 NodeIterator* nodeIterator = V8Proxy::ToNativeObject<NodeIterator>( | 3137 NodeIterator* nodeIterator = V8Proxy::ToNativeObject<NodeIterator>( |
3138 V8ClassIndex::NODEITERATOR, args.Holder()); | 3138 V8ClassIndex::NODEITERATOR, args.Holder()); |
3139 | 3139 |
3140 ExceptionCode ec = 0; | 3140 ExceptionCode ec = 0; |
3141 OwnPtr<ExceptionContext> context(new ExceptionContext()); | 3141 ExceptionContext context(NULL); |
3142 RefPtr<Node> result = nodeIterator->previousNode(context.get(), ec); | 3142 RefPtr<Node> result = nodeIterator->previousNode(&context, ec); |
3143 if (ec != 0) { | 3143 if (ec != 0) { |
3144 V8Proxy::SetDOMException(ec); | 3144 V8Proxy::SetDOMException(ec); |
3145 return v8::Null(); | 3145 return v8::Null(); |
3146 } | 3146 } |
3147 if (context->hadException()) { | 3147 if (context.hadException()) { |
3148 v8::ThrowException(context->exception()); | 3148 v8::ThrowException(context.data()); |
3149 return v8::Undefined(); | 3149 return v8::Undefined(); |
3150 } | 3150 } |
3151 if (!result) return v8::Null(); | 3151 if (!result) return v8::Null(); |
3152 return V8Proxy::NodeToV8Object(result.get()); | 3152 return V8Proxy::NodeToV8Object(result.get()); |
3153 } | 3153 } |
3154 | 3154 |
3155 CALLBACK_FUNC_DECL(NodeFilterAcceptNode) { | 3155 CALLBACK_FUNC_DECL(NodeFilterAcceptNode) { |
3156 INC_STATS(L"DOM.NodeFilter.acceptNode()"); | 3156 INC_STATS(L"DOM.NodeFilter.acceptNode()"); |
3157 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); | 3157 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); |
3158 return v8::Undefined(); | 3158 return v8::Undefined(); |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3607 #undef MAKE_CASE | 3607 #undef MAKE_CASE |
3608 | 3608 |
3609 default: | 3609 default: |
3610 return V8ClassIndex::INVALID_CLASS_INDEX; | 3610 return V8ClassIndex::INVALID_CLASS_INDEX; |
3611 } | 3611 } |
3612 } | 3612 } |
3613 | 3613 |
3614 #endif // ENABLE(SVG) | 3614 #endif // ENABLE(SVG) |
3615 | 3615 |
3616 } // namespace WebCore | 3616 } // namespace WebCore |
OLD | NEW |