Bug 1882358 Part 2: Make WebRenderLayerManager track widget size to detect resizes. r=nical

This changes the resize check to an objective standard of whether or not
the widget has resized, rather than asking the widget if it is in the
process of resizing.

Differential Revision: https://phabricator.services.mozilla.com/D202869
This commit is contained in:
Brad Werth 2024-02-28 17:50:38 +00:00
parent 5b63f1552a
commit ca2d2f1926
2 changed files with 11 additions and 9 deletions

View file

@ -694,20 +694,20 @@ void WebRenderLayerManager::FlushRendering(wr::RenderReasons aReasons) {
} }
MOZ_ASSERT(mWidget); MOZ_ASSERT(mWidget);
// If value of IsResizingNativeWidget() is nothing, we assume that resizing // If widget bounds size is different from the last flush, consider
// might happen. // this to be a resize.
bool resizing = mWidget && mWidget->IsResizingNativeWidget().valueOr(true); LayoutDeviceIntSize widgetSize = mWidget->GetBounds().Size();
bool resizing = widgetSize != mFlushWidgetSize;
mFlushWidgetSize = widgetSize;
if (resizing) { if (resizing) {
aReasons = aReasons | wr::RenderReasons::RESIZE; aReasons = aReasons | wr::RenderReasons::RESIZE;
} }
// Limit async FlushRendering to !resizing and Win DComp. // If we are resizing, check to see if we should do a synchronous
// XXX relax the limitation // flush.
if (WrBridge()->GetCompositorUseDComp() && !resizing) { if (resizing && (mWidget->SynchronouslyRepaintOnResize() ||
cBridge->SendFlushRenderingAsync(aReasons); StaticPrefs::layers_force_synchronous_resize())) {
} else if (mWidget->SynchronouslyRepaintOnResize() ||
StaticPrefs::layers_force_synchronous_resize()) {
cBridge->SendFlushRendering(aReasons); cBridge->SendFlushRendering(aReasons);
} else { } else {
cBridge->SendFlushRenderingAsync(aReasons); cBridge->SendFlushRenderingAsync(aReasons);

View file

@ -273,6 +273,8 @@ class WebRenderLayerManager final : public WindowRenderer {
UniquePtr<wr::DisplayListBuilder> mDLBuilder; UniquePtr<wr::DisplayListBuilder> mDLBuilder;
ScrollUpdatesMap mPendingScrollUpdates; ScrollUpdatesMap mPendingScrollUpdates;
LayoutDeviceIntSize mFlushWidgetSize;
}; };
} // namespace layers } // namespace layers