Bug 1377321 - Only use WebRender for top-level windows and remote content. r=kats

This commit is contained in:
Nicolas Silva 2018-01-15 14:38:19 +01:00
parent 8ebc9420bc
commit b5d400cfab
2 changed files with 16 additions and 1 deletions

View File

@ -886,6 +886,12 @@ bool nsBaseWidget::IsSmallPopup() const
bool
nsBaseWidget::ComputeShouldAccelerate()
{
if (gfx::gfxVars::UseWebRender() && !AllowWebRenderForThisWindow()) {
// If WebRender is enabled, non-WebRender widgets use the basic compositor
// (at least for now), even though they would get an accelerated compositor
// if WebRender wasn't enabled.
return false;
}
return gfx::gfxConfig::IsEnabled(gfx::Feature::HW_COMPOSITING) &&
WidgetTypeSupportsAcceleration();
}
@ -900,6 +906,12 @@ nsBaseWidget::UseAPZ()
gfxPrefs::APZPopupsEnabled())));
}
bool
nsBaseWidget::AllowWebRenderForThisWindow()
{
return WindowType() == eWindowType_toplevel || HasRemoteContent();
}
void nsBaseWidget::CreateCompositor()
{
LayoutDeviceIntRect rect = GetBounds();
@ -1276,7 +1288,8 @@ nsBaseWidget::CreateCompositorSession(int aWidth,
// If widget type does not supports acceleration, we use ClientLayerManager
// even when gfxVars::UseWebRender() is true. WebRender could coexist only
// with BasicCompositor.
bool enableWR = gfx::gfxVars::UseWebRender() && WidgetTypeSupportsAcceleration();
bool enableWR = gfx::gfxVars::UseWebRender() && WidgetTypeSupportsAcceleration()
&& AllowWebRenderForThisWindow();
bool enableAPZ = UseAPZ();
CompositorOptions options(enableAPZ, enableWR);

View File

@ -602,6 +602,8 @@ protected:
bool UseAPZ();
bool AllowWebRenderForThisWindow();
/**
* For widgets that support synthesizing native touch events, this function
* can be used to manage the current state of synthetic pointers. Each widget