<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>6291</bug_id>
          
          <creation_ts>2005-12-29 17:03:42 -0800</creation_ts>
          <short_desc>Drawing to a dynamically created canvas element before it is appended to document doesnt work</short_desc>
          <delta_ts>2006-03-08 18:27:37 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Layout and Rendering</component>
          <version>420+</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>4884</dup_id>
          
          <bug_file_loc>http://andrewwooldridge.com/canvas/canvastests/dynCanvas.html</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>NeedsReduction</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Andrew Wooldridge">triptych</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>dacarson</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>27180</commentid>
    <comment_count>0</comment_count>
    <who name="Andrew Wooldridge">triptych</who>
    <bug_when>2005-12-29 17:03:42 -0800</bug_when>
    <thetext>When a canvas element is created via document.createElement(&apos;canvas&apos;) 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 &quot;work&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27181</commentid>
    <comment_count>1</comment_count>
      <attachid>5360</attachid>
    <who name="Andrew Wooldridge">triptych</who>
    <bug_when>2005-12-29 17:07:06 -0800</bug_when>
    <thetext>Created attachment 5360
simple html document illustrating the problem</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>31784</commentid>
    <comment_count>2</comment_count>
    <who name="Joost de Valk (AlthA)">joost</who>
    <bug_when>2006-02-07 14:32:46 -0800</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>31793</commentid>
    <comment_count>3</comment_count>
    <who name="Andrew Wooldridge">triptych</who>
    <bug_when>2006-02-07 17:17:31 -0800</bug_when>
    <thetext>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.  </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>35572</commentid>
    <comment_count>4</comment_count>
    <who name="David Carson">dacarson</who>
    <bug_when>2006-03-08 16:47:35 -0800</bug_when>
    <thetext>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&apos;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.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>35574</commentid>
    <comment_count>5</comment_count>
    <who name="David Carson">dacarson</who>
    <bug_when>2006-03-08 16:58:10 -0800</bug_when>
    <thetext>The same root cause as http://bugzilla.opendarwin.org/show_bug.cgi?id=4884</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>35579</commentid>
    <comment_count>6</comment_count>
    <who name="David Carson">dacarson</who>
    <bug_when>2006-03-08 18:27:37 -0800</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of 4884 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>5360</attachid>
            <date>2005-12-29 17:07:06 -0800</date>
            <delta_ts>2005-12-29 17:07:06 -0800</delta_ts>
            <desc>simple html document illustrating the problem</desc>
            <filename>dynCanvas.html</filename>
            <type>text/html</type>
            <size>1138</size>
            <attacher name="Andrew Wooldridge">triptych</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMDEgVHJhbnNpdGlvbmFs
Ly9FTiI+DQo8aHRtbD4NCiAgPGhlYWQ+DQogIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlw
ZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PXdpbmRvd3MtMTI1MCI+DQogIDxtZXRhIG5h
bWU9ImdlbmVyYXRvciIgY29udGVudD0iUFNQYWQgZWRpdG9yLCB3d3cucHNwYWQuY29tIj4NCiAg
PHRpdGxlPjwvdGl0bGU+DQogIDxzdHlsZT4NCiAgICBjYW52YXMge2JvcmRlcjogMXB4IHNvbGlk
IGdyZWVuO30NCiAgPC9zdHlsZT4NCiAgPC9oZWFkPg0KICA8Ym9keT4NCiAgPHNjcmlwdD4NCiAg
ZnVuY3Rpb24gY3JlYXRlQ2FudmFzKCl7DQogICAgdmFyIG5ld0NhbnZhcyA9IGRvY3VtZW50LmNy
ZWF0ZUVsZW1lbnQoJ2NhbnZhcycpOw0KICAgIG5ld0NhbnZhcy5zZXRBdHRyaWJ1dGUoJ2hlaWdo
dCcsMjAwKQ0KICAgIG5ld0NhbnZhcy5zZXRBdHRyaWJ1dGUoJ3dpZHRoJywyMDApDQogICAgbmV3
Q2FudmFzLnNldEF0dHJpYnV0ZSgnaWQnLCdjYW52YXMwMDEnKQ0KICAgIGN0eCA9IG5ld0NhbnZh
cy5nZXRDb250ZXh0KCcyZCcpOw0KICAgIGN0eC5maWxsUmVjdCgwLDAsMTAwLDEwMCk7DQogICAg
ZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ2NhbnZhc2NyaWInKS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