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

Ian Hickson ian at hixie.ch
Thu Mar 6 10:45:08 PST 2014


On Thu, 6 Mar 2014, Justin Novosad wrote:
> On Thu, Mar 6, 2014 at 1:17 PM, Ian Hickson <ian at hixie.ch> wrote:
> > On Wed, 5 Mar 2014, Rik Cabanier 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]
> >
> > The spec actually defines what happens with fonts when you don't have 
> > a defined computed style:
> >
> > # If the computed values are undefined for a particular case (e.g. because
> > # the font style source object is not an element or is not being
> > # rendered), then the relative keywords must be interpreted relative to
> > # the normal-weight 10px sans-serif default.
> >
> > This is needed for text rendering in Workers, if nothing else.
> 
> Ah! So that clears it up... almost. How do we interpret that for Path 
> objects? Does adding text to a path count as a case where font style is 
> undefined, or do we defer and resolve the font style when the path 
> object is drawn to a canvas?

Depends on the Path object. There's a "font style source object" defined 
for anything that might draw text (if I didn't screw it up), and that's 
what decides what you should be rendering relative to.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list