Bug 1776895 - [2/6] Cleanup: remove BoundsUseDesktopPixels() condition r=cmartin

A window is fullscreenable iff it's a desktop window (that is, a
positional child of the desktop rather than of another window) -- and
desktop windows are the windows which use desktop-pixel units in
Resize().

Code coverage confirms that the branch when `BoundsUseDesktopPixels()`
returns `false` is never taken in tests.

Under the (hopefully justified) assumption that it's never taken at all,
no functional changes.

Differential Revision: https://phabricator.services.mozilla.com/D153408
This commit is contained in:
Ray Kraesig 2022-09-20 16:22:56 +00:00
Родитель 44d02f76a7
Коммит 86239750b0
1 изменённых файлов: 14 добавлений и 8 удалений

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

@ -716,6 +716,11 @@ void nsBaseWidget::PerformFullscreenTransition(FullscreenTransitionStage aStage,
//
//-------------------------------------------------------------------------
void nsBaseWidget::InfallibleMakeFullScreen(bool aFullScreen) {
// Windows which can be made fullscreen are exactly those which are located on
// the desktop, rather than being a child of some other window.
MOZ_DIAGNOSTIC_ASSERT(BoundsUseDesktopPixels(),
"non-desktop windows cannot be made fullscreen");
HideWindowChrome(aFullScreen);
if (aFullScreen) {
@ -733,15 +738,16 @@ void nsBaseWidget::InfallibleMakeFullScreen(bool aFullScreen) {
Resize(left, top, width, height, true);
}
}
} else if (mOriginalBounds) {
if (BoundsUseDesktopPixels()) {
DesktopRect deskRect = *mOriginalBounds / GetDesktopToDeviceScale();
Resize(deskRect.X(), deskRect.Y(), deskRect.Width(), deskRect.Height(),
true);
} else {
Resize(mOriginalBounds->X(), mOriginalBounds->Y(),
mOriginalBounds->Width(), mOriginalBounds->Height(), true);
} else {
if (!mOriginalBounds) {
// This should never happen, at present, since we don't make windows
// fullscreen at their creation time; but it's not logically impossible.
MOZ_ASSERT(false, "fullscreen window did not have saved position");
return;
}
DesktopRect deskRect = *mOriginalBounds / GetDesktopToDeviceScale();
Resize(deskRect.X(), deskRect.Y(), deskRect.Width(), deskRect.Height(),
true);
}
}