diff --git a/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp b/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp index 33e3a5b7e08..39cd3b1882e 100644 --- a/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp +++ b/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp @@ -171,6 +171,22 @@ WebIDL::ExceptionOr CanvasRenderingContext2D::draw_image_internal(CanvasIm // The source rectangle is the rectangle whose corners are the four points (sx, sy), (sx+sw, sy), (sx+sw, sy+sh), (sx, sy+sh). // The destination rectangle is the rectangle whose corners are the four points (dx, dy), (dx+dw, dy), (dx+dw, dy+dh), (dx, dy+dh). // NOTE: Implemented in drawImage() overloads + if (source_width < 0) { + source_x += source_width; + source_width = abs(source_width); + } + if (source_height < 0) { + source_y += source_height; + source_height = abs(source_height); + } + if (destination_width < 0) { + destination_x += destination_width; + destination_width = abs(destination_width); + } + if (destination_height < 0) { + destination_y += destination_height; + destination_height = abs(destination_height); + } // The source rectangle is the rectangle whose corners are the four points (sx, sy), (sx+sw, sy), (sx+sw, sy+sh), (sx, sy+sh). auto source_rect = Gfx::FloatRect { source_x, source_y, source_width, source_height }; diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedest.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedest.txt new file mode 100644 index 00000000000..0f5cfd130ae --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedest.txt @@ -0,0 +1,6 @@ +Harness status: OK + +Found 1 tests + +1 Pass +Pass Negative destination width/height represents the correct rectangle \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedir.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedir.txt new file mode 100644 index 00000000000..6ebdcf3c714 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedir.txt @@ -0,0 +1,6 @@ +Harness status: OK + +Found 1 tests + +1 Pass +Pass Negative dimensions do not affect the direction of the image \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativesource.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativesource.txt new file mode 100644 index 00000000000..80f7a5abe96 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativesource.txt @@ -0,0 +1,6 @@ +Harness status: OK + +Found 1 tests + +1 Pass +Pass Negative source width/height represents the correct rectangle \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/manual/drawing-images-to-the-canvas/drawimage_canvas.txt b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/manual/drawing-images-to-the-canvas/drawimage_canvas.txt new file mode 100644 index 00000000000..0eaac15be9b --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/html/canvas/element/manual/drawing-images-to-the-canvas/drawimage_canvas.txt @@ -0,0 +1,167 @@ +Harness status: OK + +Found 151 tests + +151 Pass +Pass Test scenario 1: dx = 0, dy = 0 --- Pixel 0,0 should be blue. +Pass Test scenario 1: dx = 0, dy = 0 --- Pixel 0,49 should be blue. +Pass Test scenario 1: dx = 0, dy = 0 --- Pixel 49,0 should be blue. +Pass Test scenario 1: dx = 0, dy = 0 --- Pixel 49,49 should be blue. +Pass Test scenario 1: dx = 0, dy = 0 --- Pixel 5,5 should be black. +Pass Test scenario 1: dx = 0, dy = 0 --- Pixel 5,44 should be black. +Pass Test scenario 1: dx = 0, dy = 0 --- Pixel 44,5 should be black. +Pass Test scenario 1: dx = 0, dy = 0 --- Pixel 44,44 should be black. +Pass Test scenario 1: dx = 0, dy = 0 --- Pixel 50,0 should be red. +Pass Test scenario 1: dx = 0, dy = 0 --- Pixel 0,50 should be red. +Pass Test scenario 1: dx = 0, dy = 0 --- Pixel 50,50 should be red. +Pass Test scenario 1: dx = 0, dy = 0 --- Pixel 99,99 should be red. +Pass Test scenario 1: dx = 0, dy = 0 --- Pixel outside canvas should be transparent black. + +Pass Test scenario 2: dx = 25, dy = 25 --- Pixel 25,25 should be blue. +Pass Test scenario 2: dx = 25, dy = 25 --- Pixel 25,74 should be blue. +Pass Test scenario 2: dx = 25, dy = 25 --- Pixel 74,25 should be blue. +Pass Test scenario 2: dx = 25, dy = 25 --- Pixel 74,74 should be blue. +Pass Test scenario 2: dx = 25, dy = 25 --- Pixel 30,30 should be black. +Pass Test scenario 2: dx = 25, dy = 25 --- Pixel 30,69 should be black. +Pass Test scenario 2: dx = 25, dy = 25 --- Pixel 69,30 should be black. +Pass Test scenario 2: dx = 25, dy = 25 --- Pixel 69,69 should be black. +Pass Test scenario 2: dx = 25, dy = 25 --- Pixel 24,24 should be red. +Pass Test scenario 2: dx = 25, dy = 25 --- Pixel 24,75 should be red. +Pass Test scenario 2: dx = 25, dy = 25 --- Pixel 75,24 should be red. +Pass Test scenario 2: dx = 25, dy = 25 --- Pixel 75,75 should be red. +Pass Test scenario 2: dx = 25, dy = 25 --- Pixel outside canvas should be transparent black. + +Pass Test scenario 3: dx = 50, dy = 50, dw = 50, dh = 50 --- Pixel 50,50 should be blue. +Pass Test scenario 3: dx = 50, dy = 50, dw = 50, dh = 50 --- Pixel 50,99 should be blue. +Pass Test scenario 3: dx = 50, dy = 50, dw = 50, dh = 50 --- Pixel 99,50 should be blue. +Pass Test scenario 3: dx = 50, dy = 50, dw = 50, dh = 50 --- Pixel 99,99 should be blue. +Pass Test scenario 3: dx = 50, dy = 50, dw = 50, dh = 50 --- Pixel 55,55 should be black. +Pass Test scenario 3: dx = 50, dy = 50, dw = 50, dh = 50 --- Pixel 55,94 should be black. +Pass Test scenario 3: dx = 50, dy = 50, dw = 50, dh = 50 --- Pixel 94,55 should be black. +Pass Test scenario 3: dx = 50, dy = 50, dw = 50, dh = 50 --- Pixel 94,94 should be black. +Pass Test scenario 3: dx = 50, dy = 50, dw = 50, dh = 50 --- Pixel 0,0 should be red. +Pass Test scenario 3: dx = 50, dy = 50, dw = 50, dh = 50 --- Pixel 49,49 should be red. +Pass Test scenario 3: dx = 50, dy = 50, dw = 50, dh = 50 --- Pixel 49,99 should be red. +Pass Test scenario 3: dx = 50, dy = 50, dw = 50, dh = 50 --- Pixel 99,49 should be red. +Pass Test scenario 3: dx = 50, dy = 50, dw = 50, dh = 50 --- Pixel outside canvas should be transparent black. + +Pass Test scenario 4: dx = 50, dy = 50, dw = 20, dh = 20 --- Pixel 50,50 should be blue. +Pass Test scenario 4: dx = 50, dy = 50, dw = 20, dh = 20 --- Pixel 50,69 should be blue. +Pass Test scenario 4: dx = 50, dy = 50, dw = 20, dh = 20 --- Pixel 69,50 should be blue. +Pass Test scenario 4: dx = 50, dy = 50, dw = 20, dh = 20 --- Pixel 69,69 should be blue. +Pass Test scenario 4: dx = 50, dy = 50, dw = 20, dh = 20 --- Pixel 52,52 should be black. +Pass Test scenario 4: dx = 50, dy = 50, dw = 20, dh = 20 --- Pixel 52,67 should be black. +Pass Test scenario 4: dx = 50, dy = 50, dw = 20, dh = 20 --- Pixel 67,52 should be black. +Pass Test scenario 4: dx = 50, dy = 50, dw = 20, dh = 20 --- Pixel 67,67 should be black. +Pass Test scenario 4: dx = 50, dy = 50, dw = 20, dh = 20 --- Pixel 49,49 should be red. +Pass Test scenario 4: dx = 50, dy = 50, dw = 20, dh = 20 --- Pixel 49,70 should be red. +Pass Test scenario 4: dx = 50, dy = 50, dw = 20, dh = 20 --- Pixel 70,49 should be red. +Pass Test scenario 4: dx = 50, dy = 50, dw = 20, dh = 20 --- Pixel 70,70 should be red. +Pass Test scenario 4: dx = 50, dy = 50, dw = 20, dh = 20 --- Pixel outside canvas should be transparent black. + +Pass Test scenario 5: dx = 50, dy = 50, dw = 50, dh = 20 --- Pixel 50,50 should be blue. +Pass Test scenario 5: dx = 50, dy = 50, dw = 50, dh = 20 --- Pixel 50,69 should be blue. +Pass Test scenario 5: dx = 50, dy = 50, dw = 50, dh = 20 --- Pixel 99,50 should be blue. +Pass Test scenario 5: dx = 50, dy = 50, dw = 50, dh = 20 --- Pixel 99,69 should be blue. +Pass Test scenario 5: dx = 50, dy = 50, dw = 50, dh = 20 --- Pixel 55,52 should be black. +Pass Test scenario 5: dx = 50, dy = 50, dw = 50, dh = 20 --- Pixel 55,67 should be black. +Pass Test scenario 5: dx = 50, dy = 50, dw = 50, dh = 20 --- Pixel 94,52 should be black. +Pass Test scenario 5: dx = 50, dy = 50, dw = 50, dh = 20 --- Pixel 94,67 should be black. +Pass Test scenario 5: dx = 50, dy = 50, dw = 50, dh = 20 --- Pixel 49,49 should be red. +Pass Test scenario 5: dx = 50, dy = 50, dw = 50, dh = 20 --- Pixel 49,69 should be red. +Pass Test scenario 5: dx = 50, dy = 50, dw = 50, dh = 20 --- Pixel 99,49 should be red. +Pass Test scenario 5: dx = 50, dy = 50, dw = 50, dh = 20 --- Pixel 99,70 should be red. +Pass Test scenario 5: dx = 50, dy = 50, dw = 50, dh = 20 --- Pixel outside canvas should be transparent black. + +Pass Test scenario 6: sx = 0, sy = 0, sw = 25, sh = 25, dx = 0, dy = 0, dw = 25, dh = 25 --- Pixel 0,0 should be blue. +Pass Test scenario 6: sx = 0, sy = 0, sw = 25, sh = 25, dx = 0, dy = 0, dw = 25, dh = 25 --- Pixel 4,4 should be blue. +Pass Test scenario 6: sx = 0, sy = 0, sw = 25, sh = 25, dx = 0, dy = 0, dw = 25, dh = 25 --- Pixel 0,24 should be blue. +Pass Test scenario 6: sx = 0, sy = 0, sw = 25, sh = 25, dx = 0, dy = 0, dw = 25, dh = 25 --- Pixel 24,0 should be blue. +Pass Test scenario 6: sx = 0, sy = 0, sw = 25, sh = 25, dx = 0, dy = 0, dw = 25, dh = 25 --- Pixel 5,5 should be black. +Pass Test scenario 6: sx = 0, sy = 0, sw = 25, sh = 25, dx = 0, dy = 0, dw = 25, dh = 25 --- Pixel 5,24 should be black. +Pass Test scenario 6: sx = 0, sy = 0, sw = 25, sh = 25, dx = 0, dy = 0, dw = 25, dh = 25 --- Pixel 24,5 should be black. +Pass Test scenario 6: sx = 0, sy = 0, sw = 25, sh = 25, dx = 0, dy = 0, dw = 25, dh = 25 --- Pixel 24,24 should be black. +Pass Test scenario 6: sx = 0, sy = 0, sw = 25, sh = 25, dx = 0, dy = 0, dw = 25, dh = 25 --- Pixel 25,25 should be red. +Pass Test scenario 6: sx = 0, sy = 0, sw = 25, sh = 25, dx = 0, dy = 0, dw = 25, dh = 25 --- Pixel 25,99 should be red. +Pass Test scenario 6: sx = 0, sy = 0, sw = 25, sh = 25, dx = 0, dy = 0, dw = 25, dh = 25 --- Pixel 99,25 should be red. +Pass Test scenario 6: sx = 0, sy = 0, sw = 25, sh = 25, dx = 0, dy = 0, dw = 25, dh = 25 --- Pixel 99,99 should be red. +Pass Test scenario 6: sx = 0, sy = 0, sw = 25, sh = 25, dx = 0, dy = 0, dw = 25, dh = 25 --- Pixel outside canvas should be transparent black. + +Pass Test scenario 7: sx = 0, sy = 0, sw = 25, sh = 25, dx = 25, dy = 25, dw = 25, dh = 25 --- Pixel 25,25 should be blue. +Pass Test scenario 7: sx = 0, sy = 0, sw = 25, sh = 25, dx = 25, dy = 25, dw = 25, dh = 25 --- Pixel 25,49 should be blue. +Pass Test scenario 7: sx = 0, sy = 0, sw = 25, sh = 25, dx = 25, dy = 25, dw = 25, dh = 25 --- Pixel 49,25 should be blue. +Pass Test scenario 7: sx = 0, sy = 0, sw = 25, sh = 25, dx = 25, dy = 25, dw = 25, dh = 25 --- Pixel 29,29 should be blue. +Pass Test scenario 7: sx = 0, sy = 0, sw = 25, sh = 25, dx = 25, dy = 25, dw = 25, dh = 25 --- Pixel 30,30 should be black. +Pass Test scenario 7: sx = 0, sy = 0, sw = 25, sh = 25, dx = 25, dy = 25, dw = 25, dh = 25 --- Pixel 30,49 should be black. +Pass Test scenario 7: sx = 0, sy = 0, sw = 25, sh = 25, dx = 25, dy = 25, dw = 25, dh = 25 --- Pixel 49,30 should be black. +Pass Test scenario 7: sx = 0, sy = 0, sw = 25, sh = 25, dx = 25, dy = 25, dw = 25, dh = 25 --- Pixel 49,49 should be black. +Pass Test scenario 7: sx = 0, sy = 0, sw = 25, sh = 25, dx = 25, dy = 25, dw = 25, dh = 25 --- Pixel 24,24 should be red. +Pass Test scenario 7: sx = 0, sy = 0, sw = 25, sh = 25, dx = 25, dy = 25, dw = 25, dh = 25 --- Pixel 24,50 should be red. +Pass Test scenario 7: sx = 0, sy = 0, sw = 25, sh = 25, dx = 25, dy = 25, dw = 25, dh = 25 --- Pixel 50,24 should be red. +Pass Test scenario 7: sx = 0, sy = 0, sw = 25, sh = 25, dx = 25, dy = 25, dw = 25, dh = 25 --- Pixel 50,50 should be red. +Pass Test scenario 7: sx = 0, sy = 0, sw = 25, sh = 25, dx = 25, dy = 25, dw = 25, dh = 25 --- Pixel outside canvas should be transparent black. + +Pass Test scenario 8: sx = 25, sy = 25, sw = 50, sh = 50, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 0,20 should be blue. +Pass Test scenario 8: sx = 25, sy = 25, sw = 50, sh = 50, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 20,0 should be blue. +Pass Test scenario 8: sx = 25, sy = 25, sw = 50, sh = 50, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 20,20 should be blue. +Pass Test scenario 8: sx = 25, sy = 25, sw = 50, sh = 50, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 24,24 should be blue. +Pass Test scenario 8: sx = 25, sy = 25, sw = 50, sh = 50, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 0,0 should be black. +Pass Test scenario 8: sx = 25, sy = 25, sw = 50, sh = 50, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 0,19 should be black. +Pass Test scenario 8: sx = 25, sy = 25, sw = 50, sh = 50, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 19,0 should be black. +Pass Test scenario 8: sx = 25, sy = 25, sw = 50, sh = 50, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 19,19 should be black. +Pass Test scenario 8: sx = 25, sy = 25, sw = 50, sh = 50, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 0,25 should be red. +Pass Test scenario 8: sx = 25, sy = 25, sw = 50, sh = 50, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 25,0 should be red. +Pass Test scenario 8: sx = 25, sy = 25, sw = 50, sh = 50, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 25,25 should be red. +Pass Test scenario 8: sx = 25, sy = 25, sw = 50, sh = 50, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 99,99 should be red. +Pass Test scenario 8: sx = 25, sy = 25, sw = 50, sh = 50, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel outside canvas should be transparent black. + +Pass Test scenario 9: sx = 0, sy = 0, sw = 50, sh = 50, dx = 100, dy = 100, dw = -50, dh = -50 --- Pixel 50,50 should be blue. +Pass Test scenario 9: sx = 0, sy = 0, sw = 50, sh = 50, dx = 100, dy = 100, dw = -50, dh = -50 --- Pixel 50,99 should be blue. +Pass Test scenario 9: sx = 0, sy = 0, sw = 50, sh = 50, dx = 100, dy = 100, dw = -50, dh = -50 --- Pixel 99,50 should be blue. +Pass Test scenario 9: sx = 0, sy = 0, sw = 50, sh = 50, dx = 100, dy = 100, dw = -50, dh = -50 --- Pixel 99,99 should be blue. +Pass Test scenario 9: sx = 0, sy = 0, sw = 50, sh = 50, dx = 100, dy = 100, dw = -50, dh = -50 --- Pixel 55,55 should be black. +Pass Test scenario 9: sx = 0, sy = 0, sw = 50, sh = 50, dx = 100, dy = 100, dw = -50, dh = -50 --- Pixel 55,94 should be black. +Pass Test scenario 9: sx = 0, sy = 0, sw = 50, sh = 50, dx = 100, dy = 100, dw = -50, dh = -50 --- Pixel 94,55 should be black. +Pass Test scenario 9: sx = 0, sy = 0, sw = 50, sh = 50, dx = 100, dy = 100, dw = -50, dh = -50 --- Pixel 94,94 should be black. +Pass Test scenario 9: sx = 0, sy = 0, sw = 50, sh = 50, dx = 100, dy = 100, dw = -50, dh = -50 --- Pixel 0,0 should be red. +Pass Test scenario 9: sx = 0, sy = 0, sw = 50, sh = 50, dx = 100, dy = 100, dw = -50, dh = -50 --- Pixel 49,49 should be red. +Pass Test scenario 9: sx = 0, sy = 0, sw = 50, sh = 50, dx = 100, dy = 100, dw = -50, dh = -50 --- Pixel 0,99 should be red. +Pass Test scenario 9: sx = 0, sy = 0, sw = 50, sh = 50, dx = 100, dy = 100, dw = -50, dh = -50 --- Pixel 99,0 should be red. +Pass Test scenario 9: sx = 0, sy = 0, sw = 50, sh = 50, dx = 100, dy = 100, dw = -50, dh = -50 --- Pixel outside canvas should be transparent black. + +Pass Test scenario 10: sx = 0, sy = 0, sw = 50, sh = 50, dx = 0, dy = 0, dw = 200, dh = 200 --- Pixel 0,0 should be blue. +Pass Test scenario 10: sx = 0, sy = 0, sw = 50, sh = 50, dx = 0, dy = 0, dw = 200, dh = 200 --- Pixel 0,99 should be blue. +Pass Test scenario 10: sx = 0, sy = 0, sw = 50, sh = 50, dx = 0, dy = 0, dw = 200, dh = 200 --- Pixel 99,0 should be blue. +Pass Test scenario 10: sx = 0, sy = 0, sw = 50, sh = 50, dx = 0, dy = 0, dw = 200, dh = 200 --- Pixel 19,19 should be blue. +Pass Test scenario 10: sx = 0, sy = 0, sw = 50, sh = 50, dx = 0, dy = 0, dw = 200, dh = 200 --- Pixel 20,20 should be black. +Pass Test scenario 10: sx = 0, sy = 0, sw = 50, sh = 50, dx = 0, dy = 0, dw = 200, dh = 200 --- Pixel 20,99 should be black. +Pass Test scenario 10: sx = 0, sy = 0, sw = 50, sh = 50, dx = 0, dy = 0, dw = 200, dh = 200 --- Pixel 99,20 should be black. +Pass Test scenario 10: sx = 0, sy = 0, sw = 50, sh = 50, dx = 0, dy = 0, dw = 200, dh = 200 --- Pixel 99,99 should be black. +Pass Test scenario 10: sx = 0, sy = 0, sw = 50, sh = 50, dx = 0, dy = 0, dw = 200, dh = 200 --- Pixel outside canvas should be transparent black. + +Pass Test scenario 11: sx = 0, sy = 0, sw = 100, sh = 100, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 0,0 should be blue. +Pass Test scenario 11: sx = 0, sy = 0, sw = 100, sh = 100, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 1,1 should be blue. +Pass Test scenario 11: sx = 0, sy = 0, sw = 100, sh = 100, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 23,23 should be blue. +Pass Test scenario 11: sx = 0, sy = 0, sw = 100, sh = 100, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 24,24 should be blue. +Pass Test scenario 11: sx = 0, sy = 0, sw = 100, sh = 100, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 3,3 should be black. +Pass Test scenario 11: sx = 0, sy = 0, sw = 100, sh = 100, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 3,21 should be black. +Pass Test scenario 11: sx = 0, sy = 0, sw = 100, sh = 100, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 21,3 should be black. +Pass Test scenario 11: sx = 0, sy = 0, sw = 100, sh = 100, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 21,21 should be black. +Pass Test scenario 11: sx = 0, sy = 0, sw = 100, sh = 100, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 0,25 should be red. +Pass Test scenario 11: sx = 0, sy = 0, sw = 100, sh = 100, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 25,0 should be red. +Pass Test scenario 11: sx = 0, sy = 0, sw = 100, sh = 100, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 25,25 should be red. +Pass Test scenario 11: sx = 0, sy = 0, sw = 100, sh = 100, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel 99,99 should be red. +Pass Test scenario 11: sx = 0, sy = 0, sw = 100, sh = 100, dx = 0, dy = 0, dw = 50, dh = 50 --- Pixel outside canvas should be transparent black. + +Pass Test scenario 12: sx = -20, sy = -20, sw = 50, sh = 50, dx = 20, dy = 20, dw = 125, dh = 125 --- Pixel 70,70 should be blue. +Pass Test scenario 12: sx = -20, sy = -20, sw = 50, sh = 50, dx = 20, dy = 20, dw = 125, dh = 125 --- Pixel 70,99 should be blue. +Pass Test scenario 12: sx = -20, sy = -20, sw = 50, sh = 50, dx = 20, dy = 20, dw = 125, dh = 125 --- Pixel 99,70 should be blue. +Pass Test scenario 12: sx = -20, sy = -20, sw = 50, sh = 50, dx = 20, dy = 20, dw = 125, dh = 125 --- Pixel 82,82 should be blue. +Pass Test scenario 12: sx = -20, sy = -20, sw = 50, sh = 50, dx = 20, dy = 20, dw = 125, dh = 125 --- Pixel 84,84 should be black. +Pass Test scenario 12: sx = -20, sy = -20, sw = 50, sh = 50, dx = 20, dy = 20, dw = 125, dh = 125 --- Pixel 84,99 should be black. +Pass Test scenario 12: sx = -20, sy = -20, sw = 50, sh = 50, dx = 20, dy = 20, dw = 125, dh = 125 --- Pixel 99,84 should be black. +Pass Test scenario 12: sx = -20, sy = -20, sw = 50, sh = 50, dx = 20, dy = 20, dw = 125, dh = 125 --- Pixel 99,99 should be black. +Pass Test scenario 12: sx = -20, sy = -20, sw = 50, sh = 50, dx = 20, dy = 20, dw = 125, dh = 125 --- Pixel 0,69 should be red. +Pass Test scenario 12: sx = -20, sy = -20, sw = 50, sh = 50, dx = 20, dy = 20, dw = 125, dh = 125 --- Pixel 69,0 should be red. +Pass Test scenario 12: sx = -20, sy = -20, sw = 50, sh = 50, dx = 20, dy = 20, dw = 125, dh = 125 --- Pixel 69,69 should be red. +Pass Test scenario 12: sx = -20, sy = -20, sw = 50, sh = 50, dx = 20, dy = 20, dw = 125, dh = 125 --- Pixel outside canvas should be transparent black. diff --git a/Tests/LibWeb/Text/input/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedest.html b/Tests/LibWeb/Text/input/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedest.html new file mode 100644 index 00000000000..401959a99ee --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedest.html @@ -0,0 +1,45 @@ + + + +Canvas test: 2d.drawImage.negativedest + + + + + + +

2d.drawImage.negativedest

+

Negative destination width/height represents the correct rectangle

+ + +

Actual output:

+

FAIL (fallback content)

+

Expected output:

+

+ + diff --git a/Tests/LibWeb/Text/input/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedir.html b/Tests/LibWeb/Text/input/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedir.html new file mode 100644 index 00000000000..fdd20402f5b --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedir.html @@ -0,0 +1,45 @@ + + + +Canvas test: 2d.drawImage.negativedir + + + + + + +

2d.drawImage.negativedir

+

Negative dimensions do not affect the direction of the image

+ + +

Actual output:

+

FAIL (fallback content)

+

Expected output:

+

+ + diff --git a/Tests/LibWeb/Text/input/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativesource.html b/Tests/LibWeb/Text/input/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativesource.html new file mode 100644 index 00000000000..1ec7d7c699a --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativesource.html @@ -0,0 +1,45 @@ + + + +Canvas test: 2d.drawImage.negativesource + + + + + + +

2d.drawImage.negativesource

+

Negative source width/height represents the correct rectangle

+ + +

Actual output:

+

FAIL (fallback content)

+

Expected output:

+

+ + diff --git a/Tests/LibWeb/Text/input/wpt-import/html/canvas/element/manual/drawing-images-to-the-canvas/drawimage_canvas.html b/Tests/LibWeb/Text/input/wpt-import/html/canvas/element/manual/drawing-images-to-the-canvas/drawimage_canvas.html new file mode 100644 index 00000000000..2fe6b8e296f --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/html/canvas/element/manual/drawing-images-to-the-canvas/drawimage_canvas.html @@ -0,0 +1,203 @@ + + + + + \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/images/ggrr-256x256.png b/Tests/LibWeb/Text/input/wpt-import/images/ggrr-256x256.png new file mode 100644 index 00000000000..0342e4a3842 Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/images/ggrr-256x256.png differ