Bug 1107456 - Part 1: While in RDM, scale the inner size values of the viewport using the device's full zoom to find its outer size. r=bradwerth,Ehsan

We want to ensure the RDM browser's outer window sizes are not affected as the page is zoomed in or out. In the context of RDM, the size of the browser window will be the same as the viewport so I believe it's safe to assume that the window's outer size will be equal to its inner size when the zoom level is set to 100%.

I found we can get this value by using the presentation context's `GetDeviceZullZoom` method and applying it to the inner sizes of the RDM viewport.

Differential Revision: https://phabricator.services.mozilla.com/D32778

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Micah Tigley 2019-05-30 23:37:14 +00:00
Родитель 9b169ea3a5
Коммит 387239448c
1 изменённых файлов: 21 добавлений и 2 удалений

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

@ -3525,13 +3525,32 @@ void nsGlobalWindowOuter::SetInnerHeightOuter(int32_t aInnerHeight,
nsIntSize nsGlobalWindowOuter::GetOuterSize(CallerType aCallerType,
ErrorResult& aError) {
if (nsContentUtils::ResistFingerprinting(aCallerType) ||
(mDoc && mDoc->InRDMPane())) {
if (nsContentUtils::ResistFingerprinting(aCallerType)) {
CSSIntSize size;
aError = GetInnerSize(size);
return nsIntSize(size.width, size.height);
}
if (mDoc && mDoc->InRDMPane()) {
CSSIntSize size;
aError = GetInnerSize(size);
// Obtain the current zoom of the presentation shell. The zoom value will
// be used to scale the size of the visual viewport to the device browser's
// outer size values. Once RDM no longer relies on the having the page
// content being embedded in a <iframe mozbrowser>, we can do away with
// this approach and retrieve the size of the frame containing the browser
// content.
RefPtr<nsPresContext> presContext = mDocShell->GetPresContext();
if (presContext) {
float zoom = presContext->GetDeviceFullZoom();
int32_t width = std::round(size.width * zoom);
int32_t height = std::round(size.height * zoom);
return nsIntSize(width, height);
}
}
nsCOMPtr<nsIBaseWindow> treeOwnerAsWin = GetTreeOwnerWindow();
if (!treeOwnerAsWin) {
aError.Throw(NS_ERROR_FAILURE);