[whatwg] CanvasRenderingContext2D::createPattern and partially loaded images

Eric Seidel eric at webkit.org
Fri Aug 8 17:03:13 PDT 2008


http://www.whatwg.org/specs/web-apps/current-work/#createpattern

Notes that:
The first argument gives the image to use as the pattern (either an
HTMLImageElement or an HTMLCanvasElement). Modifying this image after
calling the createPattern() method must not affect the pattern.

What does this mean for images which are not yet fully loaded from the
network?  Safari's current behavior is that the pattern will draw the
image with as much data as we know about that network resource *at the
time the pattern is drawn*.  Instead of at the time the pattern is
created (as the spec seems to imply).  Meaning if you're a web author,
and you don't bother to listen for Image load events, if your user is
on a slow network, each time you draw your pattern, you'll have
slightly more of the image until it completes.

I can disable this feature of Safari (make it so that
"createPattern()" creates a copy of the image, in whatever loaded
state it may be), or we can change the spec to say that incremental
loading images do not count as "modifying the image after calling
createPattern()".

Thoughts?

-eric



More information about the whatwg mailing list