提交 a0fff055 编写于 作者: C Chen Gang 提交者: libing

dom: base: nsDocument: Let view port size adapt display size

So all kinds of web site can fit the content view correctly in both
desktop mode and mobile mode.

Also revert the original commit "Always use 1366x768 viewport".
Signed-off-by: NChen Gang <chengang@emindsoft.com.cn>
上级 3800a6e9
......@@ -273,6 +273,8 @@ static LazyLogModule gCspPRLog("CSP");
#define NAME_NOT_VALID ((nsSimpleContentList*)1)
#define DISPLAY_WIDTH_HEITH_RATIO (946.0 / 1920.0)
nsIdentifierMapEntry::~nsIdentifierMapEntry()
{
}
......@@ -8198,6 +8200,11 @@ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
size.height = std::max(size.height, displaySize.height);
}
if (!aDisplaySize.IsEmpty()) {
size.width = aDisplaySize.width;
size.height = aDisplaySize.width * DISPLAY_WIDTH_HEITH_RATIO;
}
return nsViewportInfo(scaleFloat, scaleMinFloat, scaleMaxFloat, size,
mAutoSize, effectiveAllowZoom);
}
......
......@@ -32,9 +32,7 @@ class MOZ_STACK_CLASS nsViewportInfo
mAutoSize(true),
mAllowZoom(aAllowZoom)
{
//mSize = mozilla::ScreenSize(aDisplaySize) / mDefaultZoom;
mSize.width = 1366;
mSize.height = 768;
mSize = mozilla::ScreenSize(aDisplaySize) / mDefaultZoom;
mozilla::CSSToLayoutDeviceScale pixelRatio(1.0f);
mMinZoom = pixelRatio * kViewportMinScale;
mMaxZoom = pixelRatio * kViewportMaxScale;
......@@ -51,11 +49,10 @@ class MOZ_STACK_CLASS nsViewportInfo
mDefaultZoom(aDefaultZoom),
mMinZoom(aMinZoom),
mMaxZoom(aMaxZoom),
mSize(aSize),
mAutoSize(aAutoSize),
mAllowZoom(aAllowZoom)
{
mSize.width = 1366;
mSize.height = 768;
ConstrainViewportValues();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册