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

View file

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