Bug 807457: For non-HTML documents, use the viewport size as the scrollable area, in TabChild::HandlePossibleViewportChange(). r=smaug r=drs

This commit is contained in:
Daniel Holbert 2012-11-15 18:32:24 -08:00
Родитель 4f3ddcdba5
Коммит 9ac3b0650e
1 изменённых файлов: 11 добавлений и 2 удалений

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

@ -422,11 +422,20 @@ TabChild::HandlePossibleViewportChange()
bodyDOMElement->GetScrollHeight(&bodyHeight);
}
float pageWidth = NS_MAX(htmlWidth, bodyWidth);
float pageHeight = NS_MAX(htmlHeight, bodyHeight);
float pageWidth, pageHeight;
if (htmlDOMElement || bodyDOMElement) {
pageWidth = NS_MAX(htmlWidth, bodyWidth);
pageHeight = NS_MAX(htmlHeight, bodyHeight);
} else {
// For non-HTML content (e.g. SVG), just assume page size == viewport size.
pageWidth = viewportW;
pageHeight = viewportH;
}
NS_ENSURE_TRUE_VOID(pageWidth); // (return early rather than divide by 0)
minScale = mInnerSize.width / pageWidth;
minScale = clamped((double)minScale, viewportInfo.minZoom, viewportInfo.maxZoom);
NS_ENSURE_TRUE_VOID(minScale); // (return early rather than divide by 0)
viewportH = NS_MAX(viewportH, screenH / minScale);
SetCSSViewport(viewportW, viewportH);