[Webkit-unassigned] [Bug 70117] Expose HTMLCanvasElement supportsContext
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Jun 4 21:56:43 PDT 2013
https://bugs.webkit.org/show_bug.cgi?id=70117
Sam Weinig <sam at webkit.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #203727|review? |review-
Flag| |
--- Comment #56 from Sam Weinig <sam at webkit.org> 2013-06-04 21:55:14 PST ---
(From update of attachment 203727)
View in context: https://bugs.webkit.org/attachment.cgi?id=203727&action=review
> Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp:47
> +static PassRefPtr<CanvasContextAttributes> get3DContextAttributes(ExecState* exec)
> +{
This should return a PassRefPtr<WebGLContextAttributes>, since that is what it always returns.
> Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp:71
> + RefPtr<CanvasContextAttributes> attrs = WebGLContextAttributes::create();
> + WebGLContextAttributes* webGLAttrs = static_cast<WebGLContextAttributes*>(attrs.get());
> + if (exec->argumentCount() > 1 && exec->argument(1).isObject()) {
> + JSObject* jsAttrs = exec->argument(1).getObject();
> + Identifier alpha(exec, "alpha");
> + if (jsAttrs->hasProperty(exec, alpha))
> + webGLAttrs->setAlpha(jsAttrs->get(exec, alpha).toBoolean(exec));
> + Identifier depth(exec, "depth");
> + if (jsAttrs->hasProperty(exec, depth))
> + webGLAttrs->setDepth(jsAttrs->get(exec, depth).toBoolean(exec));
> + Identifier stencil(exec, "stencil");
> + if (jsAttrs->hasProperty(exec, stencil))
> + webGLAttrs->setStencil(jsAttrs->get(exec, stencil).toBoolean(exec));
> + Identifier antialias(exec, "antialias");
> + if (jsAttrs->hasProperty(exec, antialias))
> + webGLAttrs->setAntialias(jsAttrs->get(exec, antialias).toBoolean(exec));
> + Identifier premultipliedAlpha(exec, "premultipliedAlpha");
> + if (jsAttrs->hasProperty(exec, premultipliedAlpha))
> + webGLAttrs->setPremultipliedAlpha(jsAttrs->get(exec, premultipliedAlpha).toBoolean(exec));
> + Identifier preserveDrawingBuffer(exec, "preserveDrawingBuffer");
> + if (jsAttrs->hasProperty(exec, preserveDrawingBuffer))
> + webGLAttrs->setPreserveDrawingBuffer(jsAttrs->get(exec, preserveDrawingBuffer).toBoolean(exec));
> + }
> + return attrs.release();
I still think the JSDictionary version was better. This is not checking for exceptions (the JSDictionary version was).
> Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp:112
> + if (exec->hadException())
> + return jsBoolean(false);
It is idiomatic to return jsUndefined() in the case of an exception.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list