Files
palemoon27/widget/nsBaseScreen.cpp
T
roytam1 940859860a import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1199615 - Fixed toolkit/mozapps/update/ compilation on mingw. r=rstrong (3cc6911a9b)
- Bug 1240085 - Revert to CSS-pixel units for screenX, screenY, moveTo() APIs, and adjust the origin for secondary displays with differing resolution to avoid overlapping coordinate spaces. r=emk (be6bc0e6d9)
- Bug 1231681 - "Implement window.u2f interface". r=baku, r=dkeeler (22c54db98d)
- Bug 1234700 - Hide window.showModalDialog when e10s is enabled. r=jimm (0aaeee9d05)
- Bug 1247335 - patch 1 - Provide a desktop-pixel variant of SetPosition on nsIBaseWindow and its implementations. r=emk (90da9912ff)
- Bug 1247335 - patch 2 - Use desktop pixel coordinates when loading a nsXULWindow position. r=emk (e9343a7d58)
- Bug 1247335 - patch 3 - Check for potential DPI change after moving or resizing nsGlobalWindow. r=emk (072db418cd)
- deduplicate and reorder (e35b3edeab)
- Bug 1213514 - Don't bother checking for third party URLs at interception time unless if the user needs it; r=jdm (9effb82825)
- Bug 1206894 follow-up: Add a null check (d3cc337e32)
- Bug 1233962 P1 Call ResetInterception() if the controller is nullptr. r=jdm (34da2cb7cb)
- Bug 1233962 P2 Fix service worker xpcshell test to return a dispatcher from ChannelIntercepted(). r=jdm (d1f02f0b88)
- Bug 1236686 - Remove nsIFetchEventDispatcher; r=jdm (1b5a021186)
2023-12-13 11:31:24 +08:00

91 lines
2.3 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=8 et :
*/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#define MOZ_FATAL_ASSERTIONS_FOR_THREAD_SAFETY
#include "nsBaseScreen.h"
NS_IMPL_ISUPPORTS(nsBaseScreen, nsIScreen)
nsBaseScreen::nsBaseScreen()
{
for (uint32_t i = 0; i < nsIScreen::BRIGHTNESS_LEVELS; i++)
mBrightnessLocks[i] = 0;
}
nsBaseScreen::~nsBaseScreen() { }
NS_IMETHODIMP
nsBaseScreen::GetRectDisplayPix(int32_t *outLeft, int32_t *outTop,
int32_t *outWidth, int32_t *outHeight)
{
return GetRect(outLeft, outTop, outWidth, outHeight);
}
NS_IMETHODIMP
nsBaseScreen::GetAvailRectDisplayPix(int32_t *outLeft, int32_t *outTop,
int32_t *outWidth, int32_t *outHeight)
{
return GetAvailRect(outLeft, outTop, outWidth, outHeight);
}
NS_IMETHODIMP
nsBaseScreen::LockMinimumBrightness(uint32_t aBrightness)
{
MOZ_ASSERT(aBrightness < nsIScreen::BRIGHTNESS_LEVELS,
"Invalid brightness level to lock");
mBrightnessLocks[aBrightness]++;
MOZ_ASSERT(mBrightnessLocks[aBrightness] > 0,
"Overflow after locking brightness level");
CheckMinimumBrightness();
return NS_OK;
}
NS_IMETHODIMP
nsBaseScreen::UnlockMinimumBrightness(uint32_t aBrightness)
{
MOZ_ASSERT(aBrightness < nsIScreen::BRIGHTNESS_LEVELS,
"Invalid brightness level to lock");
MOZ_ASSERT(mBrightnessLocks[aBrightness] > 0,
"Unlocking a brightness level with no corresponding lock");
mBrightnessLocks[aBrightness]--;
CheckMinimumBrightness();
return NS_OK;
}
void
nsBaseScreen::CheckMinimumBrightness()
{
uint32_t brightness = nsIScreen::BRIGHTNESS_LEVELS;
for (int32_t i = nsIScreen::BRIGHTNESS_LEVELS - 1; i >=0; i--) {
if (mBrightnessLocks[i] > 0) {
brightness = i;
break;
}
}
ApplyMinimumBrightness(brightness);
}
NS_IMETHODIMP
nsBaseScreen::GetContentsScaleFactor(double* aContentsScaleFactor)
{
*aContentsScaleFactor = 1.0;
return NS_OK;
}
NS_IMETHODIMP
nsBaseScreen::GetDefaultCSSScaleFactor(double* aScaleFactor)
{
*aScaleFactor = 1.0;
return NS_OK;
}