<?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>73228</bug_id>
          
          <creation_ts>2011-11-28 10:29:33 -0800</creation_ts>
          <short_desc>Synchronization problem in Canvas/WebGLRenderingContext when listener asks for image</short_desc>
          <delta_ts>2011-11-28 17:38:51 -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>New Bugs</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Dana Jansens">danakj</reporter>
          <assigned_to name="Dana Jansens">danakj</assigned_to>
          <cc>backer</cc>
    
    <cc>kbr</cc>
    
    <cc>piman</cc>
    
    <cc>webkit.review.bot</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>509932</commentid>
    <comment_count>0</comment_count>
    <who name="Dana Jansens">danakj</who>
    <bug_when>2011-11-28 10:29:33 -0800</bug_when>
    <thetext>If a listener to HTMLCanvasElement contentChanged asks for the current image, the canvas will stop updating its contents forever.

Two classes:
HTMLCanvasElement      ||       WebGLRenderingContext

----------------------GOOD------------------------------
ask for image here    ----&gt;     paints onto canvas
                                marks NOT DIRTY  (ie nothing new to send to canvas)
saves cache          &lt;----

----------------------GOOD------------------------------
                                new stuff in webgl
clears cache         &lt;----
                                marks DIRTY (stuff to be painted in canvas)

----------------------BAD-------------------------------
                                new stuff in webgl
clears cache         &lt;----
                                notify people
ask for image here    ----&gt;     paints onto canvas
                                marks NOT DIRTY  (ie nothing new to send to canvas)
saves cache          &lt;----
                               marks DIRTY (stuff to be painted in canvas)

Now there is a cached image, so it will never paint onto canvas again. And the canvas is marked dirty so WebGL will never draw onto it again. Each is waiting for the other.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>509941</commentid>
    <comment_count>1</comment_count>
      <attachid>116780</attachid>
    <who name="Dana Jansens">danakj</who>
    <bug_when>2011-11-28 10:40:47 -0800</bug_when>
    <thetext>Created attachment 116780
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>509945</commentid>
    <comment_count>2</comment_count>
    <who name="Dana Jansens">danakj</who>
    <bug_when>2011-11-28 10:44:57 -0800</bug_when>
    <thetext>This patch: Since the cached image is cleared before notifying people about the change, mark the canvas dirty before also. This
a) keeps them in sync.
b) if a listener requests the image, it will cache the requested version correctly.


An alternate version of this patch would be to clear the cache and mark dirty after notifying listeners.  In b) above, this would throw away the cache and cause extra work in the next request for the image.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>510129</commentid>
    <comment_count>3</comment_count>
    <who name="Kenneth Russell">kbr</who>
    <bug_when>2011-11-28 13:41:31 -0800</bug_when>
    <thetext>Have you run the preserveDrawingBuffer related tests in fast/canvas/webgl with these changes, both in DRT and in the browser?

Have you verified that printing of WebGL content works after this change?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>510161</commentid>
    <comment_count>4</comment_count>
    <who name="Dana Jansens">danakj</who>
    <bug_when>2011-11-28 14:13:09 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; Have you run the preserveDrawingBuffer related tests in fast/canvas/webgl with these changes, both in DRT and in the browser?

All of fast/canvas/webgl passes with platform chromium-linux and chromium-gpu.
fast/canvas/webgl/premultiplyalpha-test.html passes in the browser.

&gt; Have you verified that printing of WebGL content works after this change?

Printing WebGL aquarium to a PDF worked.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>510176</commentid>
    <comment_count>5</comment_count>
      <attachid>116780</attachid>
    <who name="Kenneth Russell">kbr</who>
    <bug_when>2011-11-28 14:27:54 -0800</bug_when>
    <thetext>Comment on attachment 116780
Patch

OK. The patch looks fine otherwise. r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>510369</commentid>
    <comment_count>6</comment_count>
      <attachid>116780</attachid>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2011-11-28 17:38:47 -0800</bug_when>
    <thetext>Comment on attachment 116780
Patch

Clearing flags on attachment: 116780

Committed r101311: &lt;http://trac.webkit.org/changeset/101311&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>510370</commentid>
    <comment_count>7</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2011-11-28 17:38:51 -0800</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>116780</attachid>
            <date>2011-11-28 10:40:47 -0800</date>
            <delta_ts>2011-11-28 17:38:47 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-73228-20111128134046.patch</filename>
            <type>text/plain</type>
            <size>1969</size>
            <attacher name="Dana Jansens">danakj</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTAxMjYzCmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggYmUwYjdmNGUxM2M0NmE0
ODlkMTE0MGIzNjkzYjYxZWYyNzMyNzU2Ni4uMzU0YzdjYzA2YjQ1NzZkNTgxMjU1ODMzZjQ4M2Nh
ZGFhNGVjMWRiNCAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCis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MRVJBVEVEX0NPTVBPU0lUSU5HKQogICAgIH0KICNlbmRpZgotICAgIG1fbWFya2VkQ2Fu
dmFzRGlydHkgPSB0cnVlOwogfQogCiBib29sIFdlYkdMUmVuZGVyaW5nQ29udGV4dDo6Y2xlYXJJ
ZkNvbXBvc2l0ZWQoR0MzRGJpdGZpZWxkIG1hc2spCg==
</data>

          </attachment>
      

    </bug>

</bugzilla>