diff options
author | shawnsingh@chromium.org <shawnsingh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-01 19:57:56 +0000 |
---|---|---|
committer | shawnsingh@chromium.org <shawnsingh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-01 19:57:56 +0000 |
commit | 041940632138c5739247757e193738f70b4e7681 (patch) | |
tree | 11911f5e8d80943c6f9d2ce9eb18bdceeb430a8b /webkit/plugins/ppapi/ppb_graphics_2d_impl.cc | |
parent | f43b89f30c817107bc595f45098d908f84bf9baa (diff) | |
download | chromium_src-041940632138c5739247757e193738f70b4e7681.zip chromium_src-041940632138c5739247757e193738f70b4e7681.tar.gz chromium_src-041940632138c5739247757e193738f70b4e7681.tar.bz2 |
ppapi Graphics2d should invalidate all changes without clipping to visible area.
Currently the flush operation assumes that WebKit will request the ppapi plugin
to repaint any newly exposed regions, and so it only invalidates the visible
portion of changes. However, for accelerated compositing, this behavior is not
correct. This patch rearranges the logic to work for both accelerated and
non-accelerated compositing.
BUG=122860
TEST=tested manually, created crbug.com/125763 for making a unit test
Review URL: http://codereview.chromium.org/10223009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134755 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins/ppapi/ppb_graphics_2d_impl.cc')
-rw-r--r-- | webkit/plugins/ppapi/ppb_graphics_2d_impl.cc | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc index 89cba97..3a6a1a8 100644 --- a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc +++ b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc @@ -344,24 +344,29 @@ int32_t PPB_Graphics2D_Impl::Flush(PP_CompletionCallback callback) { break; } - // We need the rect to be in terms of the current clip rect of the plugin - // since that's what will actually be painted. If we issue an invalidate - // for a clipped-out region, WebKit will do nothing and we won't get any - // ViewWillInitiatePaint/ViewFlushedPaint calls, leaving our callback - // stranded. - gfx::Rect visible_changed_rect; - if (bound_instance_ && !op_rect.IsEmpty()) - visible_changed_rect =PP_ToGfxRect(bound_instance_->view_data().clip_rect). + // For correctness with accelerated compositing, we must issue an invalidate + // on the full op_rect even if it is partially or completely off-screen. + // However, if we issue an invalidate for a clipped-out region, WebKit will + // do nothing and we won't get any ViewWillInitiatePaint/ViewFlushedPaint + // calls, leaving our callback stranded. So we still need to check whether + // the repainted area is visible to determine how to deal with the callback. + if (bound_instance_ && !op_rect.IsEmpty()) { + + // Set |nothing_visible| to false if the change overlaps the visible area. + gfx::Rect visible_changed_rect = + PP_ToGfxRect(bound_instance_->view_data().clip_rect). Intersect(op_rect); + if (!visible_changed_rect.IsEmpty()) + nothing_visible = false; - if (bound_instance_ && !visible_changed_rect.IsEmpty()) { + // Notify the plugin of the entire change (op_rect), even if it is + // partially or completely off-screen. if (operation.type == QueuedOperation::SCROLL) { bound_instance_->ScrollRect(operation.scroll_dx, operation.scroll_dy, - visible_changed_rect); + op_rect); } else { - bound_instance_->InvalidateRect(visible_changed_rect); + bound_instance_->InvalidateRect(op_rect); } - nothing_visible = false; } } queued_operations_.clear(); |