diff --git a/widget/cocoa/nsChildView.h b/widget/cocoa/nsChildView.h index 009fa73a1ee..fcb4cb86ef8 100644 --- a/widget/cocoa/nsChildView.h +++ b/widget/cocoa/nsChildView.h @@ -322,8 +322,8 @@ typedef NSInteger NSEventGestureAxis; enter:(BOOL)aEnter type:(mozilla::WidgetMouseEvent::exitType)aType; -- (void)update; -- (void) _surfaceNeedsUpdate:(NSNotification*)notification; +- (void)updateGLContext; +- (void)_surfaceNeedsUpdate:(NSNotification*)notification; - (BOOL)isPluginView; diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 60366e3eccf..ed1bfde0379 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -1959,18 +1959,6 @@ nsChildView::CreateCompositor() { nsBaseWidget::CreateCompositor(); if (mCompositorChild) { - LayerManagerComposite *manager = - compositor::GetLayerManager(mCompositorParent); - Compositor *compositor = manager->GetCompositor(); - - ClientLayerManager *clientManager = static_cast(GetLayerManager()); - if (clientManager->GetCompositorBackendType() == LAYERS_OPENGL) { - CompositorOGL *compositorOGL = static_cast(compositor); - - NSOpenGLContext *glContext = (NSOpenGLContext *)compositorOGL->gl()->GetNativeData(GLContext::NativeGLContext); - - [(ChildView *)mView setGLContext:glContext]; - } [(ChildView *)mView setUsingOMTCompositor:true]; } } @@ -2863,7 +2851,7 @@ NSEvent* gLastDragMouseDownEvent = nil; NS_OBJC_BEGIN_TRY_ABORT_BLOCK; [mGLContext clearDrawable]; - [mGLContext setView:self]; + [self updateGLContext]; NS_OBJC_END_TRY_ABORT_BLOCK; } @@ -2882,18 +2870,17 @@ NSEvent* gLastDragMouseDownEvent = nil; { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; - if (!mGLContext) { - [self setGLContext:aGLContext]; - } - if ([[self window] isKindOfClass:[BaseWindow class]] && ![(BaseWindow*)[self window] isVisibleOrBeingShown]) { // Before the window is shown, our GL context's front FBO is not // framebuffer complete, so we refuse to render. return false; } - [aGLContext setView:self]; - [aGLContext update]; + + if (!mGLContext) { + [self setGLContext:aGLContext]; + [self updateGLContext]; + } return true; @@ -3229,16 +3216,17 @@ NSEvent* gLastDragMouseDownEvent = nil; return [[self window] isMovableByWindowBackground]; } --(void)update +-(void)updateGLContext { if (mGLContext) { + [mGLContext setView:self]; [mGLContext update]; } } -- (void) _surfaceNeedsUpdate:(NSNotification*)notification +- (void)_surfaceNeedsUpdate:(NSNotification*)notification { - [self update]; + [self updateGLContext]; } - (BOOL)wantsBestResolutionOpenGLSurface @@ -3451,7 +3439,7 @@ NSEvent* gLastDragMouseDownEvent = nil; if (!mGeckoChild || ![self window]) return NO; - return mGLContext || [self isUsingMainThreadOpenGL]; + return mGLContext || mUsingOMTCompositor || [self isUsingMainThreadOpenGL]; } - (void)drawUsingOpenGL @@ -3474,10 +3462,8 @@ NSEvent* gLastDragMouseDownEvent = nil; if (!mGLContext) { [self setGLContext:glContext]; + [self updateGLContext]; } - - [glContext setView:self]; - [glContext update]; } mGeckoChild->PaintWindow(region);