зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1743780 - Get rid of PuppetScreenManager and PuppetScreen. r=emilio
Now we use `mozilla::widget::ScreenManager` even if on content process, so no one uses `PuppetScreen` and `PuppetScreenManager`. And I would like to remove `Hal.h` reference from `PuppetWidget`, so I remove unused method. Differential Revision: https://phabricator.services.mozilla.com/D132564
This commit is contained in:
Родитель
4aff514399
Коммит
3da88d8e66
|
@ -114,6 +114,7 @@
|
|||
#include "nsILoadContext.h"
|
||||
#include "nsISHEntry.h"
|
||||
#include "nsISHistory.h"
|
||||
#include "nsIScreenManager.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsISecureBrowserUI.h"
|
||||
#include "nsIURI.h"
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "nsRefreshDriver.h"
|
||||
#include "mozilla/dom/BrowserChild.h"
|
||||
#include "mozilla/gfx/gfxVars.h"
|
||||
#include "mozilla/Hal.h"
|
||||
#include "mozilla/IMEStateManager.h"
|
||||
#include "mozilla/layers/APZChild.h"
|
||||
#include "mozilla/layers/WebRenderLayerManager.h"
|
||||
|
@ -34,7 +33,6 @@
|
|||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::hal;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::layers;
|
||||
using namespace mozilla::widget;
|
||||
|
@ -1056,82 +1054,6 @@ void PuppetWidget::StartAsyncScrollbarDrag(
|
|||
mBrowserChild->StartScrollbarDrag(aDragMetrics);
|
||||
}
|
||||
|
||||
PuppetScreen::PuppetScreen(void* nativeScreen) {}
|
||||
|
||||
PuppetScreen::~PuppetScreen() = default;
|
||||
|
||||
static ScreenConfiguration ScreenConfig() {
|
||||
ScreenConfiguration config;
|
||||
hal::GetCurrentScreenConfiguration(&config);
|
||||
return config;
|
||||
}
|
||||
|
||||
nsIntSize PuppetWidget::GetScreenDimensions() {
|
||||
nsIntRect r = ScreenConfig().rect();
|
||||
return nsIntSize(r.Width(), r.Height());
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PuppetScreen::GetRect(int32_t* outLeft, int32_t* outTop, int32_t* outWidth,
|
||||
int32_t* outHeight) {
|
||||
nsIntRect r = ScreenConfig().rect();
|
||||
r.GetRect(outLeft, outTop, outWidth, outHeight);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PuppetScreen::GetAvailRect(int32_t* outLeft, int32_t* outTop, int32_t* outWidth,
|
||||
int32_t* outHeight) {
|
||||
return GetRect(outLeft, outTop, outWidth, outHeight);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PuppetScreen::GetPixelDepth(int32_t* aPixelDepth) {
|
||||
*aPixelDepth = ScreenConfig().pixelDepth();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PuppetScreen::GetColorDepth(int32_t* aColorDepth) {
|
||||
*aColorDepth = ScreenConfig().colorDepth();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(PuppetScreenManager, nsIScreenManager)
|
||||
|
||||
PuppetScreenManager::PuppetScreenManager() {
|
||||
mOneScreen = new PuppetScreen(nullptr);
|
||||
}
|
||||
|
||||
PuppetScreenManager::~PuppetScreenManager() = default;
|
||||
|
||||
NS_IMETHODIMP
|
||||
PuppetScreenManager::GetPrimaryScreen(nsIScreen** outScreen) {
|
||||
NS_IF_ADDREF(*outScreen = mOneScreen.get());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PuppetScreenManager::GetTotalScreenPixels(int64_t* aTotalScreenPixels) {
|
||||
MOZ_ASSERT(aTotalScreenPixels);
|
||||
if (mOneScreen) {
|
||||
int32_t x, y, width, height;
|
||||
x = y = width = height = 0;
|
||||
mOneScreen->GetRect(&x, &y, &width, &height);
|
||||
*aTotalScreenPixels = width * height;
|
||||
} else {
|
||||
*aTotalScreenPixels = 0;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PuppetScreenManager::ScreenForRect(int32_t inLeft, int32_t inTop,
|
||||
int32_t inWidth, int32_t inHeight,
|
||||
nsIScreen** outScreen) {
|
||||
return GetPrimaryScreen(outScreen);
|
||||
}
|
||||
|
||||
ScreenIntMargin PuppetWidget::GetSafeAreaInsets() const {
|
||||
return mSafeAreaInsets;
|
||||
}
|
||||
|
|
|
@ -17,10 +17,8 @@
|
|||
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "nsBaseScreen.h"
|
||||
#include "nsBaseWidget.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsIScreenManager.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ContentCache.h"
|
||||
|
@ -223,8 +221,6 @@ class PuppetWidget : public nsBaseWidget,
|
|||
mDefaultScale = aScale;
|
||||
}
|
||||
|
||||
nsIntSize GetScreenDimensions();
|
||||
|
||||
// safe area insets support
|
||||
virtual ScreenIntMargin GetSafeAreaInsets() const override;
|
||||
void UpdateSafeAreaInsets(const ScreenIntMargin& aSafeAreaInsets);
|
||||
|
@ -411,32 +407,6 @@ class PuppetWidget : public nsBaseWidget,
|
|||
bool mIgnoreCompositionEvents;
|
||||
};
|
||||
|
||||
class PuppetScreen : public nsBaseScreen {
|
||||
public:
|
||||
explicit PuppetScreen(void* nativeScreen);
|
||||
~PuppetScreen();
|
||||
|
||||
NS_IMETHOD GetRect(int32_t* aLeft, int32_t* aTop, int32_t* aWidth,
|
||||
int32_t* aHeight) override;
|
||||
NS_IMETHOD GetAvailRect(int32_t* aLeft, int32_t* aTop, int32_t* aWidth,
|
||||
int32_t* aHeight) override;
|
||||
NS_IMETHOD GetPixelDepth(int32_t* aPixelDepth) override;
|
||||
NS_IMETHOD GetColorDepth(int32_t* aColorDepth) override;
|
||||
};
|
||||
|
||||
class PuppetScreenManager final : public nsIScreenManager {
|
||||
~PuppetScreenManager();
|
||||
|
||||
public:
|
||||
PuppetScreenManager();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISCREENMANAGER
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIScreen> mOneScreen;
|
||||
};
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче