Bug 1299860 - Don't use the compositor backend of a popup with ImageBridge and VRManager. r=Bas

This commit is contained in:
Nicolas Silva 2016-10-07 11:08:32 +02:00
Родитель 74c4b5c3d2
Коммит 9f87d72b3f
9 изменённых файлов: 26 добавлений и 25 удалений

Просмотреть файл

@ -356,7 +356,7 @@ public:
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
nsEventStatus& aStatus) override;
virtual bool ComputeShouldAccelerate() override;
virtual bool WidgetTypeSupportsAcceleration() override;
virtual bool ShouldUseOffMainThreadCompositing() override;
NS_IMETHOD SetCursor(nsCursor aCursor) override;

Просмотреть файл

@ -1368,14 +1368,11 @@ NS_IMETHODIMP nsChildView::Invalidate(const LayoutDeviceIntRect& aRect)
}
bool
nsChildView::ComputeShouldAccelerate()
nsChildView::WidgetTypeSupportsAcceleration()
{
// Don't use OpenGL for transparent windows or for popup windows.
if (!mView || ![[mView window] isOpaque] ||
[[mView window] isKindOfClass:[PopupWindow class]])
return false;
return nsBaseWidget::ComputeShouldAccelerate();
return mView && [[mView window] isOpaque] &&
![[mView window] isKindOfClass:[PopupWindow class]];
}
bool

Просмотреть файл

@ -479,7 +479,7 @@ nsresult nsCocoaWindow::CreateNativeWindow(const NSRect &aRect,
[mWindow setOpaque:NO];
} else {
// Make sure that regular windows are opaque from the start, so that
// nsChildView::ComputeShouldAccelerate returns true for them.
// nsChildView::WidgetTypeSupportsAcceleration returns true for them.
[mWindow setOpaque:YES];
}

Просмотреть файл

@ -871,6 +871,12 @@ nsWindow::SetParent(nsIWidget *aNewParent)
return NS_OK;
}
bool
nsWindow::WidgetTypeSupportsAcceleration()
{
return !IsSmallPopup();
}
void
nsWindow::ReparentNativeWidget(nsIWidget* aNewParent)
{

Просмотреть файл

@ -363,6 +363,7 @@ public:
LayoutDeviceIntPoint GdkEventCoordsToDevicePixels(gdouble x, gdouble y);
LayoutDeviceIntRect GdkRectToDevicePixels(GdkRectangle rect);
virtual bool WidgetTypeSupportsAcceleration() override;
protected:
virtual ~nsWindow();

Просмотреть файл

@ -936,12 +936,8 @@ bool nsBaseWidget::IsSmallPopup() const
bool
nsBaseWidget::ComputeShouldAccelerate()
{
bool enabled = gfx::gfxConfig::IsEnabled(gfx::Feature::HW_COMPOSITING);
#ifdef MOZ_WIDGET_GTK
return enabled && !IsSmallPopup();
#else
return enabled;
#endif
return gfx::gfxConfig::IsEnabled(gfx::Feature::HW_COMPOSITING) &&
WidgetTypeSupportsAcceleration();
}
bool
@ -1359,8 +1355,12 @@ void nsBaseWidget::CreateCompositor(int aWidth, int aHeight)
lf->SetShadowManager(shadowManager);
lm->UpdateTextureFactoryIdentifier(textureFactoryIdentifier);
ImageBridgeChild::IdentifyCompositorTextureHost(textureFactoryIdentifier);
gfx::VRManagerChild::IdentifyTextureHost(textureFactoryIdentifier);
// Some popup or transparent widgets may use a different backend than the
// compositors used with ImageBridge and VR (and more generally web content).
if (WidgetTypeSupportsAcceleration()) {
ImageBridgeChild::IdentifyCompositorTextureHost(textureFactoryIdentifier);
gfx::VRManagerChild::IdentifyTextureHost(textureFactoryIdentifier);
}
WindowUsesOMTC();
mLayerManager = lm.forget();

Просмотреть файл

@ -272,7 +272,8 @@ public:
const mozilla::WidgetKeyboardEvent& aEvent,
DoCommandCallback aCallback,
void* aCallbackData) override { return false; }
virtual bool ComputeShouldAccelerate();
bool ComputeShouldAccelerate();
virtual bool WidgetTypeSupportsAcceleration() { return true; }
virtual nsIMEUpdatePreference GetIMEUpdatePreference() override { return nsIMEUpdatePreference(); }
NS_IMETHOD OnDefaultButtonLoaded(const LayoutDeviceIntRect& aButtonRect) override { return NS_ERROR_NOT_IMPLEMENTED; }
virtual already_AddRefed<nsIWidget>

Просмотреть файл

@ -7796,7 +7796,7 @@ void nsWindow::PickerClosed()
}
bool
nsWindow::ComputeShouldAccelerate()
nsWindow::WidgetTypeSupportsAcceleration()
{
// We don't currently support using an accelerated layer manager with
// transparent windows so don't even try. I'm also not sure if we even
@ -7805,12 +7805,8 @@ nsWindow::ComputeShouldAccelerate()
// Also see bug 1150376, D3D11 composition can cause issues on some devices
// on Windows 7 where presentation fails randomly for windows with drop
// shadows.
if (mTransparencyMode == eTransparencyTransparent ||
(IsPopup() && DeviceManagerDx::Get()->IsWARP()))
{
return false;
}
return nsBaseWidget::ComputeShouldAccelerate();
return mTransparencyMode != eTransparencyTransparent &&
!(IsPopup() && DeviceManagerDx::Get()->IsWARP());
}
void

Просмотреть файл

@ -261,7 +261,7 @@ public:
* Misc.
*/
virtual bool AutoErase(HDC dc);
bool ComputeShouldAccelerate() override;
bool WidgetTypeSupportsAcceleration() override;
void ForcePresent();