RESOLVED WONTFIX 23809
Return CanvasRenderingContext2D instead of DOMObject in IDL to avoid V8 #ifdefs
https://bugs.webkit.org/show_bug.cgi?id=23809
Summary Return CanvasRenderingContext2D instead of DOMObject in IDL to avoid V8 #ifdefs
Darin Fisher (:fishd, Google)
Reported 2009-02-06 16:35:55 PST
Return CanvasRenderingContext2D instead of DOMObject in IDL to avoid V8 #ifdefs The code generator for JSC and V8 is a bit simpler when the return type of a method matches the actual type in the code. I know that getContext and getCSSCanvasContext are both spec'd to return DOMObject, but presently our code generators go through some extra steps to force that to mean CanvasRenderingContext2D. We might as well just change the IDL.
Attachments
v1 patch (2.11 KB, patch)
2009-02-06 16:44 PST, Darin Fisher (:fishd, Google)
eric: review+
Darin Fisher (:fishd, Google)
Comment 1 2009-02-06 16:44:48 PST
Created attachment 27432 [details] v1 patch
Darin Adler
Comment 2 2009-02-06 16:47:57 PST
Comment on attachment 27432 [details] v1 patch Long term, this is wrong. The context could be other classes depending on the passed-in context ID. So we may want to make a different type of change here.
Eric Seidel (no email)
Comment 3 2009-02-06 16:49:53 PST
Comment on attachment 27432 [details] v1 patch Agreed. This would make it impossible to implement Context3D for example (which I figure we'll eventually do to match moz and opera)
Darin Fisher (:fishd, Google)
Comment 4 2009-02-06 19:16:18 PST
Yeah, that's correct, but we don't have any Context3D yet. When we do, we can figure out how to abstract this return value. Why figure that out now? Seems like premature effort to me. My change just moves "hard coded logic" from the code generator into the IDL. That doesn't seem like a step back to me :-)
Darin Fisher (:fishd, Google)
Comment 5 2009-02-06 19:21:54 PST
Would you guys prefer if the getContext return type were changed to CanvasRenderingContext instead of CanvasRenderingContext2D? I could then add a CanvasRenderingContext header that includes the typedef that currently lives in CanvasRenderingContext2D.h. Would that be better? I'm striving for avoiding hacks in the code generator :)
Eric Seidel (no email)
Comment 6 2009-02-07 02:11:32 PST
Comment on attachment 27432 [details] v1 patch I agree, it's overkill. The header with a separate CanvasRenderingContext would be cleanest, but we can solve that when we get a Context3d.
Darin Fisher (:fishd, Google)
Comment 7 2009-02-09 14:34:02 PST
http://trac.webkit.org/changeset/40797 I left the patch as-is. It turns out that toString() currently returns "[object CanvasRenderingContext2D]", so the v1 patch also has the property of making the IDL match the JS better.
Darin Fisher (:fishd, Google)
Comment 8 2009-02-10 00:17:40 PST
Re-opening since Sam didn't like this fix. Reverted as: http://trac.webkit.org/changeset/40810
Darin Fisher (:fishd, Google)
Comment 9 2009-03-02 20:04:18 PST
Closing this out in favor of the solution in bug 24311.
Note You need to log in before you can comment on or make changes to this bug.