Large canvas fills should not crash or create unnecessarily large image buffers
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 17 Sep 2011 01:02:45 +0000 (01:02 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 17 Sep 2011 01:02:45 +0000 (01:02 +0000)
commit34ef8efec2bacfa2e8726c455bb471ccc7e2e1f3
tree2fe31b3ea2c766035355f65705712aede7aeffcf
parentc79ee7ac6f3f21928cfdb0ec3bf0e3527b7951df
Large canvas fills should not crash or create unnecessarily large image buffers
https://bugs.webkit.org/show_bug.cgi?id=67988

Source/WebCore:

When using source-in, destination-in, source-out, or destination-atop a temporary
buffer is created. This buffer only needs to be big enough to cover the intersection
of the path and the canvas. If the area of intersection between the fill and the
canvas is empty the canvas is completely cleared and a temporary buffer is not used.

This change also adds some null checks for failures to create contexts or buffers.

Patch by Ben Wells <benwells@chromium.org> on 2011-09-16
Reviewed by Darin Adler.

Test: fast/canvas/canvas-large-fills.html

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::clearCanvas):
(WebCore::CanvasRenderingContext2D::fillAndDisplayTransparencyElsewhere):

LayoutTests:

Patch by Ben Wells <benwells@chromium.org> on 2011-09-16
Reviewed by Darin Adler.

* fast/canvas/canvas-large-fills-expected.txt: Added.
* fast/canvas/canvas-large-fills.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@95346 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/canvas/canvas-large-fills-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/canvas-large-fills.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp