Bug 1486958 - Sync FlushRendering() only during resizing on windows r=mattwoodrow

This commit is contained in:
sotaro 2018-09-14 17:13:55 +09:00
parent 82b98972c8
commit 24c5a93279
4 changed files with 21 additions and 2 deletions

View File

@ -637,8 +637,12 @@ WebRenderLayerManager::FlushRendering()
}
MOZ_ASSERT(mWidget);
// When DirectComposition and compositor window are used, we do not need to do sync FlushRendering.
if (WrBridge()->GetCompositorUseDComp()) {
// If value of IsResizingNativeWidget() is nothing, we assume that resizing might happen.
bool resizing = mWidget && mWidget->IsResizingNativeWidget().valueOr(true);
// Limit async FlushRendering to !resizing and Win DComp.
// XXX relax the limitation
if (WrBridge()->GetCompositorUseDComp() && !resizing) {
cBridge->SendFlushRenderingAsync();
} else if (mWidget->SynchronouslyRepaintOnResize() || gfxPrefs::LayersForceSynchronousResize()) {
cBridge->SendFlushRendering();

View File

@ -778,6 +778,11 @@ class nsIWidget : public nsISupports
double aHeight,
bool aRepaint) = 0;
virtual mozilla::Maybe<bool> IsResizingNativeWidget()
{
return mozilla::Nothing();
}
/**
* Resize the widget so that the inner client area has the given size.
*

View File

@ -1988,6 +1988,15 @@ nsWindow::Resize(double aX, double aY, double aWidth,
NotifyRollupGeometryChange();
}
mozilla::Maybe<bool>
nsWindow::IsResizingNativeWidget()
{
if (mResizeState == RESIZING) {
return Some(true);
}
return Some(false);
}
nsresult
nsWindow::BeginResizeDrag(WidgetGUIEvent* aEvent,
int32_t aHorizontal,

View File

@ -131,6 +131,7 @@ public:
virtual void Move(double aX, double aY) override;
virtual void Resize(double aWidth, double aHeight, bool aRepaint) override;
virtual void Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
virtual mozilla::Maybe<bool> IsResizingNativeWidget() override;
virtual MOZ_MUST_USE nsresult
BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
int32_t aHorizontal,