Bug 79566 - Fixed a typo in CanvasRenderingContext2D::drawImage(HTMLCanvasElement); incorrect source and destination rect used
Summary: Fixed a typo in CanvasRenderingContext2D::drawImage(HTMLCanvasElement); incor...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-25 01:11 PST by Dongseong Hwang
Modified: 2012-02-27 19:10 PST (History)
6 users (show)

See Also:


Attachments
patch (2.14 KB, patch)
2012-02-25 01:13 PST, Dongseong Hwang
no flags Details | Formatted Diff | Diff
patch v.2 (5.04 KB, patch)
2012-02-27 03:01 PST, Dongseong Hwang
dbates: review+
dbates: commit-queue-
Details | Formatted Diff | Diff
patch v.3 (5.79 KB, patch)
2012-02-27 15:26 PST, Dongseong Hwang
dbates: review+
dbates: commit-queue-
Details | Formatted Diff | Diff
patch v.4 (5.61 KB, patch)
2012-02-27 15:39 PST, Dongseong Hwang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dongseong Hwang 2012-02-25 01:11:52 PST
Fixed a type of Canvas drawImage(canvas).

Exchanged dstRect and bufferSrcRect when calling fullCanvasCompositedDrawImage.
Comment 1 Dongseong Hwang 2012-02-25 01:13:17 PST
Created attachment 128860 [details]
patch
Comment 2 Dongseong Hwang 2012-02-25 01:13:46 PST
It is from bug 71537.
Comment 3 Dongseong Hwang 2012-02-25 01:20:46 PST
This bug appear explicitly following test case.
https://bug-66920-attachments.webkit.org/attachment.cgi?id=105127
Comment 4 Ben Wells 2012-02-26 16:00:52 PST
The test case referenced does look wrong, as does the code. The source-is-image and source-is-canvas cases should look the same.

The fix looks right. (I'm not a reviewer so cannot r+).

This makes me wonder what is special about the test I added originally to test this case. LayoutTests/fast/canvas/canvas-composite-image.html and canvas-composite-canvas.html are the tests for source-is-image and source-is-canvas respectively, and I think both produce the same / correct results.
Comment 5 Dongseong Hwang 2012-02-26 16:13:47 PST
The source-is-image and source-is-canvas cases of source-in, source-out, destination-in and destination-atop in the test case referenced are different.
The source-is-canvas does not have offset, so is rendered on left-top without padding.

I think the layout tests, LayoutTests/fast/canvas/canvas-composite-image.html and canvas-composite-canvas.html, do not reproduce this bug because those may not have offset for image that is rendered into canvas.
Comment 6 Ben Wells 2012-02-26 16:36:18 PST
(In reply to comment #5)
> The source-is-image and source-is-canvas cases of source-in, source-out, destination-in and destination-atop in the test case referenced are different.
> The source-is-canvas does not have offset, so is rendered on left-top without padding.

Yes, agreed. And as mentioned your code looks like the correct fix.

> 
> I think the layout tests, LayoutTests/fast/canvas/canvas-composite-image.html and canvas-composite-canvas.html, do not reproduce this bug because those may not have offset for image that is rendered into canvas.

It would be good to update these tests to cover this case.
Comment 7 Dongseong Hwang 2012-02-26 16:38:13 PST
OK, I will update in this bug. :)
Comment 8 Dongseong Hwang 2012-02-27 03:01:50 PST
Created attachment 129002 [details]
patch v.2
Comment 9 Dongseong Hwang 2012-02-27 03:02:05 PST
I amended canvas-composite-image and canvas-composite-canvas to cover this bug.
Comment 10 Kenneth Russell 2012-02-27 10:40:36 PST
senorblanco, is this something you could review?
Comment 11 Daniel Bates 2012-02-27 10:45:13 PST
Comment on attachment 129002 [details]
patch v.2

View in context: https://bugs.webkit.org/attachment.cgi?id=129002&action=review

This patch looks good to me, but we need a change log entry for the layout test changes.

You may also want to add a remark in the layout test change log entry that this patch only affects the results of  LayoutTests/fast/canvas/canvas-composite-canvas.html and that the changes made to canvas-composite-image.html are a side effect of the change made to LayoutTests/fast/canvas/resources/canvas-composite-image-common.js.

> LayoutTests/ChangeLog:3
> +        Fixed a typo of Canvas drawImage(canvas).

Nit: I updated the title of this bug to elaborate on the typo. For consistency, we should update this line to match the updated bug title. The updated title is a bit verbose. Feel free to come up with an alternative bug title.
Comment 12 Daniel Bates 2012-02-27 10:47:46 PST
Comment on attachment 129002 [details]
patch v.2

Disregard my remark about missing a change log entry for the layout tests. Before landing I suggest updating the bug title in the change log entries and adding the remark about the reason for updating fast/canvas/canvas-composite-image.html (see previous comment).
Comment 13 Dongseong Hwang 2012-02-27 15:26:25 PST
Created attachment 129112 [details]
patch v.3
Comment 14 Dongseong Hwang 2012-02-27 15:27:30 PST
Thanks for good title. :)
Comment 15 Daniel Bates 2012-02-27 15:34:44 PST
Comment on attachment 129112 [details]
patch v.3

View in context: https://bugs.webkit.org/attachment.cgi?id=129112&action=review

> Source/WebCore/ChangeLog:11
> +        I amended canvas-composite-canvas to cover this bug, and I also amended
> +        canvas-composite-image because I changed
> +        LayoutTests/fast/canvas/resources/canvas-composite-image-common.js.
> +        However, the change of canvas-composite-image is reasonable because
> +        drawImage(HTMLImageElement) will be able to have a similar bug.

Did you mean to use the same description in the WebCore change log? I suggest writing something specific to the WebCore change in this change log entry, like:
"Pass dstRect and bufferSrcRect to CanvasRenderingContext2D::fullCanvasCompositedDrawImage() for the destination and source rect, respectively."
Comment 16 Dongseong Hwang 2012-02-27 15:39:43 PST
Created attachment 129114 [details]
patch v.4

I had misunderstanding that changelogs should be consistent.
Comment 17 Daniel Bates 2012-02-27 15:42:16 PST
Comment on attachment 129114 [details]
patch v.4

Thanks Huang for the updated patch.
Comment 18 Dongseong Hwang 2012-02-27 17:48:45 PST
You're welcome. ;)
Comment 19 WebKit Review Bot 2012-02-27 19:09:58 PST
Comment on attachment 129114 [details]
patch v.4

Clearing flags on attachment: 129114

Committed r109062: <http://trac.webkit.org/changeset/109062>
Comment 20 WebKit Review Bot 2012-02-27 19:10:03 PST
All reviewed patches have been landed.  Closing bug.