Skip to content

Commit 8abb7b0

Browse files
Source/WebCore: Unwarranted DOM Exception when when canvas2D drawImage is called with src
rect out of bounds https://bugs.webkit.org/show_bug.cgi?id=65709 Patch by Justin Novosad <[email protected]> on 2011-08-18 Reviewed by Stephen White. Test: fast/canvas/drawImage-clipped-source.html * html/canvas/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::drawImage): Removed the unnecessary dom exceptions for out of bounds source rectangles The overloads that receive video and image elements as source images now use the normalized versions of the source rectangle, which GraphicsContext (and its various platform flavors) can handle correctly. The normalized rectangle is the equivalent rectangle with width and height greater than 0. The canvas version of this method, which had better layout test coverage, was already correctly using the normalized rectangle. The newly added layout test verifies correct behavior with negative source rectangle dimensions. * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::GraphicsContext::drawNativeImage): Fixed algorithm that adjusts the destination rectangle to match the clipping applied to the source rect. The case of scaled filtered images with source rectangles that overlap the edge of the image was not being handled correctly. This use case was previously unsupported and used to trigger a DOM exception. LayoutTests: Unwarranted DOM Exception when when canvas2D drawImage is called with src rect out of bounds https://bugs.webkit.org/show_bug.cgi?id=65709 Patch by Justin Novosad <[email protected]> on 2011-08-18 Reviewed by Stephen White. * fast/canvas/drawImage-clipped-source-expected.txt: Added. * fast/canvas/drawImage-clipped-source.html: Added. New test that verifies the clipping behavior when source rectangles are partially out of the bounds of the source image * fast/canvas/drawImage-clipped-source.js: Added. (patternTest.this.testPixel): (patternTest.this.testRedSquare): (patternTest.this.testPattern): (patternTest.this.testAggregatePattern): (patternTest): (drawTestPattern): (executeTest): * fast/canvas/drawImage-with-invalid-args-expected.txt: * fast/canvas/drawImage-with-invalid-args.html: This test covers (among other things) cases where the source rectangle is _completely_ outside the bounds of the source image. It was modified to no longer expect DOM exceptions * platform/chromium/test_expectations.txt: Out-dated test canvas/philip/tests/2d.drawImage.outsidesource.html is now expected to fail * platform/mac/Skipped: Skipping canvas/philip/tests/2d.drawImage.outsidesource.html git-svn-id: http://svn.webkit.org/repository/webkit/trunk@93354 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 0f22a8d commit 8abb7b0

11 files changed

+1136
-49
lines changed

LayoutTests/ChangeLog

+31
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
2011-08-18 Justin Novosad <[email protected]>
2+
3+
Unwarranted DOM Exception when when canvas2D drawImage is called with src
4+
rect out of bounds
5+
https://bugs.webkit.org/show_bug.cgi?id=65709
6+
7+
Reviewed by Stephen White.
8+
9+
* fast/canvas/drawImage-clipped-source-expected.txt: Added.
10+
* fast/canvas/drawImage-clipped-source.html: Added.
11+
New test that verifies the clipping behavior when source rectangles
12+
are partially out of the bounds of the source image
13+
* fast/canvas/drawImage-clipped-source.js: Added.
14+
(patternTest.this.testPixel):
15+
(patternTest.this.testRedSquare):
16+
(patternTest.this.testPattern):
17+
(patternTest.this.testAggregatePattern):
18+
(patternTest):
19+
(drawTestPattern):
20+
(executeTest):
21+
* fast/canvas/drawImage-with-invalid-args-expected.txt:
22+
* fast/canvas/drawImage-with-invalid-args.html:
23+
This test covers (among other things) cases where the source rectangle is
24+
_completely_ outside the bounds of the source image. It was modified to no
25+
longer expect DOM exceptions
26+
* platform/chromium/test_expectations.txt:
27+
Out-dated test canvas/philip/tests/2d.drawImage.outsidesource.html
28+
is now expected to fail
29+
* platform/mac/Skipped:
30+
Skipping canvas/philip/tests/2d.drawImage.outsidesource.html
31+
132
2011-08-18 Alexey Proskuryakov <[email protected]>
233

334
[Gtk] editing/selection/regional-indicators.html fails

0 commit comments

Comments
 (0)