Bug 1180267 - Ensure that the desktop-mode viewport for Fennec is based on a 980 CSS pixel width rather than the screen size. r=snorp

--HG--
extra : commitid : EDmJyKrfnzt
This commit is contained in:
Kartikaya Gupta 2015-08-24 13:45:45 -04:00
Родитель 79b7335af2
Коммит cb9e675820
3 изменённых файлов: 9 добавлений и 5 удалений

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

@ -7904,8 +7904,12 @@ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
nsPIDOMWindow* win = GetWindow();
if (win && win->IsDesktopModeViewport())
{
return nsViewportInfo(aDisplaySize,
defaultScale,
float viewportWidth = gfxPrefs::DesktopViewportWidth() / fullZoom;
float scaleToFit = aDisplaySize.width / viewportWidth;
float aspectRatio = (float)aDisplaySize.height / aDisplaySize.width;
ScreenSize viewportSize(viewportWidth, viewportWidth * aspectRatio);
return nsViewportInfo(RoundedToInt(viewportSize),
CSSToScreenScale(scaleToFit),
/*allowZoom*/false,
/*allowDoubleTapZoom*/ false);
}
@ -8060,8 +8064,7 @@ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
// Stretch CSS pixel size of viewport to keep device pixel size
// unchanged after full zoom applied.
// See bug 974242.
size.width = Preferences::GetInt("browser.viewport.desktopWidth",
kViewportDefaultScreenWidth) / fullZoom;
size.width = gfxPrefs::DesktopViewportWidth() / fullZoom;
}
}

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

@ -16,7 +16,6 @@ static const mozilla::LayoutDeviceToScreenScale kViewportMinScale(0.0f);
static const mozilla::LayoutDeviceToScreenScale kViewportMaxScale(10.0f);
static const mozilla::CSSIntSize kViewportMinSize(200, 40);
static const mozilla::CSSIntSize kViewportMaxSize(10000, 10000);
static const int32_t kViewportDefaultScreenWidth = 980;
/**
* Information retrieved from the <meta name="viewport"> tag. See

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

@ -187,6 +187,8 @@ private:
DECL_GFX_PREF(Live, "apz.y_stationary_size_multiplier", APZYStationarySizeMultiplier, float, 3.5f);
DECL_GFX_PREF(Live, "apz.zoom_animation_duration_ms", APZZoomAnimationDuration, int32_t, 250);
DECL_GFX_PREF(Live, "browser.viewport.desktopWidth", DesktopViewportWidth, int32_t, 980);
DECL_GFX_PREF(Live, "dom.meta-viewport.enabled", MetaViewportEnabled, bool, false);
DECL_GFX_PREF(Once, "dom.vr.enabled", VREnabled, bool, false);
DECL_GFX_PREF(Once, "dom.vr.oculus.enabled", VROculusEnabled, bool, true);