Bug 583296 - Fix StartDrawingPlugin to correctly detect nested OS X OOPP paint events. r=josh

This commit is contained in:
Benoit Girard 2010-08-15 13:42:09 -04:00
parent 6b4bdba8e0
commit bc1645aa2b
3 changed files with 8 additions and 4 deletions

View File

@ -72,8 +72,6 @@ NPError mozilla::plugins::PluginUtilsOSX::ShowCocoaContextMenu(void* aMenu, int
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
// Leave out this code until we can fix painting. See bug 568513.
/*
// Create a timer to process browser events while waiting
// on the menu. This prevents the browser from hanging
// during the lifetime of the menu.
@ -86,7 +84,6 @@ NPError mozilla::plugins::PluginUtilsOSX::ShowCocoaContextMenu(void* aMenu, int
// not fire during the right click menu.
[[NSRunLoop currentRunLoop] addTimer:eventTimer
forMode:NSEventTrackingRunLoopMode];
*/
NSMenu* nsmenu = reinterpret_cast<NSMenu*>(aMenu);
NSPoint screen_point = ::NSMakePoint(aX, aY);

View File

@ -431,6 +431,7 @@ protected:
PRPackedBool mDrawing;
PRPackedBool mPluginDrawing;
PRPackedBool mPluginIsCG; // true if this is a CoreGraphics plugin
PRPackedBool mIsDispatchPaint; // Is a paint event being dispatched
NP_CGContext mPluginCGContext;
#ifndef NP_NO_QUICKDRAW

View File

@ -470,6 +470,7 @@ nsChildView::nsChildView() : nsBaseWidget()
, mDrawing(PR_FALSE)
, mPluginDrawing(PR_FALSE)
, mPluginIsCG(PR_FALSE)
, mIsDispatchPaint(PR_FALSE)
, mPluginInstanceOwner(nsnull)
{
#ifdef PR_LOGGING
@ -1250,7 +1251,7 @@ NS_IMETHODIMP nsChildView::StartDrawPlugin()
// without regressing bug 409615. See bug 435041. (StartDrawPlugin() and
// EndDrawPlugin() wrap every call to nsIPluginInstance::HandleEvent() --
// not just calls that "draw" or paint.)
if (!mPluginIsCG || (mView != [NSView focusView])) {
if (!mPluginIsCG || mIsDispatchPaint) {
if (mPluginDrawing)
return NS_ERROR_FAILURE;
}
@ -1695,9 +1696,14 @@ NS_IMETHODIMP nsChildView::DispatchEvent(nsGUIEvent* event, nsEventStatus& aStat
}
}
PRBool restoreIsDispatchPaint = mIsDispatchPaint;
mIsDispatchPaint = mIsDispatchPaint || event->eventStructType == NS_PAINT_EVENT;
if (mEventCallback)
aStatus = (*mEventCallback)(event);
mIsDispatchPaint = restoreIsDispatchPaint;
return NS_OK;
}