зеркало из https://github.com/mozilla/pjs.git
NPP_SetWindow can pass the wrong window's CGContextRef to a plugin. b=500130 r=josh sr=roc
This commit is contained in:
Родитель
b55bdf1d0c
Коммит
1d91f6e58b
|
@ -810,12 +810,22 @@ void* nsChildView::GetNativeData(PRUint32 aDataType)
|
|||
if ([mView isKindOfClass:[ChildView class]])
|
||||
[(ChildView*)mView setIsPluginView:YES];
|
||||
|
||||
mPluginPort.cgPort.context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
|
||||
|
||||
NSWindow* window = [mView nativeWindow];
|
||||
if (window) {
|
||||
// [NSGraphicsContext currentContext] is supposed to "return the
|
||||
// current graphics context of the current thread." But sometimes
|
||||
// (when called while mView isn't focused for drawing) it returns a
|
||||
// graphics context for the wrong window. [window graphicsContext]
|
||||
// (which "provides the graphics context associated with the window
|
||||
// for the current thread") seems always to return the "right"
|
||||
// graphics context. See bug 500130.
|
||||
mPluginPort.cgPort.context = (CGContextRef)
|
||||
[[window graphicsContext] graphicsPort];
|
||||
WindowRef topLevelWindow = (WindowRef)[window windowRef];
|
||||
mPluginPort.cgPort.window = topLevelWindow;
|
||||
} else {
|
||||
mPluginPort.cgPort.context = nil;
|
||||
mPluginPort.cgPort.window = nil;
|
||||
}
|
||||
|
||||
retVal = (void*)&mPluginPort;
|
||||
|
|
Загрузка…
Ссылка в новой задаче