| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007-2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2007-2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 3 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 namespace WebCore { | 48 namespace WebCore { |
| 49 | 49 |
| 50 void V8HTMLCanvasElement::getContextMethodCustom(const v8::FunctionCallbackInfo<
v8::Value>& args) | 50 void V8HTMLCanvasElement::getContextMethodCustom(const v8::FunctionCallbackInfo<
v8::Value>& args) |
| 51 { | 51 { |
| 52 v8::Handle<v8::Object> holder = args.Holder(); | 52 v8::Handle<v8::Object> holder = args.Holder(); |
| 53 HTMLCanvasElement* imp = V8HTMLCanvasElement::toNative(holder); | 53 HTMLCanvasElement* imp = V8HTMLCanvasElement::toNative(holder); |
| 54 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, contextIdResource,
args[0]); | 54 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, contextIdResource,
args[0]); |
| 55 String contextId = contextIdResource; | 55 String contextId = contextIdResource; |
| 56 RefPtr<CanvasContextAttributes> attributes; | 56 RefPtr<CanvasContextAttributes> attributes; |
| 57 if (contextId == "webgl" || contextId == "experimental-webgl" || contextId =
= "webkit-3d") { | 57 if (contextId == "webgl2" || contextId == "webgl" || contextId == "experimen
tal-webgl" || contextId == "webkit-3d") { |
| 58 RefPtr<WebGLContextAttributes> webGLAttributes = WebGLContextAttributes:
:create(); | 58 RefPtr<WebGLContextAttributes> webGLAttributes = WebGLContextAttributes:
:create(); |
| 59 if (args.Length() > 1 && args[1]->IsObject()) { | 59 if (args.Length() > 1 && args[1]->IsObject()) { |
| 60 v8::Handle<v8::Object> jsAttributes = args[1]->ToObject(); | 60 v8::Handle<v8::Object> jsAttributes = args[1]->ToObject(); |
| 61 v8::Handle<v8::String> alpha = v8::String::NewSymbol("alpha"); | 61 v8::Handle<v8::String> alpha = v8::String::NewSymbol("alpha"); |
| 62 if (jsAttributes->Has(alpha)) | 62 if (jsAttributes->Has(alpha)) |
| 63 webGLAttributes->setAlpha(jsAttributes->Get(alpha)->BooleanValue
()); | 63 webGLAttributes->setAlpha(jsAttributes->Get(alpha)->BooleanValue
()); |
| 64 v8::Handle<v8::String> depth = v8::String::NewSymbol("depth"); | 64 v8::Handle<v8::String> depth = v8::String::NewSymbol("depth"); |
| 65 if (jsAttributes->Has(depth)) | 65 if (jsAttributes->Has(depth)) |
| 66 webGLAttributes->setDepth(jsAttributes->Get(depth)->BooleanValue
()); | 66 webGLAttributes->setDepth(jsAttributes->Get(depth)->BooleanValue
()); |
| 67 v8::Handle<v8::String> stencil = v8::String::NewSymbol("stencil"); | 67 v8::Handle<v8::String> stencil = v8::String::NewSymbol("stencil"); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 quality = args[1]->NumberValue(); | 138 quality = args[1]->NumberValue(); |
| 139 qualityPtr = &quality; | 139 qualityPtr = &quality; |
| 140 } | 140 } |
| 141 | 141 |
| 142 String result = canvas->toDataURL(type, qualityPtr, es); | 142 String result = canvas->toDataURL(type, qualityPtr, es); |
| 143 es.throwIfNeeded(); | 143 es.throwIfNeeded(); |
| 144 v8SetReturnValueStringOrUndefined(args, result, args.GetIsolate()); | 144 v8SetReturnValueStringOrUndefined(args, result, args.GetIsolate()); |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace WebCore | 147 } // namespace WebCore |
| OLD | NEW |