W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2014

Re: [whatwg] [2D Canvas] Do canvases in documents without a browsing context need to be rendered?

From: Justin Novosad <junov@google.com>
Date: Thu, 6 Mar 2014 11:31:12 -0500
Message-ID: <CABpaAqS2QMK-P5RsrGQUDUxPzu9P9CApXqs7u3fKLbgJQ0Oxmw@mail.gmail.com>
To: Rik Cabanier <cabanier@gmail.com>
Cc: WHAT Working Group <whatwg@whatwg.org>
On Wed, Mar 5, 2014 at 11:42 PM, Rik Cabanier <cabanier@gmail.com> wrote:

>
> Testing all browsers (except IE
> since document.implementation.createHTMLDocument() doesn't work) they seem
> to handle canvas contexts with no browsing context except when you use text.
> Chrome crashes, firefox throws an exception and Safari draws the text with
> a very small scale [1]
>

Thanks for checking.  The reason I started this thread is that I just
recently solved the crash in Chrome, and I wasn't satisfied with my
resolution.  I just added an early exit, so Chrome 35 will fail silently on
calls that depend on style resolution when the canvas has no browsing
context.  So now we have three different behaviors. Yay!

I don't think the Safari behavior is the right thing to do because it will
never match the developer's intent.
Basically it boils down to two yes/no questions:
1) exception or no exception?
2) block all canvas APIs just the text APIs?

I think that throwing an exception makes sense in this case because it
would provide meaningful feedback to the developer.  I was reluctant to do
that when I fixed the crash in Chrome because there is always a chance of
breaking working apps/sites when you add exceptions where there weren't
before or where there aren't in other browsers (not to mention the spec).
 But since Firefox is already throwing an exception in this case, I would
feel comfortable doing that in Chrome as well.

For question 2) I really don't have a strong opinion.  On some level, being
more restrictive feels safer and more future proof, but would it be
overkill in this case?

As far as Path2D text methods are concerned, I don't see any problems. the
resolution of CanvasDrawingStyles can be deferred to rasterization time, at
which point we can use the browsing context of the canvas to which the path
is being drawn.
Received on Thursday, 6 March 2014 16:31:40 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:17 UTC