| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "wtf/PassOwnPtr.h" | 43 #include "wtf/PassOwnPtr.h" |
| 44 | 44 |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 namespace { | 47 namespace { |
| 48 | 48 |
| 49 template <typename ElementType, typename PropertyType> | 49 template <typename ElementType, typename PropertyType> |
| 50 void getScriptableObjectProperty(PropertyType property, const v8::PropertyCallba
ckInfo<v8::Value>& info) | 50 void getScriptableObjectProperty(PropertyType property, const v8::PropertyCallba
ckInfo<v8::Value>& info) |
| 51 { | 51 { |
| 52 HTMLPlugInElement* impl = ElementType::toImpl(info.Holder()); | 52 HTMLPlugInElement* impl = ElementType::toImpl(info.Holder()); |
| 53 RefPtr<SharedPersistent<v8::Object> > wrapper = impl->pluginWrapper(); | 53 RefPtr<SharedPersistent<v8::Object>> wrapper = impl->pluginWrapper(); |
| 54 if (!wrapper) | 54 if (!wrapper) |
| 55 return; | 55 return; |
| 56 | 56 |
| 57 v8::Local<v8::Object> instance = wrapper->newLocal(info.GetIsolate()); | 57 v8::Local<v8::Object> instance = wrapper->newLocal(info.GetIsolate()); |
| 58 if (instance.IsEmpty()) | 58 if (instance.IsEmpty()) |
| 59 return; | 59 return; |
| 60 | 60 |
| 61 TONATIVE_VOID(v8::Local<v8::Value>, value, instance->Get(property)); | 61 TONATIVE_VOID(v8::Local<v8::Value>, value, instance->Get(property)); |
| 62 | 62 |
| 63 // We quit here to allow the binding code to look up general HTMLObjectEleme
nt properties | 63 // We quit here to allow the binding code to look up general HTMLObjectEleme
nt properties |
| (...skipping 13 matching lines...) Expand all Loading... |
| 77 void callNpObjectSetter(v8::Local<v8::Object> self, uint32_t index, v8::Local<v8
::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) | 77 void callNpObjectSetter(v8::Local<v8::Object> self, uint32_t index, v8::Local<v8
::Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 78 { | 78 { |
| 79 npObjectSetIndexedProperty(self, index, value, info); | 79 npObjectSetIndexedProperty(self, index, value, info); |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 template <typename ElementType, typename PropertyType> | 83 template <typename ElementType, typename PropertyType> |
| 84 void setScriptableObjectProperty(PropertyType property, v8::Local<v8::Value> val
ue, const v8::PropertyCallbackInfo<v8::Value>& info) | 84 void setScriptableObjectProperty(PropertyType property, v8::Local<v8::Value> val
ue, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 85 { | 85 { |
| 86 HTMLPlugInElement* impl = ElementType::toImpl(info.Holder()); | 86 HTMLPlugInElement* impl = ElementType::toImpl(info.Holder()); |
| 87 RefPtr<SharedPersistent<v8::Object> > wrapper = impl->pluginWrapper(); | 87 RefPtr<SharedPersistent<v8::Object>> wrapper = impl->pluginWrapper(); |
| 88 if (!wrapper) | 88 if (!wrapper) |
| 89 return; | 89 return; |
| 90 | 90 |
| 91 v8::Local<v8::Object> instance = wrapper->newLocal(info.GetIsolate()); | 91 v8::Local<v8::Object> instance = wrapper->newLocal(info.GetIsolate()); |
| 92 if (instance.IsEmpty()) | 92 if (instance.IsEmpty()) |
| 93 return; | 93 return; |
| 94 | 94 |
| 95 // We need to directly call setter on NPObject to be able to detect | 95 // We need to directly call setter on NPObject to be able to detect |
| 96 // situation where NPObject notifies it does not possess the property | 96 // situation where NPObject notifies it does not possess the property |
| 97 // to be able to lookup standard DOM property. | 97 // to be able to lookup standard DOM property. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 { | 185 { |
| 186 setScriptableObjectProperty<V8HTMLObjectElement>(index, value, info); | 186 setScriptableObjectProperty<V8HTMLObjectElement>(index, value, info); |
| 187 } | 187 } |
| 188 | 188 |
| 189 namespace { | 189 namespace { |
| 190 | 190 |
| 191 template <typename ElementType> | 191 template <typename ElementType> |
| 192 void invokeOnScriptableObject(const v8::FunctionCallbackInfo<v8::Value>& info) | 192 void invokeOnScriptableObject(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 193 { | 193 { |
| 194 HTMLPlugInElement* impl = ElementType::toImpl(info.Holder()); | 194 HTMLPlugInElement* impl = ElementType::toImpl(info.Holder()); |
| 195 RefPtr<SharedPersistent<v8::Object> > wrapper = impl->pluginWrapper(); | 195 RefPtr<SharedPersistent<v8::Object>> wrapper = impl->pluginWrapper(); |
| 196 if (!wrapper) | 196 if (!wrapper) |
| 197 return; | 197 return; |
| 198 | 198 |
| 199 v8::Local<v8::Object> instance = wrapper->newLocal(info.GetIsolate()); | 199 v8::Local<v8::Object> instance = wrapper->newLocal(info.GetIsolate()); |
| 200 if (instance.IsEmpty()) | 200 if (instance.IsEmpty()) |
| 201 return; | 201 return; |
| 202 | 202 |
| 203 WTF::OwnPtr<v8::Handle<v8::Value>[] > arguments = adoptArrayPtr(new v8::Hand
le<v8::Value>[info.Length()]); | 203 WTF::OwnPtr<v8::Handle<v8::Value>[] > arguments = adoptArrayPtr(new v8::Hand
le<v8::Value>[info.Length()]); |
| 204 for (int i = 0; i < info.Length(); ++i) | 204 for (int i = 0; i < info.Length(); ++i) |
| 205 arguments[i] = info[i]; | 205 arguments[i] = info[i]; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 216 UseCounter::countIfNotPrivateScript(info.GetIsolate(), V8HTMLEmbedElement::t
oImpl(info.Holder())->document(), UseCounter::HTMLEmbedElementLegacyCall); | 216 UseCounter::countIfNotPrivateScript(info.GetIsolate(), V8HTMLEmbedElement::t
oImpl(info.Holder())->document(), UseCounter::HTMLEmbedElementLegacyCall); |
| 217 } | 217 } |
| 218 | 218 |
| 219 void V8HTMLObjectElement::legacyCallCustom(const v8::FunctionCallbackInfo<v8::Va
lue>& info) | 219 void V8HTMLObjectElement::legacyCallCustom(const v8::FunctionCallbackInfo<v8::Va
lue>& info) |
| 220 { | 220 { |
| 221 invokeOnScriptableObject<V8HTMLObjectElement>(info); | 221 invokeOnScriptableObject<V8HTMLObjectElement>(info); |
| 222 UseCounter::countIfNotPrivateScript(info.GetIsolate(), V8HTMLObjectElement::
toImpl(info.Holder())->document(), UseCounter::HTMLObjectElementLegacyCall); | 222 UseCounter::countIfNotPrivateScript(info.GetIsolate(), V8HTMLObjectElement::
toImpl(info.Holder())->document(), UseCounter::HTMLObjectElementLegacyCall); |
| 223 } | 223 } |
| 224 | 224 |
| 225 } // namespace blink | 225 } // namespace blink |
| OLD | NEW |