diff --git a/content/base/public/nsViewportInfo.h b/content/base/public/nsViewportInfo.h index bc02eff58bf..1099325c1fc 100644 --- a/content/base/public/nsViewportInfo.h +++ b/content/base/public/nsViewportInfo.h @@ -25,10 +25,11 @@ static const int32_t kViewportDefaultScreenWidth = 980; class MOZ_STACK_CLASS nsViewportInfo { public: - nsViewportInfo(const mozilla::ScreenIntSize& aDisplaySize) : + nsViewportInfo(const mozilla::ScreenIntSize& aDisplaySize, + bool aAllowZoom = true) : mDefaultZoom(1.0), mAutoSize(true), - mAllowZoom(true) + mAllowZoom(aAllowZoom) { mSize = mozilla::gfx::RoundedToInt(mozilla::ScreenSize(aDisplaySize) / mDefaultZoom); mozilla::CSSToLayoutDeviceScale pixelRatio(1.0f); diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 12a05ff7a53..4cabc855ca7 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -6831,6 +6831,8 @@ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize) switch (mViewportType) { case DisplayWidthHeight: return nsViewportInfo(aDisplaySize); + case DisplayWidthHeightNoZoom: + return nsViewportInfo(aDisplaySize, /* allowZoom */ false); case Unknown: { nsAutoString viewport; @@ -6861,6 +6863,21 @@ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize) mViewportType = DisplayWidthHeight; return nsViewportInfo(aDisplaySize); } + + // Bug 940036. This is bad. When FirefoxOS was built, apps installed + // where not using the AsyncPanZoom code. As a result a lot of apps + // in the marketplace does not use it yet and instead are built to + // render correctly in FirefoxOS only. For a smooth transition the above + // code force installed apps to render as if they have a viewport with + // content="width=device-width, height=device-height, user-scalable=no". + // This could be safely remove once it is known that most apps in the + // marketplace use it and that users does not use an old version of the + // app that does not use it. + nsCOMPtr docShell(mDocumentContainer); + if (docShell && docShell->GetIsApp()) { + mViewportType = DisplayWidthHeightNoZoom; + return nsViewportInfo(aDisplaySize, /* allowZoom */ false); + } } nsAutoString minScaleStr; diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index a467dac7b9d..8607143debe 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -1390,6 +1390,7 @@ private: enum ViewportType { DisplayWidthHeight, + DisplayWidthHeightNoZoom, Specified, Unknown };