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

Side by Side Diff: Source/bindings/dart/custom/DartDocumentCustom.cpp

Issue 24294002: Dartium changes for custom element lifecycle events. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Created 7 years, 3 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
OLDNEW
1 // Copyright 2011, Google Inc. 1 // Copyright 2011, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 12 matching lines...) Expand all
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
30 #include "config.h" 30 #include "config.h"
31 #include "DartDocument.h" 31 #include "DartDocument.h"
32 32
33 #include "DartElement.h"
33 #include "DartHTMLDocument.h" 34 #include "DartHTMLDocument.h"
34 #include "DartSVGDocument.h" 35 #include "DartSVGDocument.h"
35 #include "DartTouchList.h" 36 #include "DartTouchList.h"
36 #include "bindings/dart/DartDOMWrapper.h" 37 #include "bindings/dart/DartDOMWrapper.h"
38 #include "core/dom/CustomElementCallbackDispatcher.h"
37 #include "core/dom/Document.h" 39 #include "core/dom/Document.h"
38 40
39 namespace WebCore { 41 namespace WebCore {
40 42
41 Dart_Handle DartDocument::toDart(Document* document) 43 Dart_Handle DartDocument::toDart(Document* document)
42 { 44 {
43 if (!document) 45 if (!document)
44 return Dart_Null(); 46 return Dart_Null();
45 47
46 if (document->isHTMLDocument()) 48 if (document->isHTMLDocument())
47 return DartHTMLDocument::toDart(static_cast<HTMLDocument*>(document)); 49 return DartHTMLDocument::toDart(static_cast<HTMLDocument*>(document));
48 if (document->isSVGDocument()) 50 if (document->isSVGDocument())
49 return DartSVGDocument::toDart(static_cast<SVGDocument*>(document)); 51 return DartSVGDocument::toDart(static_cast<SVGDocument*>(document));
50 return DartDOMWrapper::toDart<DartDocument>(document); 52 return DartDOMWrapper::toDart<DartDocument>(document);
51 } 53 }
52 54
53 namespace DartDocumentInternal { 55 namespace DartDocumentInternal {
54 56
55 void createTouchListCallback(Dart_NativeArguments args) 57 void createTouchListCallback(Dart_NativeArguments args)
56 { 58 {
57 RefPtr<TouchList> touchList = TouchList::create(); 59 RefPtr<TouchList> touchList = TouchList::create();
58 ASSERT(Dart_GetNativeArgumentCount(args) == 1); 60 ASSERT(Dart_GetNativeArgumentCount(args) == 1);
59 Dart_SetReturnValue(args, DartTouchList::toDart(touchList.release())); 61 Dart_SetReturnValue(args, DartTouchList::toDart(touchList.release()));
60 } 62 }
61 63
64 void createElementCallback(Dart_NativeArguments args)
65 {
66 Dart_Handle exception = 0;
67 {
68 Document* receiver = DartDOMWrapper::receiver< Document >(args);
69
70 DartStringAdapter localName = DartUtilities::dartToString(args, 1, excep tion);
71 if (exception)
72 goto fail;
73
74 DartStringAdapter typeExtension = DartUtilities::dartToStringWithNullChe ck(args, 2, exception);
75 if (exception)
76 goto fail;
77
78
79
80 DartExceptionState es;
81 RefPtr<Element> result;
82 {
83 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope ;
84
85 const AtomicString& typeExtensionString = typeExtension;
86 if (typeExtensionString.isNull()) {
87 result = receiver->createElement(localName, es);
88 } else {
89 result = receiver->createElement(localName, typeExtensionString, es);
90 }
91
92 }
93
94 Dart_SetReturnValue(args, DartElement::toDart(result));
95 if (es.hadException()) {
96 exception = DartDOMWrapper::exceptionCodeToDartException(es);
97 goto fail;
98 }
99 return;
100 }
101
102 fail:
103 Dart_ThrowException(exception);
104 ASSERT_NOT_REACHED();
105 }
106
107 void createElementNSCallback(Dart_NativeArguments args)
108 {
109 Dart_Handle exception = 0;
110 {
111 Document* receiver = DartDOMWrapper::receiver< Document >(args);
112
113 DartStringAdapter namespaceURI = DartUtilities::dartToString(args, 1, ex ception);
114 if (exception)
115 goto fail;
116
117 DartStringAdapter qualifiedName = DartUtilities::dartToString(args, 2, e xception);
118 if (exception)
119 goto fail;
120
121 DartStringAdapter typeExtension = DartUtilities::dartToStringWithNullChe ck(args, 3, exception);
122 if (exception)
123 goto fail;
124
125
126
127 DartExceptionState es;
128 RefPtr<Element> result;
129 {
130 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope ;
131
132 const AtomicString& typeExtensionString = typeExtension;
133 if (typeExtensionString.isNull()) {
134 result = receiver->createElementNS(namespaceURI, qualifiedName, es);
135 } else {
136 result = receiver->createElementNS(namespaceURI, qualifiedName, typeExtensionString, es);
137 }
138
139 }
140
141 Dart_SetReturnValue(args, DartElement::toDart(result));
142 if (es.hadException()) {
143 exception = DartDOMWrapper::exceptionCodeToDartException(es);
144 goto fail;
145 }
146 return;
147 }
148
149 fail:
150 Dart_ThrowException(exception);
151 ASSERT_NOT_REACHED();
152 }
153
62 } 154 }
63 155
64 } 156 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698