Backed out changeset 64fa36b13e1a (bug 1473816)

This commit is contained in:
Xidorn Quan 2018-11-03 16:10:29 +11:00
parent 055159557a
commit 1ee5cae927

View File

@ -822,14 +822,6 @@ nsBaseWidget::InfallibleMakeFullScreen(bool aFullScreen, nsIScreen* aScreen)
{
HideWindowChrome(aFullScreen);
nsCOMPtr<nsIScreen> screen = aScreen;
if (!screen) {
screen = GetWidgetScreen();
if (!screen) {
return;
}
}
if (aFullScreen) {
if (!mOriginalBounds) {
mOriginalBounds = new LayoutDeviceIntRect();
@ -837,26 +829,25 @@ nsBaseWidget::InfallibleMakeFullScreen(bool aFullScreen, nsIScreen* aScreen)
*mOriginalBounds = GetScreenBounds();
// Move to top-left corner of screen and size to the screen dimensions
int32_t left, top, width, height;
if (NS_SUCCEEDED(screen->GetRectDisplayPix(&left, &top, &width, &height))) {
Resize(left, top, width, height, true);
nsCOMPtr<nsIScreen> screen = aScreen;
if (!screen) {
screen = GetWidgetScreen();
}
if (screen) {
int32_t left, top, width, height;
if (NS_SUCCEEDED(screen->GetRectDisplayPix(&left, &top, &width, &height))) {
Resize(left, top, width, height, true);
}
}
} else if (mOriginalBounds) {
int32_t left, top, width, height;
if (NS_FAILED(screen->GetAvailRectDisplayPix(&left, &top,
&width, &height))) {
return;
}
gfx::Rect screenRect(left, top, width, height);
gfx::Rect rect;
if (BoundsUseDesktopPixels()) {
DesktopRect deskRect = *mOriginalBounds / GetDesktopToDeviceScale();
rect = deskRect.ToUnknownRect();
Resize(deskRect.X(), deskRect.Y(),
deskRect.Width(), deskRect.Height(), true);
} else {
rect = gfx::Rect(mOriginalBounds->ToUnknownRect());
Resize(mOriginalBounds->X(), mOriginalBounds->Y(),
mOriginalBounds->Width(), mOriginalBounds->Height(), true);
}
rect = rect.MoveInsideAndClamp(screenRect);
Resize(rect.x, rect.y, rect.width, rect.height, true);
}
}