зеркало из https://github.com/mozilla/gecko-dev.git
NPP_SetWindow can pass the wrong window's CGContextRef to a plugin. b=500130 r=josh sr=roc
This commit is contained in:
Родитель
a1cd66b0cd
Коммит
b365dd613c
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче