mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1561326 - Lazily constrain window size on Windows. r=mattwoodrow
Avoids IPC to get the max texture size until the layer manager is created. Differential Revision: https://phabricator.services.mozilla.com/D42385 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
6a00056089
commit
c975dfdfa3
@ -656,6 +656,7 @@ nsWindow::nsWindow(bool aIsChildWindow)
|
||||
mIdleService = nullptr;
|
||||
|
||||
mSizeConstraintsScale = GetDefaultScale().scale;
|
||||
mMaxTextureSize = -1; // Will be calculated when layer manager is created.
|
||||
|
||||
mRequestFxrOutputPending = false;
|
||||
|
||||
@ -1697,14 +1698,13 @@ void nsWindow::SetSizeConstraints(const SizeConstraints& aConstraints) {
|
||||
c.mMinSize.height =
|
||||
std::max(int32_t(::GetSystemMetrics(SM_CYMINTRACK)), c.mMinSize.height);
|
||||
}
|
||||
KnowsCompositor* knowsCompositor = GetLayerManager()->AsKnowsCompositor();
|
||||
if (knowsCompositor) {
|
||||
int32_t maxSize = knowsCompositor->GetMaxTextureSize();
|
||||
|
||||
if (mMaxTextureSize > 0) {
|
||||
// We can't make ThebesLayers bigger than this anyway.. no point it letting
|
||||
// a window grow bigger as we won't be able to draw content there in
|
||||
// general.
|
||||
c.mMaxSize.width = std::min(c.mMaxSize.width, maxSize);
|
||||
c.mMaxSize.height = std::min(c.mMaxSize.height, maxSize);
|
||||
c.mMaxSize.width = std::min(c.mMaxSize.width, mMaxTextureSize);
|
||||
c.mMaxSize.height = std::min(c.mMaxSize.height, mMaxTextureSize);
|
||||
}
|
||||
|
||||
mSizeConstraintsScale = GetDefaultScale().scale;
|
||||
@ -3715,6 +3715,10 @@ bool nsWindow::HasPendingInputEvent() {
|
||||
LayerManager* nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager,
|
||||
LayersBackend aBackendHint,
|
||||
LayerManagerPersistence aPersistence) {
|
||||
if (mLayerManager) {
|
||||
return mLayerManager;
|
||||
}
|
||||
|
||||
RECT windowRect;
|
||||
::GetClientRect(mWnd, &windowRect);
|
||||
|
||||
@ -3750,6 +3754,19 @@ LayerManager* nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager,
|
||||
|
||||
NS_ASSERTION(mLayerManager, "Couldn't provide a valid layer manager.");
|
||||
|
||||
if (mLayerManager) {
|
||||
// Update the size constraints now that the layer manager has been
|
||||
// created.
|
||||
KnowsCompositor* knowsCompositor = mLayerManager->AsKnowsCompositor();
|
||||
if (knowsCompositor) {
|
||||
SizeConstraints c = mSizeConstraints;
|
||||
mMaxTextureSize = knowsCompositor->GetMaxTextureSize();
|
||||
c.mMaxSize.width = std::min(c.mMaxSize.width, mMaxTextureSize);
|
||||
c.mMaxSize.height = std::min(c.mMaxSize.height, mMaxTextureSize);
|
||||
nsBaseWidget::SetSizeConstraints(c);
|
||||
}
|
||||
}
|
||||
|
||||
return mLayerManager;
|
||||
}
|
||||
|
||||
|
@ -690,6 +690,7 @@ class nsWindow final : public nsWindowBase {
|
||||
static void InitMouseWheelScrollData();
|
||||
|
||||
double mSizeConstraintsScale; // scale in effect when setting constraints
|
||||
int32_t mMaxTextureSize;
|
||||
|
||||
// Pointer events processing and management
|
||||
WinPointerEvents mPointerEvents;
|
||||
|
Loading…
Reference in New Issue
Block a user