From afdb6ee2958319e98fd3b696ed4cbb45b98ca621 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Wed, 26 Aug 2015 14:41:12 -0400 Subject: [PATCH] Bug 1194811 Part 1 - Recompute the zoom constraints if the available screen area changes. r=botond --- layout/base/ZoomConstraintsClient.cpp | 7 +++++++ layout/base/ZoomConstraintsClient.h | 1 + layout/base/nsPresShell.cpp | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/layout/base/ZoomConstraintsClient.cpp b/layout/base/ZoomConstraintsClient.cpp index 648129fb3ca..61f896b467f 100644 --- a/layout/base/ZoomConstraintsClient.cpp +++ b/layout/base/ZoomConstraintsClient.cpp @@ -133,6 +133,13 @@ ZoomConstraintsClient::Observe(nsISupports* aSubject, const char* aTopic, const return NS_OK; } +void +ZoomConstraintsClient::ScreenSizeChanged() +{ + ZCC_LOG("Got a screen-size change notification in %p\n", this); + RefreshZoomConstraints(); +} + mozilla::layers::ZoomConstraints ComputeZoomConstraintsFromViewportInfo(const nsViewportInfo& aViewportInfo) { diff --git a/layout/base/ZoomConstraintsClient.h b/layout/base/ZoomConstraintsClient.h index 87be1162697..4a2da9114e2 100644 --- a/layout/base/ZoomConstraintsClient.h +++ b/layout/base/ZoomConstraintsClient.h @@ -33,6 +33,7 @@ private: public: void Init(nsIPresShell* aPresShell, nsIDocument *aDocument); void Destroy(); + void ScreenSizeChanged(); private: void RefreshZoomConstraints(); diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index c596d76aa98..30c0b2075c4 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -1795,6 +1795,12 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight) return NS_OK; } + if (mZoomConstraintsClient) { + // If we have a ZoomConstraintsClient and the available screen area + // changed, then we might need to disable double-tap-to-zoom, so notify + // the ZCC to update itself. + mZoomConstraintsClient->ScreenSizeChanged(); + } if (mMobileViewportManager) { // If we have a mobile viewport manager, request a reflow from it. It can // recompute the final CSS viewport and trigger a call to