зеркало из https://github.com/mozilla/pjs.git
Bug 492848 - Visibility notify event API for windowless plugins. r=roc
This commit is contained in:
Родитель
b2c32324b4
Коммит
db917ca89e
|
@ -169,6 +169,7 @@ enum { XKeyPress = KeyPress };
|
|||
#endif
|
||||
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
#define MOZ_POST_VISIBILITY_EVENTS 1
|
||||
#define MOZ_COMPOSITED_PLUGINS 1
|
||||
#endif
|
||||
|
||||
|
@ -382,6 +383,11 @@ public:
|
|||
|
||||
void SetPluginHost(nsIPluginHost* aHost);
|
||||
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
/* the flash plugin(s) need to have thier visiblity poked */
|
||||
PRBool UpdateVisibility(PRBool aForce = PR_FALSE);
|
||||
#endif
|
||||
|
||||
nsEventStatus ProcessEvent(const nsGUIEvent & anEvent);
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
|
@ -952,6 +958,10 @@ nsObjectFrame::FixupWindow(const nsSize& aSize)
|
|||
|
||||
NS_ENSURE_TRUE(window, /**/);
|
||||
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
mInstanceOwner->UpdateVisibility(PR_TRUE);
|
||||
#endif
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
mInstanceOwner->FixUpPluginWindow(ePluginPaintDisable);
|
||||
#endif
|
||||
|
@ -996,6 +1006,10 @@ nsObjectFrame::CallSetWindow()
|
|||
|
||||
nsPluginNativeWindow *window = (nsPluginNativeWindow *)win;
|
||||
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
mInstanceOwner->UpdateVisibility(PR_TRUE);
|
||||
#endif
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
mInstanceOwner->FixUpPluginWindow(ePluginPaintDisable);
|
||||
#endif
|
||||
|
@ -3455,6 +3469,10 @@ nsPluginInstanceOwner::GetEventloopNestingLevel()
|
|||
|
||||
nsresult nsPluginInstanceOwner::ScrollPositionWillChange(nsIScrollableView* aScrollable, nscoord aX, nscoord aY)
|
||||
{
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
CancelTimer();
|
||||
#endif
|
||||
|
||||
#if defined(XP_MACOSX) && !defined(NP_NO_CARBON)
|
||||
if (GetEventModel() != NPEventModelCarbon)
|
||||
return NS_OK;
|
||||
|
@ -4948,6 +4966,11 @@ nsPluginInstanceOwner::Renderer::NativeDraw(QWidget * drawable,
|
|||
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::Notify(nsITimer* timer)
|
||||
{
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
if (mInstance)
|
||||
UpdateVisibility();
|
||||
#endif
|
||||
|
||||
#if defined(XP_MACOSX) && !defined(NP_NO_CARBON)
|
||||
if (GetEventModel() != NPEventModelCarbon)
|
||||
return NS_OK;
|
||||
|
@ -4998,6 +5021,20 @@ void nsPluginInstanceOwner::StartTimer(unsigned int aDelay)
|
|||
mPluginTimer->InitWithCallback(this, aDelay, nsITimer::TYPE_REPEATING_SLACK);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
if (!mTimerCanceled)
|
||||
return;
|
||||
|
||||
// start a periodic timer to provide null events to the plugin instance.
|
||||
if (!mPluginTimer)
|
||||
mPluginTimer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
|
||||
if (mPluginTimer) {
|
||||
mTimerCanceled = PR_FALSE;
|
||||
mPluginTimer->InitWithCallback(this, aDelay, nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void nsPluginInstanceOwner::CancelTimer()
|
||||
|
@ -5202,6 +5239,31 @@ void nsPluginInstanceOwner::SetPluginHost(nsIPluginHost* aHost)
|
|||
mPluginHost = aHost;
|
||||
}
|
||||
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
PRBool nsPluginInstanceOwner::UpdateVisibility(PRBool aForce)
|
||||
{
|
||||
if (!mPluginWindow || !mInstance || !mOwner)
|
||||
return PR_FALSE;
|
||||
|
||||
// first, check our view for CSS visibility style
|
||||
PRBool isVisible =
|
||||
mOwner->GetView()->GetVisibility() == nsViewVisibility_kShow;
|
||||
|
||||
if (aForce || mWidgetVisible != isVisible) {
|
||||
PRBool handled;
|
||||
NPEvent pluginEvent;
|
||||
XVisibilityEvent& visibilityEvent = pluginEvent.xvisibility;
|
||||
visibilityEvent.type = VisibilityNotify;
|
||||
visibilityEvent.display = 0;
|
||||
visibilityEvent.state = isVisible ? VisibilityUnobscured : VisibilityFullyObscured;
|
||||
mInstance->HandleEvent(&pluginEvent, &handled);
|
||||
mWidgetVisible = isVisible;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Mac specific code to fix up the port location and clipping region
|
||||
#ifdef XP_MACOSX
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче