Fixing last checkin for bug 120875, hiding plugin for tabs, r=bnesse sr=beard
git-svn-id: svn://10.0.0.236/trunk@121864 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1362,6 +1362,11 @@ NS_IMETHODIMP_(void) pluginInstanceOwner::Notify(nsITimer* /* timer */)
|
||||
EventRecord idleEvent;
|
||||
InitializeEventRecord(&idleEvent);
|
||||
idleEvent.what = nullEvent;
|
||||
|
||||
// give a bogus 'where' field of our null event when hidden, so Flash
|
||||
// won't respond to mouse moves in other tabs, see bug 120875
|
||||
if (!mWidgetVisible)
|
||||
idleEvent.where.h = idleEvent.where.v = 20000;
|
||||
|
||||
nsPluginPort* pluginPort = GetPluginPort();
|
||||
nsPluginEvent pluginEvent = { &idleEvent, nsPluginPlatformWindowRef(pluginPort->port) };
|
||||
@@ -1449,6 +1454,10 @@ static void GetWidgetPosClipAndVis(nsIWidget* aWidget,nscoord& aAbsX, nscoord& a
|
||||
aClipRect.x += aAbsX;
|
||||
aClipRect.y += aAbsY;
|
||||
|
||||
// if we are not visible, clear out the plugin's clip so it won't paint
|
||||
if (!aIsVisible)
|
||||
aClipRect.Empty();
|
||||
|
||||
//printf("--------------\n");
|
||||
//printf("Widget clip X %d Y %d rect %d %d %d %d\n", aAbsX, aAbsY, aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height );
|
||||
//printf("--------------\n");
|
||||
@@ -1464,6 +1473,9 @@ void pluginInstanceOwner::FixUpPluginWindow()
|
||||
PRBool isVisible = PR_TRUE;
|
||||
GetWidgetPosClipAndVis(mWindow,absWidgetX,absWidgetY,widgetClip,isVisible);
|
||||
|
||||
if (mWidgetVisible != isVisible)
|
||||
mWidgetVisible = isVisible;
|
||||
|
||||
// set the port coordinates
|
||||
mPluginWindow.x = absWidgetX;
|
||||
mPluginWindow.y = absWidgetY;
|
||||
@@ -1472,20 +1484,7 @@ void pluginInstanceOwner::FixUpPluginWindow()
|
||||
mPluginWindow.clipRect.top = widgetClip.y;
|
||||
mPluginWindow.clipRect.left = widgetClip.x;
|
||||
mPluginWindow.clipRect.bottom = mPluginWindow.clipRect.top + widgetClip.height;
|
||||
mPluginWindow.clipRect.right = mPluginWindow.clipRect.left + widgetClip.width;
|
||||
|
||||
// now we need to check if we've been hidden or made visible and then update the plugin
|
||||
// with the correct port if visible or null if hidden,
|
||||
// if visiblity has changed, then update the plugin
|
||||
if (isVisible != mWidgetVisible) {
|
||||
mWidgetVisible = isVisible;
|
||||
nsPluginWindow *window;
|
||||
GetWindow(window);
|
||||
if (window && mInstance) {
|
||||
window->window = mWidgetVisible ? GetPluginPort() : nsnull;
|
||||
mInstance->SetWindow(window);
|
||||
}
|
||||
}
|
||||
mPluginWindow.clipRect.right = mPluginWindow.clipRect.left + widgetClip.width;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user