OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 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 28 matching lines...) Expand all Loading... |
39 #include "core/frame/UseCounter.h" | 39 #include "core/frame/UseCounter.h" |
40 | 40 |
41 namespace WebCore { | 41 namespace WebCore { |
42 | 42 |
43 // FIXME: Consider moving getter/setter helpers to V8NPObject and renaming this
file to V8PluginElementFunctions | 43 // FIXME: Consider moving getter/setter helpers to V8NPObject and renaming this
file to V8PluginElementFunctions |
44 // to match JSC bindings naming convention. | 44 // to match JSC bindings naming convention. |
45 | 45 |
46 template <class C> | 46 template <class C> |
47 static void npObjectNamedGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) | 47 static void npObjectNamedGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) |
48 { | 48 { |
49 HTMLPlugInElement* imp = C::toNative(info.Holder()); | 49 HTMLPlugInElement* impl = C::toNative(info.Holder()); |
50 RefPtr<SharedPersistent<v8::Object> > wrapper = imp->pluginWrapper(); | 50 RefPtr<SharedPersistent<v8::Object> > wrapper = impl->pluginWrapper(); |
51 if (!wrapper) | 51 if (!wrapper) |
52 return; | 52 return; |
53 | 53 |
54 v8::Local<v8::Object> instanceTemplate = wrapper->newLocal(info.GetIsolate()
); | 54 v8::Local<v8::Object> instanceTemplate = wrapper->newLocal(info.GetIsolate()
); |
55 if (instanceTemplate.IsEmpty()) | 55 if (instanceTemplate.IsEmpty()) |
56 return; | 56 return; |
57 | 57 |
58 npObjectGetNamedProperty(instanceTemplate, name, info); | 58 npObjectGetNamedProperty(instanceTemplate, name, info); |
59 } | 59 } |
60 | 60 |
61 template <class C> | 61 template <class C> |
62 static void npObjectNamedSetter(v8::Local<v8::String> name, v8::Local<v8::Value>
value, const v8::PropertyCallbackInfo<v8::Value>& info) | 62 static void npObjectNamedSetter(v8::Local<v8::String> name, v8::Local<v8::Value>
value, const v8::PropertyCallbackInfo<v8::Value>& info) |
63 { | 63 { |
64 HTMLPlugInElement* imp = C::toNative(info.Holder()); | 64 HTMLPlugInElement* impl = C::toNative(info.Holder()); |
65 RefPtr<SharedPersistent<v8::Object> > wrapper = imp->pluginWrapper(); | 65 RefPtr<SharedPersistent<v8::Object> > wrapper = impl->pluginWrapper(); |
66 if (!wrapper) | 66 if (!wrapper) |
67 return; | 67 return; |
68 | 68 |
69 v8::Local<v8::Object> instanceTemplate = wrapper->newLocal(info.GetIsolate()
); | 69 v8::Local<v8::Object> instanceTemplate = wrapper->newLocal(info.GetIsolate()
); |
70 if (instanceTemplate.IsEmpty()) | 70 if (instanceTemplate.IsEmpty()) |
71 return; | 71 return; |
72 | 72 |
73 npObjectSetNamedProperty(instanceTemplate, name, value, info); | 73 npObjectSetNamedProperty(instanceTemplate, name, value, info); |
74 } | 74 } |
75 | 75 |
(...skipping 22 matching lines...) Expand all Loading... |
98 npObjectNamedSetter<V8HTMLEmbedElement>(name, value, info); | 98 npObjectNamedSetter<V8HTMLEmbedElement>(name, value, info); |
99 } | 99 } |
100 | 100 |
101 void V8HTMLObjectElement::namedPropertySetterCustom(v8::Local<v8::String> name,
v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) | 101 void V8HTMLObjectElement::namedPropertySetterCustom(v8::Local<v8::String> name,
v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) |
102 { | 102 { |
103 return npObjectNamedSetter<V8HTMLObjectElement>(name, value, info); | 103 return npObjectNamedSetter<V8HTMLObjectElement>(name, value, info); |
104 } | 104 } |
105 | 105 |
106 void V8HTMLAppletElement::legacyCallCustom(const v8::FunctionCallbackInfo<v8::Va
lue>& info) | 106 void V8HTMLAppletElement::legacyCallCustom(const v8::FunctionCallbackInfo<v8::Va
lue>& info) |
107 { | 107 { |
108 HTMLPlugInElement* imp = V8HTMLAppletElement::toNative(info.Holder()); | 108 HTMLPlugInElement* impl = V8HTMLAppletElement::toNative(info.Holder()); |
109 UseCounter::count(imp->document(), UseCounter::HTMLAppletElementLegacyCall); | 109 UseCounter::count(impl->document(), UseCounter::HTMLAppletElementLegacyCall)
; |
110 npObjectInvokeDefaultHandler(info); | 110 npObjectInvokeDefaultHandler(info); |
111 } | 111 } |
112 | 112 |
113 void V8HTMLEmbedElement::legacyCallCustom(const v8::FunctionCallbackInfo<v8::Val
ue>& info) | 113 void V8HTMLEmbedElement::legacyCallCustom(const v8::FunctionCallbackInfo<v8::Val
ue>& info) |
114 { | 114 { |
115 HTMLPlugInElement* imp = V8HTMLEmbedElement::toNative(info.Holder()); | 115 HTMLPlugInElement* impl = V8HTMLEmbedElement::toNative(info.Holder()); |
116 UseCounter::count(imp->document(), UseCounter::HTMLEmbedElementLegacyCall); | 116 UseCounter::count(impl->document(), UseCounter::HTMLEmbedElementLegacyCall); |
117 npObjectInvokeDefaultHandler(info); | 117 npObjectInvokeDefaultHandler(info); |
118 } | 118 } |
119 | 119 |
120 void V8HTMLObjectElement::legacyCallCustom(const v8::FunctionCallbackInfo<v8::Va
lue>& info) | 120 void V8HTMLObjectElement::legacyCallCustom(const v8::FunctionCallbackInfo<v8::Va
lue>& info) |
121 { | 121 { |
122 HTMLPlugInElement* imp = V8HTMLObjectElement::toNative(info.Holder()); | 122 HTMLPlugInElement* impl = V8HTMLObjectElement::toNative(info.Holder()); |
123 UseCounter::count(imp->document(), UseCounter::HTMLObjectElementLegacyCall); | 123 UseCounter::count(impl->document(), UseCounter::HTMLObjectElementLegacyCall)
; |
124 npObjectInvokeDefaultHandler(info); | 124 npObjectInvokeDefaultHandler(info); |
125 } | 125 } |
126 | 126 |
127 template <class C> | 127 template <class C> |
128 void npObjectIndexedGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Va
lue>& info) | 128 void npObjectIndexedGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Va
lue>& info) |
129 { | 129 { |
130 HTMLPlugInElement* imp = C::toNative(info.Holder()); | 130 HTMLPlugInElement* impl = C::toNative(info.Holder()); |
131 RefPtr<SharedPersistent<v8::Object> > wrapper = imp->pluginWrapper(); | 131 RefPtr<SharedPersistent<v8::Object> > wrapper = impl->pluginWrapper(); |
132 if (!wrapper) | 132 if (!wrapper) |
133 return; | 133 return; |
134 | 134 |
135 v8::Local<v8::Object> instanceTemplate = wrapper->newLocal(info.GetIsolate()
); | 135 v8::Local<v8::Object> instanceTemplate = wrapper->newLocal(info.GetIsolate()
); |
136 if (instanceTemplate.IsEmpty()) | 136 if (instanceTemplate.IsEmpty()) |
137 return; | 137 return; |
138 | 138 |
139 npObjectGetIndexedProperty(instanceTemplate, index, info); | 139 npObjectGetIndexedProperty(instanceTemplate, index, info); |
140 } | 140 } |
141 | 141 |
142 template <class C> | 142 template <class C> |
143 void npObjectIndexedSetter(uint32_t index, v8::Local<v8::Value> value, const v8:
:PropertyCallbackInfo<v8::Value>& info) | 143 void npObjectIndexedSetter(uint32_t index, v8::Local<v8::Value> value, const v8:
:PropertyCallbackInfo<v8::Value>& info) |
144 { | 144 { |
145 HTMLPlugInElement* imp = C::toNative(info.Holder()); | 145 HTMLPlugInElement* impl = C::toNative(info.Holder()); |
146 RefPtr<SharedPersistent<v8::Object> > wrapper = imp->pluginWrapper(); | 146 RefPtr<SharedPersistent<v8::Object> > wrapper = impl->pluginWrapper(); |
147 if (!wrapper) | 147 if (!wrapper) |
148 return; | 148 return; |
149 | 149 |
150 v8::Local<v8::Object> instanceTemplate = wrapper->newLocal(info.GetIsolate()
); | 150 v8::Local<v8::Object> instanceTemplate = wrapper->newLocal(info.GetIsolate()
); |
151 if (instanceTemplate.IsEmpty()) | 151 if (instanceTemplate.IsEmpty()) |
152 return; | 152 return; |
153 | 153 |
154 npObjectSetIndexedProperty(instanceTemplate, index, value, info); | 154 npObjectSetIndexedProperty(instanceTemplate, index, value, info); |
155 } | 155 } |
156 | 156 |
(...skipping 21 matching lines...) Expand all Loading... |
178 { | 178 { |
179 npObjectIndexedSetter<V8HTMLEmbedElement>(index, value, info); | 179 npObjectIndexedSetter<V8HTMLEmbedElement>(index, value, info); |
180 } | 180 } |
181 | 181 |
182 void V8HTMLObjectElement::indexedPropertySetterCustom(uint32_t index, v8::Local<
v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) | 182 void V8HTMLObjectElement::indexedPropertySetterCustom(uint32_t index, v8::Local<
v8::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) |
183 { | 183 { |
184 npObjectIndexedSetter<V8HTMLObjectElement>(index, value, info); | 184 npObjectIndexedSetter<V8HTMLObjectElement>(index, value, info); |
185 } | 185 } |
186 | 186 |
187 } // namespace WebCore | 187 } // namespace WebCore |
OLD | NEW |