Bug 940036 - 3rd party gaia apps should set a meta-viewport tag. r=kats

This commit is contained in:
Vivien Nicolas 2013-12-03 16:10:26 +01:00
parent ef9e465afe
commit d9594062d6
3 changed files with 21 additions and 2 deletions

View File

@ -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);

View File

@ -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<nsIDocShell> docShell(mDocumentContainer);
if (docShell && docShell->GetIsApp()) {
mViewportType = DisplayWidthHeightNoZoom;
return nsViewportInfo(aDisplaySize, /* allowZoom */ false);
}
}
nsAutoString minScaleStr;

View File

@ -1390,6 +1390,7 @@ private:
enum ViewportType {
DisplayWidthHeight,
DisplayWidthHeightNoZoom,
Specified,
Unknown
};