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 25 matching lines...) Expand all Loading... |
36 #include "V8Attr.h" | 36 #include "V8Attr.h" |
37 #include "V8CanvasGradient.h" | 37 #include "V8CanvasGradient.h" |
38 #include "V8CanvasPattern.h" | 38 #include "V8CanvasPattern.h" |
39 #include "V8Document.h" | 39 #include "V8Document.h" |
40 #include "V8DOMWindow.h" | 40 #include "V8DOMWindow.h" |
41 #include "V8HTMLCanvasElement.h" | 41 #include "V8HTMLCanvasElement.h" |
42 #include "V8HTMLDocument.h" | 42 #include "V8HTMLDocument.h" |
43 #include "V8HTMLImageElement.h" | 43 #include "V8HTMLImageElement.h" |
44 #include "V8HTMLOptionElement.h" | 44 #include "V8HTMLOptionElement.h" |
45 #include "V8Node.h" | 45 #include "V8Node.h" |
| 46 #include "V8NSResolver.h" |
46 #include "V8XPathNSResolver.h" | 47 #include "V8XPathNSResolver.h" |
47 #include "V8XPathResult.h" | 48 #include "V8XPathResult.h" |
48 | 49 |
49 #include "CanvasGradient.h" | 50 #include "CanvasGradient.h" |
50 #include "CanvasPattern.h" | 51 #include "CanvasPattern.h" |
51 #include "CanvasStyle.h" | 52 #include "CanvasStyle.h" |
52 #include "CanvasRenderingContext2D.h" | 53 #include "CanvasRenderingContext2D.h" |
53 | 54 |
54 #include "Clipboard.h" | 55 #include "Clipboard.h" |
55 #include "ClipboardEvent.h" | 56 #include "ClipboardEvent.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 #include "NodeIterator.h" | 94 #include "NodeIterator.h" |
94 #include "Page.h" | 95 #include "Page.h" |
95 #include "PlatformScreen.h" | 96 #include "PlatformScreen.h" |
96 #include "RenderWidget.h" | 97 #include "RenderWidget.h" |
97 #include "RenderPartObject.h" | 98 #include "RenderPartObject.h" |
98 #include "RGBColor.h" | 99 #include "RGBColor.h" |
99 #include "SecurityOrigin.h" | 100 #include "SecurityOrigin.h" |
100 #include "Settings.h" | 101 #include "Settings.h" |
101 #include "StyleSheetList.h" | 102 #include "StyleSheetList.h" |
102 #include "TreeWalker.h" | 103 #include "TreeWalker.h" |
| 104 #include "JSNSResolver.h" |
103 #include "WindowFeatures.h" | 105 #include "WindowFeatures.h" |
104 #include "XPathEvaluator.h" | 106 #include "XPathEvaluator.h" |
105 #include "JSXPathNSResolver.h" | 107 #include "JSXPathNSResolver.h" |
106 #include "XPathResult.h" | 108 #include "XPathResult.h" |
107 #include "XSLTProcessor.h" | 109 #include "XSLTProcessor.h" |
108 | 110 |
109 #if ENABLE(SVG) | 111 #if ENABLE(SVG) |
110 #include "V8SVGPODTypeWrapper.h" | 112 #include "V8SVGPODTypeWrapper.h" |
111 #include "SVGException.h" | 113 #include "SVGException.h" |
112 #include "SVGPathSeg.h" | 114 #include "SVGPathSeg.h" |
(...skipping 2225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2338 return false; | 2340 return false; |
2339 } | 2341 } |
2340 return true; | 2342 return true; |
2341 } | 2343 } |
2342 | 2344 |
2343 | 2345 |
2344 // Element --------------------------------------------------------------------- | 2346 // Element --------------------------------------------------------------------- |
2345 | 2347 |
2346 CALLBACK_FUNC_DECL(ElementQuerySelector) { | 2348 CALLBACK_FUNC_DECL(ElementQuerySelector) { |
2347 INC_STATS(L"DOM.Element.querySelector()"); | 2349 INC_STATS(L"DOM.Element.querySelector()"); |
2348 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); | 2350 Element* element = V8Proxy::FastToNativeObject<Element>( |
2349 return v8::Undefined(); | 2351 V8ClassIndex::ELEMENT, args.Holder()); |
| 2352 ExceptionCode ec = 0; |
| 2353 |
| 2354 String selectors = valueToStringWithNullOrUndefinedCheck(args[0]); |
| 2355 |
| 2356 NSResolver* resolver = 0; |
| 2357 if (V8NSResolver::HasInstance(args[1])) { |
| 2358 resolver = V8Proxy::FastToNativeObject<NSResolver>( |
| 2359 V8ClassIndex::NSRESOLVER, args[1]); |
| 2360 } else if (args[1]->IsObject()) { |
| 2361 if (!args[1]->IsNull()) |
| 2362 resolver = new JSNSResolver(args[1]->ToObject()); |
| 2363 } else if (!args[1]->IsUndefined()) { |
| 2364 V8Proxy::SetDOMException(TYPE_MISMATCH_ERR); |
| 2365 return v8::Handle<v8::Value>(); |
| 2366 } |
| 2367 OwnPtr<ExceptionContext> context(new ExceptionContext()); |
| 2368 RefPtr<Element> result = WTF::getPtr( |
| 2369 element->querySelector(selectors, resolver, ec, context.get())); |
| 2370 if (ec != 0) { |
| 2371 V8Proxy::SetDOMException(ec); |
| 2372 return v8::Handle<v8::Value>(); |
| 2373 } |
| 2374 return V8Proxy::ToV8Object(V8ClassIndex::NODE, WTF::getPtr(result)); |
2350 } | 2375 } |
2351 | 2376 |
2352 CALLBACK_FUNC_DECL(ElementQuerySelectorAll) { | 2377 CALLBACK_FUNC_DECL(ElementQuerySelectorAll) { |
2353 INC_STATS(L"DOM.Element.querySelectorAll()"); | 2378 INC_STATS(L"DOM.Element.querySelectorAll()"); |
2354 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); | 2379 Element* element = V8Proxy::FastToNativeObject<Element>( |
2355 return v8::Undefined(); | 2380 V8ClassIndex::ELEMENT, args.Holder()); |
| 2381 ExceptionCode ec = 0; |
| 2382 |
| 2383 String selectors = valueToStringWithNullOrUndefinedCheck(args[0]); |
| 2384 |
| 2385 NSResolver* resolver = 0; |
| 2386 if (V8NSResolver::HasInstance(args[1])) { |
| 2387 resolver = V8Proxy::FastToNativeObject<NSResolver>( |
| 2388 V8ClassIndex::NSRESOLVER, args[1]); |
| 2389 } else if (args[1]->IsObject()) { |
| 2390 if (!args[1]->IsNull()) |
| 2391 resolver = new JSNSResolver(args[1]->ToObject()); |
| 2392 } else if (!args[1]->IsUndefined()) { |
| 2393 V8Proxy::SetDOMException(TYPE_MISMATCH_ERR); |
| 2394 return v8::Handle<v8::Value>(); |
| 2395 } |
| 2396 OwnPtr<ExceptionContext> context(new ExceptionContext()); |
| 2397 RefPtr<NodeList> result = WTF::getPtr( |
| 2398 element->querySelectorAll(selectors, resolver, ec, context.get())); |
| 2399 if (ec != 0) { |
| 2400 V8Proxy::SetDOMException(ec); |
| 2401 return v8::Handle<v8::Value>(); |
| 2402 } |
| 2403 return V8Proxy::ToV8Object(V8ClassIndex::NODELIST, WTF::getPtr(result)); |
2356 } | 2404 } |
2357 | 2405 |
2358 CALLBACK_FUNC_DECL(ElementSetAttribute) { | 2406 CALLBACK_FUNC_DECL(ElementSetAttribute) { |
2359 INC_STATS(L"DOM.Element.setAttribute()"); | 2407 INC_STATS(L"DOM.Element.setAttribute()"); |
2360 Element* imp = V8Proxy::FastToNativeObject<Element>( | 2408 Element* imp = V8Proxy::FastToNativeObject<Element>( |
2361 V8ClassIndex::ELEMENT, args.Holder()); | 2409 V8ClassIndex::ELEMENT, args.Holder()); |
2362 ExceptionCode ec = 0; | 2410 ExceptionCode ec = 0; |
2363 String name = ToWebCoreString(args[0]); | 2411 String name = ToWebCoreString(args[0]); |
2364 String value = ToWebCoreString(args[1]); | 2412 String value = ToWebCoreString(args[1]); |
2365 | 2413 |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2689 if (ec != 0) { | 2737 if (ec != 0) { |
2690 V8Proxy::SetDOMException(ec); | 2738 V8Proxy::SetDOMException(ec); |
2691 return v8::Handle<v8::Value>(); | 2739 return v8::Handle<v8::Value>(); |
2692 } | 2740 } |
2693 return V8Proxy::ToV8Object(V8ClassIndex::XPATHRESULT, | 2741 return V8Proxy::ToV8Object(V8ClassIndex::XPATHRESULT, |
2694 static_cast<Peerable*>(result.get())); | 2742 static_cast<Peerable*>(result.get())); |
2695 } | 2743 } |
2696 | 2744 |
2697 CALLBACK_FUNC_DECL(DocumentQuerySelector) { | 2745 CALLBACK_FUNC_DECL(DocumentQuerySelector) { |
2698 INC_STATS(L"DOM.Document.querySelector()"); | 2746 INC_STATS(L"DOM.Document.querySelector()"); |
2699 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); | 2747 Document* document = V8Proxy::FastToNativeObject<Document>( |
2700 return v8::Undefined(); | 2748 V8ClassIndex::DOCUMENT, args.Holder()); |
| 2749 ExceptionCode ec = 0; |
| 2750 |
| 2751 String selectors = valueToStringWithNullOrUndefinedCheck(args[0]); |
| 2752 |
| 2753 NSResolver* resolver = 0; |
| 2754 if (V8NSResolver::HasInstance(args[1])) { |
| 2755 resolver = V8Proxy::FastToNativeObject<NSResolver>( |
| 2756 V8ClassIndex::NSRESOLVER, args[1]); |
| 2757 } else if (args[1]->IsObject()) { |
| 2758 if (!args[1]->IsNull()) |
| 2759 resolver = new JSNSResolver(args[1]->ToObject()); |
| 2760 } else if (!args[1]->IsUndefined()) { |
| 2761 V8Proxy::SetDOMException(TYPE_MISMATCH_ERR); |
| 2762 return v8::Handle<v8::Value>(); |
| 2763 } |
| 2764 OwnPtr<ExceptionContext> context(new ExceptionContext()); |
| 2765 RefPtr<Element> result = WTF::getPtr( |
| 2766 document->querySelector(selectors, resolver, ec, context.get())); |
| 2767 if (ec != 0) { |
| 2768 V8Proxy::SetDOMException(ec); |
| 2769 return v8::Handle<v8::Value>(); |
| 2770 } |
| 2771 return V8Proxy::ToV8Object(V8ClassIndex::NODE, WTF::getPtr(result)); |
2701 } | 2772 } |
2702 | 2773 |
2703 CALLBACK_FUNC_DECL(DocumentQuerySelectorAll) { | 2774 CALLBACK_FUNC_DECL(DocumentQuerySelectorAll) { |
2704 INC_STATS(L"DOM.Document.querySelectorAll()"); | 2775 INC_STATS(L"DOM.Document.querySelectorAll()"); |
2705 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); | 2776 Document* document = V8Proxy::FastToNativeObject<Document>( |
2706 return v8::Undefined(); | 2777 V8ClassIndex::DOCUMENTFRAGMENT, args.Holder()); |
| 2778 ExceptionCode ec = 0; |
| 2779 |
| 2780 String selectors = valueToStringWithNullOrUndefinedCheck(args[0]); |
| 2781 |
| 2782 NSResolver* resolver = 0; |
| 2783 if (V8NSResolver::HasInstance(args[1])) { |
| 2784 resolver = V8Proxy::FastToNativeObject<NSResolver>( |
| 2785 V8ClassIndex::NSRESOLVER, args[1]); |
| 2786 } else if (args[1]->IsObject()) { |
| 2787 if (!args[1]->IsNull()) |
| 2788 resolver = new JSNSResolver(args[1]->ToObject()); |
| 2789 } else if (!args[1]->IsUndefined()) { |
| 2790 V8Proxy::SetDOMException(TYPE_MISMATCH_ERR); |
| 2791 return v8::Handle<v8::Value>(); |
| 2792 } |
| 2793 OwnPtr<ExceptionContext> context(new ExceptionContext()); |
| 2794 RefPtr<NodeList> result = WTF::getPtr( |
| 2795 document->querySelectorAll(selectors, resolver, ec, context.get())); |
| 2796 if (ec != 0) { |
| 2797 V8Proxy::SetDOMException(ec); |
| 2798 return v8::Handle<v8::Value>(); |
| 2799 } |
| 2800 return V8Proxy::ToV8Object(V8ClassIndex::NODELIST, WTF::getPtr(result)); |
2707 } | 2801 } |
2708 | 2802 |
2709 CALLBACK_FUNC_DECL(DocumentFragmentQuerySelector) { | 2803 CALLBACK_FUNC_DECL(DocumentFragmentQuerySelector) { |
2710 INC_STATS(L"DOM.DocumentFragment.querySelector()"); | 2804 INC_STATS(L"DOM.DocumentFragment.querySelector()"); |
2711 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); | 2805 DocumentFragment* fragment = V8Proxy::FastToNativeObject<DocumentFragment>( |
2712 return v8::Undefined(); | 2806 V8ClassIndex::DOCUMENTFRAGMENT, args.Holder()); |
| 2807 ExceptionCode ec = 0; |
| 2808 |
| 2809 String selectors = valueToStringWithNullOrUndefinedCheck(args[0]); |
| 2810 |
| 2811 NSResolver* resolver = 0; |
| 2812 if (V8NSResolver::HasInstance(args[1])) { |
| 2813 resolver = V8Proxy::FastToNativeObject<NSResolver>( |
| 2814 V8ClassIndex::NSRESOLVER, args[1]); |
| 2815 } else if (args[1]->IsObject()) { |
| 2816 if (!args[1]->IsNull()) |
| 2817 resolver = new JSNSResolver(args[1]->ToObject()); |
| 2818 } else if (!args[1]->IsUndefined()) { |
| 2819 V8Proxy::SetDOMException(TYPE_MISMATCH_ERR); |
| 2820 return v8::Handle<v8::Value>(); |
| 2821 } |
| 2822 OwnPtr<ExceptionContext> context(new ExceptionContext()); |
| 2823 RefPtr<Element> result = WTF::getPtr( |
| 2824 fragment->querySelector(selectors, resolver, ec, context.get())); |
| 2825 if (ec != 0) { |
| 2826 V8Proxy::SetDOMException(ec); |
| 2827 return v8::Handle<v8::Value>(); |
| 2828 } |
| 2829 return V8Proxy::ToV8Object(V8ClassIndex::NODE, WTF::getPtr(result)); |
2713 } | 2830 } |
2714 | 2831 |
2715 CALLBACK_FUNC_DECL(DocumentFragmentQuerySelectorAll) { | 2832 CALLBACK_FUNC_DECL(DocumentFragmentQuerySelectorAll) { |
2716 INC_STATS(L"DOM.DocumentFragment.querySelectorAll()"); | 2833 INC_STATS(L"DOM.DocumentFragment.querySelectorAll()"); |
2717 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); | 2834 DocumentFragment* fragment = V8Proxy::FastToNativeObject<DocumentFragment>( |
2718 return v8::Undefined(); | 2835 V8ClassIndex::DOCUMENTFRAGMENT, args.Holder()); |
| 2836 ExceptionCode ec = 0; |
| 2837 |
| 2838 String selectors = valueToStringWithNullOrUndefinedCheck(args[0]); |
| 2839 |
| 2840 NSResolver* resolver = 0; |
| 2841 if (V8NSResolver::HasInstance(args[1])) { |
| 2842 resolver = V8Proxy::FastToNativeObject<NSResolver>( |
| 2843 V8ClassIndex::NSRESOLVER, args[1]); |
| 2844 } else if (args[1]->IsObject()) { |
| 2845 if (!args[1]->IsNull()) |
| 2846 resolver = new JSNSResolver(args[1]->ToObject()); |
| 2847 } else if (!args[1]->IsUndefined()) { |
| 2848 V8Proxy::SetDOMException(TYPE_MISMATCH_ERR); |
| 2849 return v8::Handle<v8::Value>(); |
| 2850 } |
| 2851 OwnPtr<ExceptionContext> context(new ExceptionContext()); |
| 2852 RefPtr<NodeList> result = WTF::getPtr( |
| 2853 fragment->querySelectorAll(selectors, resolver, ec, context.get())); |
| 2854 if (ec != 0) { |
| 2855 V8Proxy::SetDOMException(ec); |
| 2856 return v8::Handle<v8::Value>(); |
| 2857 } |
| 2858 return V8Proxy::ToV8Object(V8ClassIndex::NODELIST, WTF::getPtr(result)); |
2719 } | 2859 } |
2720 | 2860 |
2721 | |
2722 // DOMWindow ------------------------------------------------------------------- | 2861 // DOMWindow ------------------------------------------------------------------- |
2723 | 2862 |
2724 static bool IsAscii(const String& str) { | 2863 static bool IsAscii(const String& str) { |
2725 for (size_t i = 0; i < str.length(); i++) { | 2864 for (size_t i = 0; i < str.length(); i++) { |
2726 if (str[i] > 0xFF) | 2865 if (str[i] > 0xFF) |
2727 return false; | 2866 return false; |
2728 } | 2867 } |
2729 return true; | 2868 return true; |
2730 } | 2869 } |
2731 | 2870 |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3204 INC_STATS(L"DOM.XMLHttpRequestUpload.dispatchEvent()"); | 3343 INC_STATS(L"DOM.XMLHttpRequestUpload.dispatchEvent()"); |
3205 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); | 3344 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); |
3206 return v8::Undefined(); | 3345 return v8::Undefined(); |
3207 } | 3346 } |
3208 | 3347 |
3209 | 3348 |
3210 // TreeWalker ------------------------------------------------------------------ | 3349 // TreeWalker ------------------------------------------------------------------ |
3211 | 3350 |
3212 CALLBACK_FUNC_DECL(TreeWalkerParentNode) { | 3351 CALLBACK_FUNC_DECL(TreeWalkerParentNode) { |
3213 INC_STATS(L"DOM.TreeWalker.parentNode()"); | 3352 INC_STATS(L"DOM.TreeWalker.parentNode()"); |
3214 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); | 3353 TreeWalker* treeWalker = V8Proxy::FastToNativeObject<TreeWalker>( |
3215 return v8::Undefined(); | 3354 V8ClassIndex::TREEWALKER, args.Holder()); |
| 3355 |
| 3356 OwnPtr<ExceptionContext> context(new ExceptionContext()); |
| 3357 RefPtr<Node> result = treeWalker->parentNode(context.get()); |
| 3358 if (context->hadException()) { |
| 3359 v8::ThrowException(context->exception()); |
| 3360 return v8::Undefined(); |
| 3361 } |
| 3362 if (!result) return v8::Null(); |
| 3363 return V8Proxy::ToV8Object(V8ClassIndex::NODE, result.get()); |
3216 } | 3364 } |
3217 | 3365 |
3218 CALLBACK_FUNC_DECL(TreeWalkerFirstChild) { | 3366 CALLBACK_FUNC_DECL(TreeWalkerFirstChild) { |
3219 INC_STATS(L"DOM.TreeWalker.firstChild()"); | 3367 INC_STATS(L"DOM.TreeWalker.firstChild()"); |
3220 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); | 3368 TreeWalker* treeWalker = V8Proxy::FastToNativeObject<TreeWalker>( |
3221 return v8::Undefined(); | 3369 V8ClassIndex::TREEWALKER, args.Holder()); |
| 3370 |
| 3371 OwnPtr<ExceptionContext> context(new ExceptionContext()); |
| 3372 RefPtr<Node> result = treeWalker->firstChild(context.get()); |
| 3373 if (context->hadException()) { |
| 3374 v8::ThrowException(context->exception()); |
| 3375 return v8::Undefined(); |
| 3376 } |
| 3377 if (!result) return v8::Null(); |
| 3378 return V8Proxy::ToV8Object(V8ClassIndex::NODE, result.get()); |
3222 } | 3379 } |
3223 | 3380 |
3224 CALLBACK_FUNC_DECL(TreeWalkerLastChild) { | 3381 CALLBACK_FUNC_DECL(TreeWalkerLastChild) { |
3225 INC_STATS(L"DOM.TreeWalker.lastChild()"); | 3382 INC_STATS(L"DOM.TreeWalker.lastChild()"); |
3226 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); | 3383 TreeWalker* treeWalker = V8Proxy::FastToNativeObject<TreeWalker>( |
3227 return v8::Undefined(); | 3384 V8ClassIndex::TREEWALKER, args.Holder()); |
| 3385 |
| 3386 OwnPtr<ExceptionContext> context(new ExceptionContext()); |
| 3387 RefPtr<Node> result = treeWalker->lastChild(context.get()); |
| 3388 if (context->hadException()) { |
| 3389 v8::ThrowException(context->exception()); |
| 3390 return v8::Undefined(); |
| 3391 } |
| 3392 if (!result) return v8::Null(); |
| 3393 return V8Proxy::ToV8Object(V8ClassIndex::NODE, result.get()); |
3228 } | 3394 } |
3229 | 3395 |
3230 CALLBACK_FUNC_DECL(TreeWalkerNextNode) { | 3396 CALLBACK_FUNC_DECL(TreeWalkerNextNode) { |
3231 INC_STATS(L"DOM.TreeWalker.nextNode()"); | 3397 INC_STATS(L"DOM.TreeWalker.nextNode()"); |
3232 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); | 3398 TreeWalker* treeWalker = V8Proxy::FastToNativeObject<TreeWalker>( |
3233 return v8::Undefined(); | 3399 V8ClassIndex::TREEWALKER, args.Holder()); |
| 3400 |
| 3401 OwnPtr<ExceptionContext> context(new ExceptionContext()); |
| 3402 RefPtr<Node> result = treeWalker->nextNode(context.get()); |
| 3403 if (context->hadException()) { |
| 3404 v8::ThrowException(context->exception()); |
| 3405 return v8::Undefined(); |
| 3406 } |
| 3407 if (!result) return v8::Null(); |
| 3408 return V8Proxy::ToV8Object(V8ClassIndex::NODE, result.get()); |
3234 } | 3409 } |
3235 | 3410 |
3236 CALLBACK_FUNC_DECL(TreeWalkerPreviousNode) { | 3411 CALLBACK_FUNC_DECL(TreeWalkerPreviousNode) { |
3237 INC_STATS(L"DOM.TreeWalker.previousNode()"); | 3412 INC_STATS(L"DOM.TreeWalker.previousNode()"); |
3238 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); | 3413 TreeWalker* treeWalker = V8Proxy::FastToNativeObject<TreeWalker>( |
3239 return v8::Undefined(); | 3414 V8ClassIndex::TREEWALKER, args.Holder()); |
| 3415 |
| 3416 OwnPtr<ExceptionContext> context(new ExceptionContext()); |
| 3417 RefPtr<Node> result = treeWalker->previousNode(context.get()); |
| 3418 if (context->hadException()) { |
| 3419 v8::ThrowException(context->exception()); |
| 3420 return v8::Undefined(); |
| 3421 } |
| 3422 if (!result) return v8::Null(); |
| 3423 return V8Proxy::ToV8Object(V8ClassIndex::NODE, result.get()); |
3240 } | 3424 } |
3241 | 3425 |
3242 CALLBACK_FUNC_DECL(TreeWalkerNextSibling) { | 3426 CALLBACK_FUNC_DECL(TreeWalkerNextSibling) { |
3243 INC_STATS(L"DOM.TreeWalker.nextSibling()"); | 3427 INC_STATS(L"DOM.TreeWalker.nextSibling()"); |
3244 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); | 3428 TreeWalker* treeWalker = V8Proxy::FastToNativeObject<TreeWalker>( |
3245 return v8::Undefined(); | 3429 V8ClassIndex::TREEWALKER, args.Holder()); |
| 3430 |
| 3431 OwnPtr<ExceptionContext> context(new ExceptionContext()); |
| 3432 RefPtr<Node> result = treeWalker->nextSibling(context.get()); |
| 3433 if (context->hadException()) { |
| 3434 v8::ThrowException(context->exception()); |
| 3435 return v8::Undefined(); |
| 3436 } |
| 3437 if (!result) return v8::Null(); |
| 3438 return V8Proxy::ToV8Object(V8ClassIndex::NODE, result.get()); |
3246 } | 3439 } |
3247 | 3440 |
3248 CALLBACK_FUNC_DECL(TreeWalkerPreviousSibling) { | 3441 CALLBACK_FUNC_DECL(TreeWalkerPreviousSibling) { |
3249 INC_STATS(L"DOM.TreeWalker.previousSibling()"); | 3442 INC_STATS(L"DOM.TreeWalker.previousSibling()"); |
3250 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); | 3443 TreeWalker* treeWalker = V8Proxy::FastToNativeObject<TreeWalker>( |
3251 return v8::Undefined(); | 3444 V8ClassIndex::TREEWALKER, args.Holder()); |
| 3445 |
| 3446 OwnPtr<ExceptionContext> context(new ExceptionContext()); |
| 3447 RefPtr<Node> result = treeWalker->previousSibling(context.get()); |
| 3448 if (context->hadException()) { |
| 3449 v8::ThrowException(context->exception()); |
| 3450 return v8::Undefined(); |
| 3451 } |
| 3452 if (!result) return v8::Null(); |
| 3453 return V8Proxy::ToV8Object(V8ClassIndex::NODE, result.get()); |
3252 } | 3454 } |
3253 | 3455 |
3254 CALLBACK_FUNC_DECL(NodeIteratorNextNode) { | 3456 CALLBACK_FUNC_DECL(NodeIteratorNextNode) { |
3255 INC_STATS(L"DOM.NodeIterator.nextNode()"); | 3457 INC_STATS(L"DOM.NodeIterator.nextNode()"); |
3256 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); | 3458 NodeIterator* nodeIterator = V8Proxy::FastToNativeObject<NodeIterator>( |
3257 return v8::Undefined(); | 3459 V8ClassIndex::NODEITERATOR, args.Holder()); |
| 3460 |
| 3461 ExceptionCode ec = 0; |
| 3462 OwnPtr<ExceptionContext> context(new ExceptionContext()); |
| 3463 RefPtr<Node> result = nodeIterator->nextNode(context.get(), ec); |
| 3464 if (ec != 0) { |
| 3465 V8Proxy::SetDOMException(ec); |
| 3466 return v8::Null(); |
| 3467 } |
| 3468 if (context->hadException()) { |
| 3469 v8::ThrowException(context->exception()); |
| 3470 return v8::Undefined(); |
| 3471 } |
| 3472 if (!result) return v8::Null(); |
| 3473 return V8Proxy::ToV8Object(V8ClassIndex::NODE, result.get()); |
3258 } | 3474 } |
3259 | 3475 |
3260 CALLBACK_FUNC_DECL(NodeIteratorPreviousNode) { | 3476 CALLBACK_FUNC_DECL(NodeIteratorPreviousNode) { |
3261 INC_STATS(L"DOM.NodeIterator.previousNode()"); | 3477 INC_STATS(L"DOM.NodeIterator.previousNode()"); |
3262 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); | 3478 NodeIterator* nodeIterator = V8Proxy::FastToNativeObject<NodeIterator>( |
3263 return v8::Undefined(); | 3479 V8ClassIndex::NODEITERATOR, args.Holder()); |
| 3480 |
| 3481 ExceptionCode ec = 0; |
| 3482 OwnPtr<ExceptionContext> context(new ExceptionContext()); |
| 3483 RefPtr<Node> result = nodeIterator->previousNode(context.get(), ec); |
| 3484 if (ec != 0) { |
| 3485 V8Proxy::SetDOMException(ec); |
| 3486 return v8::Null(); |
| 3487 } |
| 3488 if (context->hadException()) { |
| 3489 v8::ThrowException(context->exception()); |
| 3490 return v8::Undefined(); |
| 3491 } |
| 3492 if (!result) return v8::Null(); |
| 3493 return V8Proxy::ToV8Object(V8ClassIndex::NODE, result.get()); |
3264 } | 3494 } |
3265 | 3495 |
3266 CALLBACK_FUNC_DECL(NodeFilterAcceptNode) { | 3496 CALLBACK_FUNC_DECL(NodeFilterAcceptNode) { |
3267 INC_STATS(L"DOM.NodeFilter.acceptNode()"); | 3497 INC_STATS(L"DOM.NodeFilter.acceptNode()"); |
3268 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); | 3498 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); |
3269 return v8::Undefined(); | 3499 return v8::Undefined(); |
3270 } | 3500 } |
3271 | 3501 |
| 3502 // NSResolver |
| 3503 CALLBACK_FUNC_DECL(NSResolverLookupNamespaceURI) { |
| 3504 INC_STATS(L"DOM.NSResolver.lookupNamespaceURI()"); |
| 3505 V8Proxy::SetDOMException(NOT_SUPPORTED_ERR); |
| 3506 return v8::Undefined(); |
| 3507 } |
| 3508 |
3272 ACCESSOR_SETTER(DOMWindowEventHandler) { | 3509 ACCESSOR_SETTER(DOMWindowEventHandler) { |
3273 v8::Handle<v8::Object> holder = V8Proxy::LookupDOMWrapper( | 3510 v8::Handle<v8::Object> holder = V8Proxy::LookupDOMWrapper( |
3274 V8ClassIndex::DOMWINDOW, info.This()); | 3511 V8ClassIndex::DOMWINDOW, info.This()); |
3275 if (holder.IsEmpty()) | 3512 if (holder.IsEmpty()) |
3276 return; | 3513 return; |
3277 | 3514 |
3278 DOMWindow* imp = V8Proxy::FastToNativeObject<DOMWindow>( | 3515 DOMWindow* imp = V8Proxy::FastToNativeObject<DOMWindow>( |
3279 V8ClassIndex::DOMWINDOW, holder); | 3516 V8ClassIndex::DOMWINDOW, holder); |
3280 if (!imp->frame()) | 3517 if (!imp->frame()) |
3281 return; | 3518 return; |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3616 #undef MAKE_CASE | 3853 #undef MAKE_CASE |
3617 | 3854 |
3618 default: | 3855 default: |
3619 return V8ClassIndex::INVALID_CLASS_INDEX; | 3856 return V8ClassIndex::INVALID_CLASS_INDEX; |
3620 } | 3857 } |
3621 } | 3858 } |
3622 | 3859 |
3623 #endif // ENABLE(SVG) | 3860 #endif // ENABLE(SVG) |
3624 | 3861 |
3625 } // namespace WebCore | 3862 } // namespace WebCore |
OLD | NEW |