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

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

Issue 24677002: Revert "Revert "Dartium changes for custom element lifecycle events."" (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Created 7 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 | « Source/bindings/dart/DartUtilities.cpp ('k') | Source/bindings/dart/gyp/overrides.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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::createWrapper(Document* document) 43 Dart_Handle DartDocument::createWrapper(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::createWrapper(static_cast<HTMLDocument*>(docume nt)); 49 return DartHTMLDocument::createWrapper(static_cast<HTMLDocument*>(docume nt));
48 if (document->isSVGDocument()) 50 if (document->isSVGDocument())
49 return DartSVGDocument::createWrapper(static_cast<SVGDocument*>(document )); 51 return DartSVGDocument::createWrapper(static_cast<SVGDocument*>(document ));
50 return DartDOMWrapper::createWrapper<DartDocument>(document); 52 return DartDOMWrapper::createWrapper<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 DartTouchList::returnToDart(args, touchList.release()); 61 DartTouchList::returnToDart(args, 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 DartExceptionState es;
79 RefPtr<Element> result;
80 {
81 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope ;
82
83 const AtomicString& typeExtensionString = typeExtension;
84 if (typeExtensionString.isNull()) {
85 result = receiver->createElement(localName, es);
86 } else {
87 result = receiver->createElement(localName, typeExtensionString, es);
88 }
89 }
90
91 DartElement::returnToDart(args, result);
92 if (es.hadException()) {
93 exception = DartDOMWrapper::exceptionCodeToDartException(es);
94 goto fail;
95 }
96 return;
97 }
98
99 fail:
100 Dart_ThrowException(exception);
101 ASSERT_NOT_REACHED();
62 } 102 }
63 103
104 void createElementNSCallback(Dart_NativeArguments args)
105 {
106 Dart_Handle exception = 0;
107 {
108 Document* receiver = DartDOMWrapper::receiver< Document >(args);
109
110 DartStringAdapter namespaceURI = DartUtilities::dartToString(args, 1, ex ception);
111 if (exception)
112 goto fail;
113
114 DartStringAdapter qualifiedName = DartUtilities::dartToString(args, 2, e xception);
115 if (exception)
116 goto fail;
117
118 DartStringAdapter typeExtension = DartUtilities::dartToStringWithNullChe ck(args, 3, exception);
119 if (exception)
120 goto fail;
121
122 DartExceptionState es;
123 RefPtr<Element> result;
124 {
125 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope ;
126
127 const AtomicString& typeExtensionString = typeExtension;
128 if (typeExtensionString.isNull()) {
129 result = receiver->createElementNS(namespaceURI, qualifiedName, es);
130 } else {
131 result = receiver->createElementNS(namespaceURI, qualifiedName, typeExtensionString, es);
132 }
133 }
134
135 DartElement::returnToDart(args, result);
136 if (es.hadException()) {
137 exception = DartDOMWrapper::exceptionCodeToDartException(es);
138 goto fail;
139 }
140 return;
141 }
142
143 fail:
144 Dart_ThrowException(exception);
145 ASSERT_NOT_REACHED();
64 } 146 }
147
148 } // namespace DartDocumentInternal
149
150 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/dart/DartUtilities.cpp ('k') | Source/bindings/dart/gyp/overrides.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698