Summary: | Drawing to a dynamically created canvas element before it is appended to document doesnt work | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Andrew Wooldridge <triptych> | ||||
Component: | Layout and Rendering | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | RESOLVED DUPLICATE | ||||||
Severity: | Normal | CC: | dacarson | ||||
Priority: | P2 | Keywords: | NeedsReduction | ||||
Version: | 420+ | ||||||
Hardware: | PC | ||||||
OS: | Windows XP | ||||||
URL: | http://andrewwooldridge.com/canvas/canvastests/dynCanvas.html | ||||||
Attachments: |
|
Description
Andrew Wooldridge
2005-12-29 17:03:42 PST
Created attachment 5360 [details]
simple html document illustrating the problem
If you click the second link in the testcase first, nothing happens, the other way around, it does. Needs a better reduction but i think i can confirm this one. To further explain the sample document. The first click tries to create a canvas element, draw to it then append it to the document. In safari you wont see a black square in the canvas after you click the first link, however in opera and Firefox you do. The problem seems to be that the Canvas render object (RenderCanvasImage) has not been created yet, although there is a valid DOM element. By memory, render objects are not created until they are attached to the DOM tree. I believe this is because the engine does not know how to provide the style information needed to create a render object until it knows it's location within the tree. So, although the getContext function will return with a valid canvas context, no methods on that object will succeed until it is attached to the DOM. I am not sure what can be done about this. The same root cause as http://bugzilla.opendarwin.org/show_bug.cgi?id=4884 |