New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 765270 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Sep 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 766019



Sign in to add a comment

The effect of negative dw and dh in drawImage?

Project Member Reported by zakerinasab@chromium.org, Sep 14 2017

Issue description

The web platform test wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_9.html states that when the destination rectangle in drawImage has negative width and height, an exception should be raised and nothing is drawn (the original test is missing a drawImage param, see the attached test instead).

Chrome, Safari and Opera do not pass the test. They do not raise an error, but they do not draw anything and continue.

Firefox, IE and Edge do not pass the test. They do not raise an error, but they draw the image partially on the canvas.

Apparently, no browser is raising an exception, but they do behave differently.
 
drawimage_html_image_9.html
898 bytes View Download
2x2.png
1.5 KB View Download
Chromium.png
15.0 KB View Download
Firefox.png
14.8 KB View Download
Opera.png
18.3 KB View Download
Safari.png
66.4 KB View Download
Edge.PNG
5.2 KB View Download

Comment 1 by f...@opera.com, Sep 14 2017

ISTR that the throwing behavior may have been in an older iteration of the spec (or possibly not sufficiently defined.) Nothing in the current spec about that though AFAICS.

As for what the result should be with current spec I think this would fall under:

  "The destination rectangle is the rectangle whose corners are the four points (dx, dy), (dx+dw, dy), (dx+dw, dy+dh), (dx, dy+dh)."

So, dx=100, dy=100, dw=-50 and dh=-50 yields:

  (100, 100), (50, 100), (50, 50), (100, 50)

But then

  "When the source rectangle is outside the source image, the source rectangle must be clipped to the source image and the destination rectangle must be clipped in the same proportion."

is applied, which I guess would yield an empty source rectangle - meaning step 4 will abort (and nothing is painted.)
At least that's my reading of it. So Blink and WebKit appears correct AFAICT.

Comment 2 by fs...@chromium.org, Sep 14 2017

I agree with fs on this.

Comment 3 by xlai@chromium.org, Sep 14 2017

Status: Assigned (was: Untriaged)

Comment 4 by f...@opera.com, Sep 14 2017

Hmm, actually correction: The source rectangle will not be empty, so reverse my "correct" above...

The image filename 2x2.png confused me as to the intrinsic size of the image - which is 512x512 and not 2x2... doh!)
Blocking: 766019
This bug is a red herring. The original WPT test was badly written and was not waiting for the image to get loaded, and the problem was cascaded to the offspring test. Everything works fine on all the browsers.

I'll close the bug when the respective WPT test is updated.
Project Member

Comment 7 by bugdroid1@chromium.org, Sep 25 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4d3c601cfc71f45fe2514add64bb87254f3b2b6f

commit 4d3c601cfc71f45fe2514add64bb87254f3b2b6f
Author: Reza.Zakerinasab <zakerinasab@chromium.org>
Date: Mon Sep 25 15:18:18 2017

Refactor wpt/2dcontext/drawing-images-to-the-canvas/ layout tests:

This change refactors wpt/2dcontext/drawing-images-to-the-canvas/ layout tests:

- Merge the similar layout tests where the only difference is the color space of the source image (generic RGB vs sRGB)
- Replace reference tests with proper testharness tests
- Investigate the layout tests that are failing on Chromium

Bug:  766019 ,  765270 ,  765312 ,  763933 
Change-Id: Icd995d7c2752ea42440147cca1d1921ef3c797d9
Reviewed-on: https://chromium-review.googlesource.com/670023
Reviewed-by: Xida Chen <xidachen@chromium.org>
Commit-Queue: Mohammad Reza Zakerinasab <zakerinasab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504057}
[modify] https://crrev.com/4d3c601cfc71f45fe2514add64bb87254f3b2b6f/third_party/WebKit/LayoutTests/TestExpectations
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/2x2-srgb.png
[modify] https://crrev.com/4d3c601cfc71f45fe2514add64bb87254f3b2b6f/third_party/WebKit/LayoutTests/external/wpt/2dcontext/2x2.png
[add] https://crrev.com/4d3c601cfc71f45fe2514add64bb87254f3b2b6f/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_1.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_10.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_10_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_11.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_11_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_12.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_12_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_1_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_2.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_2_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_3.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_3_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_4.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_4_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_5.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_5_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_6.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_6_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_7.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_7_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_8.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_8_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_9.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_canvas_9_ref.html
[add] https://crrev.com/4d3c601cfc71f45fe2514add64bb87254f3b2b6f/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_10.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_10_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_10_srgb.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_11.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_11_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_12.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_12_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_13.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_13_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_14.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_14_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_15.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_15_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1_srgb.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_2.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_2_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_2_srgb.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_3.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_3_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_3_srgb.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_4.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_4_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_4_srgb.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_5.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_5_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_5_srgb.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_6.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_6_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_6_srgb.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_7.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_7_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_7_srgb.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_8.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_8_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_8_srgb.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_9.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_9_ref.html
[modify] https://crrev.com/4d3c601cfc71f45fe2514add64bb87254f3b2b6f/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1_ref.html
[delete] https://crrev.com/35795ad419725909b9b2d44e3da5b8cc9c895f2e/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1_srgb.html

Status: Fixed (was: Assigned)

Sign in to add a comment