Index: Source/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp |
diff --git a/Source/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp b/Source/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp |
index ae2010e3aeb3b76635d2e0bd02c4e8d8f775c8dd..b4d169b46ea9f2300edbed6777d4ecb1baeef88f 100644 |
--- a/Source/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp |
+++ b/Source/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp |
@@ -47,6 +47,16 @@ |
namespace WebCore { |
+static bool determineAlpha(v8::Handle<v8::Value> alphaValue) |
Justin Novosad
2014/05/20 19:28:39
We are going to need a more generic version of thi
|
+{ |
+ // WebIDL dictionary spec says that setting a dictionary value to undefined |
+ // should result in the attribute retaining its default value. |
+ if (isUndefinedOrNull(alphaValue)) |
+ return true; |
+ |
+ return alphaValue->BooleanValue(); |
+} |
+ |
void V8HTMLCanvasElement::getContextMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) |
{ |
v8::Handle<v8::Object> holder = info.Holder(); |
@@ -61,7 +71,7 @@ void V8HTMLCanvasElement::getContextMethodCustom(const v8::FunctionCallbackInfo< |
v8::Handle<v8::Object> jsAttributes = info[1]->ToObject(); |
v8::Handle<v8::String> alpha = v8AtomicString(isolate, "alpha"); |
if (jsAttributes->Has(alpha)) |
- webGLAttributes->setAlpha(jsAttributes->Get(alpha)->BooleanValue()); |
+ webGLAttributes->setAlpha(determineAlpha(jsAttributes->Get(alpha))); |
Justin Novosad
2014/05/20 19:28:39
Theroriginal bug was primarily about 2D canvas. If
|
v8::Handle<v8::String> depth = v8AtomicString(isolate, "depth"); |
if (jsAttributes->Has(depth)) |
webGLAttributes->setDepth(jsAttributes->Get(depth)->BooleanValue()); |
@@ -88,7 +98,7 @@ void V8HTMLCanvasElement::getContextMethodCustom(const v8::FunctionCallbackInfo< |
v8::Handle<v8::Object> jsAttributes = info[1]->ToObject(); |
v8::Handle<v8::String> alpha = v8AtomicString(isolate, "alpha"); |
if (jsAttributes->Has(alpha)) |
- canvas2DAttributes->setAlpha(jsAttributes->Get(alpha)->BooleanValue()); |
+ canvas2DAttributes->setAlpha(determineAlpha(jsAttributes->Get(alpha))); |
} |
attributes = canvas2DAttributes; |
} |