summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-27 17:42:53 +0000
committerstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-27 17:42:53 +0000
commit831058cb009df4d94467c8b1f8657b7e7655db74 (patch)
tree8ba343194da7106d2132b6f62b5fbf053a8a1aac /chrome
parentd85e3d7c92725b011e1489cb3e052b6014819b83 (diff)
downloadchromium_src-831058cb009df4d94467c8b1f8657b7e7655db74.zip
chromium_src-831058cb009df4d94467c8b1f8657b7e7655db74.tar.gz
chromium_src-831058cb009df4d94467c8b1f8657b7e7655db74.tar.bz2
Fix invalidates from off-screen plugins on the Mac.
BUG=20234 TEST=Flash plugins that start offscreen should look correct when scrolled into view. Review URL: http://codereview.chromium.org/173552 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24621 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/plugin/webplugin_proxy.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index 9a77484..1684785 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -129,7 +129,16 @@ void WebPluginProxy::Invalidate() {
}
void WebPluginProxy::InvalidateRect(const gfx::Rect& rect) {
- damaged_rect_ = damaged_rect_.Union(rect);
+#if defined(OS_MACOSX)
+ // Some plugins will send invalidates larger than their own rect when
+ // offscreen, so constrain invalidates to the plugin rect.
+ gfx::Rect plugin_rect = delegate_->GetRect();
+ plugin_rect.set_origin(gfx::Point(0, 0));
+ const gfx::Rect invalidate_rect(rect.Intersect(plugin_rect));
+#else
+ const gfx::Rect invalidate_rect(rect);
+#endif
+ damaged_rect_ = damaged_rect_.Union(invalidate_rect);
// Ignore NPN_InvalidateRect calls with empty rects. Also don't send an
// invalidate if it's outside the clipping region, since if we did it won't
// lead to a paint and we'll be stuck waiting forever for a DidPaint response.
@@ -139,7 +148,8 @@ void WebPluginProxy::InvalidateRect(const gfx::Rect& rect) {
// This is not true because scrolling (or window resize) could occur and be
// handled by the renderer before it receives the InvalidateRect message,
// changing the clip rect and then not painting.
- if (rect.IsEmpty() || !delegate_->GetClipRect().Intersects(rect))
+ if (invalidate_rect.IsEmpty() ||
+ !delegate_->GetClipRect().Intersects(invalidate_rect))
return;
// Only send a single InvalidateRect message at a time. From DidPaint we