From de177ba5b1b0ecd4c954d0256e3a9fd7270905af Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Tue, 15 Nov 2011 18:05:23 -0500 Subject: [PATCH] Bug 702627 - Invalidate plugin rect after requesting Java surface during paint r=blassey --- dom/plugins/base/nsPluginInstanceOwner.cpp | 16 ++++++++++++---- dom/plugins/base/nsPluginInstanceOwner.h | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index e0427520697..d5198e4cac4 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -1678,19 +1678,19 @@ void nsPluginInstanceOwner::ScrollPositionDidChange(nscoord aX, nscoord aY) } #ifdef MOZ_WIDGET_ANDROID -void nsPluginInstanceOwner::AddPluginView(const gfxRect& aRect) +bool nsPluginInstanceOwner::AddPluginView(const gfxRect& aRect) { AndroidBridge::AutoLocalJNIFrame frame(1); void* javaSurface = mInstance->GetJavaSurface(); if (!javaSurface) { mInstance->RequestJavaSurface(); - return; + return false; } if (aRect.IsEqualEdges(mLastPluginRect)) { // Already added and in position, no work to do - return; + return true; } JNIEnv* env = GetJNIForThread(); @@ -1716,6 +1716,8 @@ void nsPluginInstanceOwner::AddPluginView(const gfxRect& aRect) mPluginViewAdded = true; } + + return true; } void nsPluginInstanceOwner::RemovePluginView() @@ -2882,7 +2884,13 @@ void nsPluginInstanceOwner::Paint(gfxContext* aContext, mInstance->GetDrawingModel(&model); if (model == kSurface_ANPDrawingModel) { - AddPluginView(aFrameRect); + if (!AddPluginView(aFrameRect)) { + NPRect rect; + rect.left = rect.top = 0; + rect.right = aFrameRect.width; + rect.bottom = aFrameRect.height; + InvalidateRect(&rect); + } return; } diff --git a/dom/plugins/base/nsPluginInstanceOwner.h b/dom/plugins/base/nsPluginInstanceOwner.h index e6c187dba18..a6acb483f74 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.h +++ b/dom/plugins/base/nsPluginInstanceOwner.h @@ -310,7 +310,7 @@ private: void FixUpURLS(const nsString &name, nsAString &value); #ifdef ANDROID - void AddPluginView(const gfxRect& aRect); + bool AddPluginView(const gfxRect& aRect); void RemovePluginView(); bool mPluginViewAdded; gfxRect mLastPluginRect;