WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 4884
6291
Drawing to a dynamically created canvas element before it is appended to document doesnt work
https://bugs.webkit.org/show_bug.cgi?id=6291
Summary
Drawing to a dynamically created canvas element before it is appended to docu...
Andrew Wooldridge
Reported
2005-12-29 17:03:42 PST
When a canvas element is created via document.createElement('canvas') and then drawn to via methods such as fillRect, the canvas does not reflect those method calls. However once the canvas has been appended to the document, subsequent calls to drawing methods "work".
Attachments
simple html document illustrating the problem
(1.11 KB, text/html)
2005-12-29 17:07 PST
,
Andrew Wooldridge
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Andrew Wooldridge
Comment 1
2005-12-29 17:07:06 PST
Created
attachment 5360
[details]
simple html document illustrating the problem
Joost de Valk (AlthA)
Comment 2
2006-02-07 14:32:46 PST
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.
Andrew Wooldridge
Comment 3
2006-02-07 17:17:31 PST
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.
David Carson
Comment 4
2006-03-08 16:47:35 PST
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.
David Carson
Comment 5
2006-03-08 16:58:10 PST
The same root cause as
http://bugzilla.opendarwin.org/show_bug.cgi?id=4884
David Carson
Comment 6
2006-03-08 18:27:37 PST
*** This bug has been marked as a duplicate of
4884
***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug