Hi, currently, when an operation is performed on the canvas, the enclosing rect is repainted. But when a clip is applied to the canvas, we could shrink the rectangle to the clipped area, and decrease the repainted area. We have GraphicsContext::clipBounds which returns us the an enclosing rectangle of the clipped area. So we could use that rectangle, and intersect it with the dirtyRect in CanvasRenderingContext2D::didDraw
Created attachment 200949 [details] patch proposal In order to avoid creating an IntRect, converting it to FloatRect with enclosingIntRect and converting it back to a FloatRect, I implemented intClipBounds and floatClipBounds. I was wondering if it would be better to use templates to define two methods: <IntRect>clipBounds and <FloatRect>clipBounds, but then it would have forced us to write stuffs such as IntRect r = context->clipBounds<IntRect>()
Comment on attachment 200949 [details] patch proposal Attachment 200949 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/338203 New failing tests: fast/repaint/canvas-clip.html
Created attachment 200984 [details] Archive of layout-test-results from webkit-ews-04 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-04 Port: mac-mountainlion Platform: Mac OS X 10.8.2
Comment on attachment 200949 [details] patch proposal Attachment 200949 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/339221 New failing tests: fast/repaint/canvas-clip.html css3/filters/custom/filter-fallback-to-software.html
Created attachment 200993 [details] Archive of layout-test-results from webkit-ews-16 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-16 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.2
Created attachment 200996 [details] updated patch: update test expectation for mac platform
Comment on attachment 200996 [details] updated patch: update test expectation for mac platform r- to clear stale patches from the review queue
<rdar://problem/97222964>