| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 RefPtr<HTMLImageElement> image = HTMLImageElement::createForJSConstructor(*d
ocument, optionalWidth, optionalHeight); | 83 RefPtr<HTMLImageElement> image = HTMLImageElement::createForJSConstructor(*d
ocument, optionalWidth, optionalHeight); |
| 84 v8::Handle<v8::Object> wrapper = args.Holder(); | 84 v8::Handle<v8::Object> wrapper = args.Holder(); |
| 85 V8DOMWrapper::associateObjectWithWrapper<V8HTMLImageElement>(image.release()
, &V8HTMLImageElementConstructor::info, wrapper, args.GetIsolate(), WrapperConfi
guration::Dependent); | 85 V8DOMWrapper::associateObjectWithWrapper<V8HTMLImageElement>(image.release()
, &V8HTMLImageElementConstructor::info, wrapper, args.GetIsolate(), WrapperConfi
guration::Dependent); |
| 86 v8SetReturnValue(args, wrapper); | 86 v8SetReturnValue(args, wrapper); |
| 87 } | 87 } |
| 88 | 88 |
| 89 v8::Handle<v8::FunctionTemplate> V8HTMLImageElementConstructor::GetTemplate(v8::
Isolate* isolate, WrapperWorldType currentWorldType) | 89 v8::Handle<v8::FunctionTemplate> V8HTMLImageElementConstructor::GetTemplate(v8::
Isolate* isolate, WrapperWorldType currentWorldType) |
| 90 { | 90 { |
| 91 // This is only for getting a unique pointer which we can pass to privateTem
plate. | 91 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
| 92 static const char* privateTemplateUniqueKey = "V8HTMLImageElementConstructor
::GetTemplatePrivateTemplate"; | 92 static const int privateTemplateUniqueKey = 0; |
| 93 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 93 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 94 v8::Handle<v8::FunctionTemplate> result = data->privateTemplateIfExists(curr
entWorldType, &privateTemplateUniqueKey); | 94 v8::Handle<v8::FunctionTemplate> result = data->privateTemplateIfExists(curr
entWorldType, &privateTemplateUniqueKey); |
| 95 if (!result.IsEmpty()) | 95 if (!result.IsEmpty()) |
| 96 return result; | 96 return result; |
| 97 | 97 |
| 98 v8::HandleScope scope(isolate); | 98 v8::HandleScope scope(isolate); |
| 99 result = v8::FunctionTemplate::New(v8HTMLImageElementConstructorMethodCustom
); | 99 result = v8::FunctionTemplate::New(v8HTMLImageElementConstructorMethodCustom
); |
| 100 | 100 |
| 101 v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate(); | 101 v8::Local<v8::ObjectTemplate> instance = result->InstanceTemplate(); |
| 102 instance->SetInternalFieldCount(V8HTMLImageElement::internalFieldCount); | 102 instance->SetInternalFieldCount(V8HTMLImageElement::internalFieldCount); |
| 103 result->SetClassName(v8::String::NewSymbol("HTMLImageElement")); | 103 result->SetClassName(v8::String::NewSymbol("HTMLImageElement")); |
| 104 result->Inherit(V8HTMLImageElement::GetTemplate(isolate, currentWorldType)); | 104 result->Inherit(V8HTMLImageElement::GetTemplate(isolate, currentWorldType)); |
| 105 | 105 |
| 106 data->setPrivateTemplate(currentWorldType, &privateTemplateUniqueKey, result
); | 106 data->setPrivateTemplate(currentWorldType, &privateTemplateUniqueKey, result
); |
| 107 return scope.Close(result); | 107 return scope.Close(result); |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace WebCore | 110 } // namespace WebCore |
| OLD | NEW |