Bug 1523844 Part 2: Make MVMContext::SetResolutionAndScaleTo accept a ResolutionChangeOrigin. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D41631

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Brad Werth 2019-08-12 22:22:12 +00:00
Родитель be668ed4e1
Коммит c9e9805838
5 изменённых файлов: 14 добавлений и 7 удалений

Просмотреть файл

@ -61,7 +61,10 @@ class MockMVMContext : public MVMContext {
}
bool AllowZoomingForDocument() const { return true; }
void SetResolutionAndScaleTo(float aResolution) { mResolution = aResolution; }
void SetResolutionAndScaleTo(float aResolution,
ResolutionChangeOrigin aOrigin) {
mResolution = aResolution;
}
void Reflow(const CSSSize& aNewSize, const CSSSize& aOldSize,
ResizeEventFlag aResizeEventFlag) {
mICBSize = aNewSize;

Просмотреть файл

@ -124,10 +124,10 @@ bool GeckoMVMContext::AllowZoomingForDocument() const {
return nsLayoutUtils::AllowZoomingForDocument(mDocument);
}
void GeckoMVMContext::SetResolutionAndScaleTo(float aResolution) {
void GeckoMVMContext::SetResolutionAndScaleTo(float aResolution,
ResolutionChangeOrigin aOrigin) {
MOZ_ASSERT(mPresShell);
mPresShell->SetResolutionAndScaleTo(
aResolution, ResolutionChangeOrigin::MainThreadRestore);
mPresShell->SetResolutionAndScaleTo(aResolution, aOrigin);
}
void GeckoMVMContext::SetVisualViewportSize(const CSSSize& aSize) {

Просмотреть файл

@ -48,7 +48,8 @@ class GeckoMVMContext : public MVMContext {
Maybe<LayoutDeviceIntSize> GetContentViewerSize() const override;
bool AllowZoomingForDocument() const override;
void SetResolutionAndScaleTo(float aResolution) override;
void SetResolutionAndScaleTo(float aResolution,
ResolutionChangeOrigin aOrigin) override;
void SetVisualViewportSize(const CSSSize& aSize) override;
void UpdateDisplayPortMargins() override;
MOZ_CAN_RUN_SCRIPT_BOUNDARY

Просмотреть файл

@ -10,6 +10,7 @@
#include "nsISupportsImpl.h"
#include "nsStringFwd.h"
#include "nsViewportInfo.h"
#include "PresShell.h"
class nsIDOMEventListener;
class nsIObserver;
@ -51,7 +52,8 @@ class MVMContext {
virtual Maybe<LayoutDeviceIntSize> GetContentViewerSize() const = 0;
virtual bool AllowZoomingForDocument() const = 0;
virtual void SetResolutionAndScaleTo(float aResolution) = 0;
virtual void SetResolutionAndScaleTo(float aResolution,
ResolutionChangeOrigin aOrigin) = 0;
virtual void SetVisualViewportSize(const CSSSize& aSize) = 0;
virtual void UpdateDisplayPortMargins() = 0;

Просмотреть файл

@ -417,7 +417,8 @@ void MobileViewportManager::UpdateResolution(
"zoom factor must be positive");
LayoutDeviceToLayerScale resolution = ZoomToResolution(*newZoom, cssToDev);
MVM_LOG("%p: setting resolution %f\n", this, resolution.scale);
mContext->SetResolutionAndScaleTo(resolution.scale);
mContext->SetResolutionAndScaleTo(
resolution.scale, ResolutionChangeOrigin::MainThreadRestore);
MVM_LOG("%p: New zoom is %f\n", this, newZoom->scale);
}