Changeset 291748 in webkit
- Timestamp:
- Mar 23, 2022 10:05:16 AM (4 months ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/canvas/canvas-overloads-drawImage-expected.txt (modified) (2 diffs)
-
LayoutTests/fast/canvas/canvas-overloads-drawImage.html (modified) (2 diffs)
-
LayoutTests/fast/canvas/drawImage-with-invalid-args-expected.txt (modified) (1 diff)
-
LayoutTests/fast/canvas/drawImage-with-invalid-args.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.zerosource-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r291747 r291748 1 2022-03-23 Kimmo Kinnunen <kkinnunen@apple.com> 2 3 Context2D drawImage(img, x, y, w, h) should not throw IndexSizeError when width == 0 or height == 0 4 https://bugs.webkit.org/show_bug.cgi?id=238195 5 6 Reviewed by Simon Fraser. 7 8 * fast/canvas/canvas-overloads-drawImage-expected.txt: 9 * fast/canvas/canvas-overloads-drawImage.html: 10 * fast/canvas/drawImage-with-invalid-args-expected.txt: 11 * fast/canvas/drawImage-with-invalid-args.html: 12 1 13 2022-03-23 Tyler Wilcock <tyler_w@apple.com> 2 14 -
trunk/LayoutTests/fast/canvas/canvas-overloads-drawImage-expected.txt
r219663 r291748 10 10 PASS ctx.drawImage(imageElement, 0, 0, 0) threw exception TypeError: Type error. 11 11 PASS ctx.drawImage(imageElement, 0, 0, 0, 0) is undefined 12 PASS ctx.drawImage(imageElement, 0, 0, 700, 677) is undefined 12 13 PASS ctx.drawImage(imageElement, 0, 0, 0, 0, 0) threw exception TypeError: Type error. 13 14 PASS ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0) threw exception TypeError: Type error. … … 24 25 PASS ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0) threw exception TypeError: Type error. 25 26 PASS ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0) threw exception TypeError: Type error. 26 PASS ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0) threw exception IndexSizeError: The index is not in the allowed range..27 PASS ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0) threw exception IndexSizeError: The index is not in the allowed range..28 PASS ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) threw exception IndexSizeError: The index is not in the allowed range..27 PASS ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0) is undefined 28 PASS ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0) is undefined 29 PASS ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) is undefined 29 30 PASS successfullyParsed is true 30 31 -
trunk/LayoutTests/fast/canvas/canvas-overloads-drawImage.html
r219663 r291748 20 20 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0)", "TypeError"); 21 21 shouldBe("ctx.drawImage(imageElement, 0, 0, 0, 0)", "undefined"); 22 shouldBe("ctx.drawImage(imageElement, 0, 0, 700, 677)", "undefined"); 22 23 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0, 0, 0)", "TypeError"); 23 24 shouldThrow("ctx.drawImage(imageElement, 0, 0, 0, 0, 0, 0)", "TypeError"); … … 36 37 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0)", "TypeError"); 37 38 shouldThrow("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0)", "TypeError"); 38 should ThrowErrorName("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0)", "IndexSizeError");39 should ThrowErrorName("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "IndexSizeError");40 should ThrowErrorName("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "IndexSizeError");39 shouldBe("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0)", "undefined"); 40 shouldBe("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "undefined"); 41 shouldBe("ctx.drawImage(canvasElement, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", "undefined"); 41 42 </script> 42 43 <script src="../../resources/js-test-post.js"></script> -
trunk/LayoutTests/fast/canvas/drawImage-with-invalid-args-expected.txt
r95899 r291748 9 9 PASS: image argument plus zero size 10 10 PASS: image argument plus 8 numbers, zero size 11 PASS: image argument plus 8 numbers, negative size of source, zero size , got exception as expected12 PASS: image argument plus 8 numbers, negative size of destination, zero size , got exception as expected13 PASS: image argument plus 8 numbers, negative size of source and destination, zero size , got exception as expected11 PASS: image argument plus 8 numbers, negative size of source, zero size 12 PASS: image argument plus 8 numbers, negative size of destination, zero size 13 PASS: image argument plus 8 numbers, negative size of source and destination, zero size 14 14 PASS: null image, got exception as expected 15 15 PASS: null image, got exception as expected -
trunk/LayoutTests/fast/canvas/drawImage-with-invalid-args.html
r120683 r291748 73 73 try{ 74 74 ctx.drawImage(myImage, 20, 20, -20, 0, 0, 0, 20, 20); 75 print("PASS: image argument plus 8 numbers, negative size of source, zero size"); 76 } catch (e) { 75 77 print("FAIL"); 76 } catch (e) {77 print("PASS: image argument plus 8 numbers, negative size of source, zero size, got exception as expected");78 78 } 79 79 try{ 80 80 ctx.drawImage(myImage, 0, 0, 20, 0, 20, 20, -20, -20); 81 print("PASS: image argument plus 8 numbers, negative size of destination, zero size"); 82 } catch (e) { 81 83 print("FAIL"); 82 } catch (e) {83 print("PASS: image argument plus 8 numbers, negative size of destination, zero size, got exception as expected");84 84 } 85 85 try{ 86 86 ctx.drawImage(myImage, 20, 20, -20, 0, 20, 20, -20, -20); 87 print("PASS: image argument plus 8 numbers, negative size of source and destination, zero size"); 88 } catch (e) { 87 89 print("FAIL"); 88 } catch (e) {89 print("PASS: image argument plus 8 numbers, negative size of source and destination, zero size, got exception as expected");90 90 } 91 91 try{ -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.zerosource-expected.txt
r262539 r291748 5 5 6 6 7 FAIL drawImage with zero-sized source rectangle draws nothing without exception The index is not in the allowed range. 7 PASS drawImage with zero-sized source rectangle draws nothing without exception 8 8 -
trunk/Source/WebCore/ChangeLog
r291747 r291748 1 2022-03-23 Kimmo Kinnunen <kkinnunen@apple.com> 2 3 Context2D drawImage(img, x, y, w, h) should not throw IndexSizeError when width == 0 or height == 0 4 https://bugs.webkit.org/show_bug.cgi?id=238195 5 6 Reviewed by Simon Fraser. 7 8 When drawing HTMLImageElement with width == 0 or height==0, do nothing as per spec. 9 10 When drawing HTMLCanvasElement with source rectangle width == 0 or height == 0, 11 do nothing as per spec. 12 13 Previously these would throw IndexSizeError. The CanvasDrawImage methods do not throw these. 14 15 Spec: 16 HTML Living Standard — Last Updated 17 March 2022 17 https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-drawimage 18 19 * html/canvas/CanvasRenderingContext2DBase.cpp: 20 (WebCore::CanvasRenderingContext2DBase::drawImage): 21 1 22 2022-03-23 Tyler Wilcock <tyler_w@apple.com> 2 23 -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp
r290839 r291748 1501 1501 return { }; 1502 1502 1503 if (!srcRect.width() || !srcRect.height()) 1504 return { }; 1505 1503 1506 if (!dstRect.width() || !dstRect.height()) 1504 1507 return { }; … … 1506 1509 FloatRect normalizedSrcRect = normalizeRect(srcRect); 1507 1510 FloatRect normalizedDstRect = normalizeRect(dstRect); 1508 1509 if (!srcRect.width() || !srcRect.height())1510 return Exception { IndexSizeError };1511 1511 1512 1512 // When the source rectangle is outside the source image, the source rectangle must be clipped … … 1583 1583 1584 1584 if (!srcRect.width() || !srcRect.height()) 1585 return Exception { IndexSizeError};1585 return { }; 1586 1586 1587 1587 if (!srcCanvasRect.contains(normalizeRect(srcRect)) || !dstRect.width() || !dstRect.height()) … … 1639 1639 FloatRect videoRect = FloatRect(FloatPoint(), size(video)); 1640 1640 if (!srcRect.width() || !srcRect.height()) 1641 return Exception { IndexSizeError};1641 return { }; 1642 1642 1643 1643 if (!videoRect.contains(normalizeRect(srcRect)) || !dstRect.width() || !dstRect.height())
Note: See TracChangeset
for help on using the changeset viewer.