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

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

Issue 26380002: Fixing Node.clone returning non-upgraded Dart custom elements. (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 | « no previous file | no next file » | 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 25 matching lines...) Expand all
36 #include "DartDocument.h" 36 #include "DartDocument.h"
37 #include "DartDocumentFragment.h" 37 #include "DartDocumentFragment.h"
38 #include "DartDocumentType.h" 38 #include "DartDocumentType.h"
39 #include "DartElement.h" 39 #include "DartElement.h"
40 #include "DartEntity.h" 40 #include "DartEntity.h"
41 #include "DartNode.h" 41 #include "DartNode.h"
42 #include "DartNotation.h" 42 #include "DartNotation.h"
43 #include "DartProcessingInstruction.h" 43 #include "DartProcessingInstruction.h"
44 #include "DartText.h" 44 #include "DartText.h"
45 #include "bindings/dart/DartDOMWrapper.h" 45 #include "bindings/dart/DartDOMWrapper.h"
46 #include "core/dom/CustomElementCallbackDispatcher.h"
46 47
47 namespace WebCore { 48 namespace WebCore {
48 49
49 namespace DartNodeInternal { 50 namespace DartNodeInternal {
50 51
51 // This function is customized to take advantage of the optional 4th argument: s houldLazyAttach. 52 // This function is customized to take advantage of the optional 4th argument: s houldLazyAttach.
52 void insertBeforeCallback(Dart_NativeArguments args) 53 void insertBeforeCallback(Dart_NativeArguments args)
53 { 54 {
54 Dart_Handle exception = 0; 55 Dart_Handle exception = 0;
55 { 56 {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 158
158 DartDOMWrapper::returnToDart<DartNode>(args, child); 159 DartDOMWrapper::returnToDart<DartNode>(args, child);
159 return; 160 return;
160 } 161 }
161 162
162 fail: 163 fail:
163 Dart_ThrowException(exception); 164 Dart_ThrowException(exception);
164 ASSERT_NOT_REACHED(); 165 ASSERT_NOT_REACHED();
165 } 166 }
166 167
168 void cloneNodeCallback(Dart_NativeArguments args)
169 {
170 Dart_Handle exception = 0;
171 {
172 Node* receiver = DartDOMWrapper::receiver< Node >(args);
173
174 bool deep = DartUtilities::dartToBool(args, 1, exception);
175 if (exception)
176 goto fail;
177
178 RefPtr<Node> result;
179 {
180 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope ;
181
182 result = receiver->cloneNode(deep);
183 }
184
185 DartNode::returnToDart(args, result);
186 return;
187 }
188
189 fail:
190 Dart_ThrowException(exception);
191 ASSERT_NOT_REACHED();
192 }
193
167 } 194 }
168 195
169 Dart_Handle DartNode::createWrapper(Node* node) 196 Dart_Handle DartNode::createWrapper(Node* node)
170 { 197 {
171 if (!node) 198 if (!node)
172 return Dart_Null(); 199 return Dart_Null();
173 200
174 switch (node->nodeType()) { 201 switch (node->nodeType()) {
175 case Node::ELEMENT_NODE: 202 case Node::ELEMENT_NODE:
176 return DartElement::createWrapper(static_cast<Element*>(node)); 203 return DartElement::createWrapper(static_cast<Element*>(node));
(...skipping 16 matching lines...) Expand all
193 case Node::DOCUMENT_FRAGMENT_NODE: 220 case Node::DOCUMENT_FRAGMENT_NODE:
194 return DartDocumentFragment::createWrapper(static_cast<DocumentFragment* >(node)); 221 return DartDocumentFragment::createWrapper(static_cast<DocumentFragment* >(node));
195 case Node::NOTATION_NODE: 222 case Node::NOTATION_NODE:
196 return DartNotation::createWrapper(static_cast<Notation*>(node)); 223 return DartNotation::createWrapper(static_cast<Notation*>(node));
197 default: break; // XPATH_NAMESPACE_NODE 224 default: break; // XPATH_NAMESPACE_NODE
198 } 225 }
199 return DartDOMWrapper::createWrapper<DartNode>(node); 226 return DartDOMWrapper::createWrapper<DartNode>(node);
200 } 227 }
201 228
202 } 229 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698