From 83753ec77f39a31eddf418d9a6d7106a664bf4d9 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Tue, 4 Jan 2011 16:56:05 +1300 Subject: [PATCH] Bug 601064. Ensure we ask each plugin instance to paint at least once. Some plugin instances assume they will be asked to paint even if they're always invisible. r=bsmedberg,a=blocking --- dom/plugins/PluginInstanceChild.cpp | 9 ++++++--- dom/plugins/PluginInstanceChild.h | 5 +++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dom/plugins/PluginInstanceChild.cpp b/dom/plugins/PluginInstanceChild.cpp index 3bd810221a21..1070e1c5eadf 100644 --- a/dom/plugins/PluginInstanceChild.cpp +++ b/dom/plugins/PluginInstanceChild.cpp @@ -143,6 +143,7 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface) , mCurrentAsyncSetWindowTask(nsnull) , mPendingPluginCall(false) , mDoAlphaExtraction(false) + , mHasPainted(false) , mSurfaceDifferenceRect(0,0,0,0) #if (MOZ_PLATFORM_MAEMO == 5) || (MOZ_PLATFORM_MAEMO == 6) , mMaemoImageRendering(PR_FALSE) @@ -2472,7 +2473,8 @@ PluginInstanceChild::UpdateWindowAttributes(bool aForceSetWindow) WINDOWPOS winpos = { 0, 0, mWindow.x, mWindow.y, - mWindow.width, mWindow.height + mWindow.width, mWindow.height, + 0 }; NPEvent pluginEvent = { WM_WINDOWPOSCHANGED, 0, @@ -2718,6 +2720,7 @@ PluginInstanceChild::ShowPluginFrame() } else { PaintRectToSurface(rect, mCurrentSurface, gfxRGBA(0.0, 0.0, 0.0, 0.0)); } + mHasPainted = true; NPRect r = { (uint16_t)rect.y, (uint16_t)rect.x, (uint16_t)rect.YMost(), (uint16_t)rect.XMost() }; @@ -2815,7 +2818,7 @@ PluginInstanceChild::InvalidateRectDelayed(void) } mCurrentInvalidateTask = nsnull; - if (mAccumulatedInvalidRect.IsEmpty() || !IsVisible()) { + if (mAccumulatedInvalidRect.IsEmpty() || (mHasPainted && !IsVisible())) { return; } @@ -2827,7 +2830,7 @@ PluginInstanceChild::InvalidateRectDelayed(void) void PluginInstanceChild::AsyncShowPluginFrame(void) { - if (mCurrentInvalidateTask || !IsVisible()) { + if (mCurrentInvalidateTask || (mHasPainted && !IsVisible())) { return; } diff --git a/dom/plugins/PluginInstanceChild.h b/dom/plugins/PluginInstanceChild.h index 833bf1d87df3..bc3fb5654896 100644 --- a/dom/plugins/PluginInstanceChild.h +++ b/dom/plugins/PluginInstanceChild.h @@ -498,6 +498,11 @@ private: // supports NPPVpluginTransparentAlphaBool (which is not part of NPAPI yet) bool mDoAlphaExtraction; + // true when the plugin has painted at least once. We use this to ensure + // that we ask a plugin to paint at least once even if it's invisible; + // some plugin (instances) rely on this in order to work properly. + bool mHasPainted; + // Cached rectangle rendered to previous surface(mBackSurface) // Used for reading back to current surface and syncing data, // in plugin coordinates.