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

Side by Side Diff: Source/bindings/v8/custom/V8NodeCustom.cpp

Issue 18789002: Implement Custom Elements' attributeChangedCallback. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Sync to tip. Created 7 years, 5 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/v8/V8HiddenPropertyName.h ('k') | Source/core/core.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 /* 1 /*
2 * Copyright (C) 2007-2009 Google Inc. All rights reserved. 2 * Copyright (C) 2007-2009 Google Inc. 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "V8HTMLElement.h" 42 #include "V8HTMLElement.h"
43 #include "V8Node.h" 43 #include "V8Node.h"
44 #include "V8Notation.h" 44 #include "V8Notation.h"
45 #include "V8ProcessingInstruction.h" 45 #include "V8ProcessingInstruction.h"
46 #include "V8SVGElement.h" 46 #include "V8SVGElement.h"
47 #include "V8ShadowRoot.h" 47 #include "V8ShadowRoot.h"
48 #include "V8Text.h" 48 #include "V8Text.h"
49 #include "bindings/v8/V8AbstractEventListener.h" 49 #include "bindings/v8/V8AbstractEventListener.h"
50 #include "bindings/v8/V8Binding.h" 50 #include "bindings/v8/V8Binding.h"
51 #include "bindings/v8/V8EventListener.h" 51 #include "bindings/v8/V8EventListener.h"
52 #include "core/dom/CustomElementCallbackDispatcher.h"
52 #include "core/dom/Document.h" 53 #include "core/dom/Document.h"
53 #include "core/dom/EventListener.h" 54 #include "core/dom/EventListener.h"
54 #include "core/dom/shadow/ShadowRoot.h" 55 #include "core/dom/shadow/ShadowRoot.h"
55 #include "wtf/RefPtr.h" 56 #include "wtf/RefPtr.h"
56 57
57 namespace WebCore { 58 namespace WebCore {
58 59
59 // This function is customized to take advantage of the optional 4th argument: A ttachBehavior 60 // This function is customized to take advantage of the optional 4th argument: A ttachBehavior
60 void V8Node::insertBeforeMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args) 61 void V8Node::insertBeforeMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
61 { 62 {
62 v8::Handle<v8::Object> holder = args.Holder(); 63 v8::Handle<v8::Object> holder = args.Holder();
63 Node* imp = V8Node::toNative(holder); 64 Node* imp = V8Node::toNative(holder);
65
66 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
67
64 ExceptionCode ec = 0; 68 ExceptionCode ec = 0;
65 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ; 69 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ;
66 Node* refChild = V8Node::HasInstance(args[1], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0 ; 70 Node* refChild = V8Node::HasInstance(args[1], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0 ;
67 bool success = imp->insertBefore(newChild, refChild, ec, AttachLazily); 71 bool success = imp->insertBefore(newChild, refChild, ec, AttachLazily);
68 if (ec) { 72 if (ec) {
69 setDOMException(ec, args.GetIsolate()); 73 setDOMException(ec, args.GetIsolate());
70 return; 74 return;
71 } 75 }
72 if (success) { 76 if (success) {
73 v8SetReturnValue(args, args[0]); 77 v8SetReturnValue(args, args[0]);
74 return; 78 return;
75 } 79 }
76 v8SetReturnValueNull(args); 80 v8SetReturnValueNull(args);
77 } 81 }
78 82
79 // This function is customized to take advantage of the optional 4th argument: A ttachBehavior 83 // This function is customized to take advantage of the optional 4th argument: A ttachBehavior
80 void V8Node::replaceChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args) 84 void V8Node::replaceChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
81 { 85 {
82 v8::Handle<v8::Object> holder = args.Holder(); 86 v8::Handle<v8::Object> holder = args.Holder();
83 Node* imp = V8Node::toNative(holder); 87 Node* imp = V8Node::toNative(holder);
88
89 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
90
84 ExceptionCode ec = 0; 91 ExceptionCode ec = 0;
85 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ; 92 Node* newChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ;
86 Node* oldChild = V8Node::HasInstance(args[1], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0 ; 93 Node* oldChild = V8Node::HasInstance(args[1], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0 ;
87 bool success = imp->replaceChild(newChild, oldChild, ec, AttachLazily); 94 bool success = imp->replaceChild(newChild, oldChild, ec, AttachLazily);
88 if (ec) { 95 if (ec) {
89 setDOMException(ec, args.GetIsolate()); 96 setDOMException(ec, args.GetIsolate());
90 return; 97 return;
91 } 98 }
92 if (success) { 99 if (success) {
93 v8SetReturnValue(args, args[1]); 100 v8SetReturnValue(args, args[1]);
94 return; 101 return;
95 } 102 }
96 v8SetReturnValueNull(args); 103 v8SetReturnValueNull(args);
97 } 104 }
98 105
99 void V8Node::removeChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args) 106 void V8Node::removeChildMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
100 { 107 {
101 v8::Handle<v8::Object> holder = args.Holder(); 108 v8::Handle<v8::Object> holder = args.Holder();
102 Node* imp = V8Node::toNative(holder); 109 Node* imp = V8Node::toNative(holder);
110
111 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
112
103 ExceptionCode ec = 0; 113 ExceptionCode ec = 0;
104 Node* oldChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ; 114 Node* oldChild = V8Node::HasInstance(args[0], args.GetIsolate(), worldType(a rgs.GetIsolate())) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0 ;
105 bool success = imp->removeChild(oldChild, ec); 115 bool success = imp->removeChild(oldChild, ec);
106 if (ec) { 116 if (ec) {
107 setDOMException(ec, args.GetIsolate()); 117 setDOMException(ec, args.GetIsolate());
108 return; 118 return;
109 } 119 }
110 if (success) { 120 if (success) {
111 v8SetReturnValue(args, args[0]); 121 v8SetReturnValue(args, args[0]);
112 return; 122 return;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 return wrap(toShadowRoot(impl), creationContext, isolate); 175 return wrap(toShadowRoot(impl), creationContext, isolate);
166 return wrap(static_cast<DocumentFragment*>(impl), creationContext, isola te); 176 return wrap(static_cast<DocumentFragment*>(impl), creationContext, isola te);
167 case Node::NOTATION_NODE: 177 case Node::NOTATION_NODE:
168 return wrap(static_cast<Notation*>(impl), creationContext, isolate); 178 return wrap(static_cast<Notation*>(impl), creationContext, isolate);
169 default: 179 default:
170 break; // ENTITY_REFERENCE_NODE or XPATH_NAMESPACE_NODE 180 break; // ENTITY_REFERENCE_NODE or XPATH_NAMESPACE_NODE
171 } 181 }
172 return V8Node::createWrapper(impl, creationContext, isolate); 182 return V8Node::createWrapper(impl, creationContext, isolate);
173 } 183 }
174 } // namespace WebCore 184 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8HiddenPropertyName.h ('k') | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698