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
parent f43b89f3
......@@ -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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment