Bug 1724808. Take into account ancestor documents in other processes' resolution when pre-decoding images. r=hiro

Depends on D122212

Differential Revision: https://phabricator.services.mozilla.com/D122213
This commit is contained in:
Timothy Nikkel 2021-08-11 07:18:09 +00:00
parent 50cee5c326
commit 423dd4a3bd

View File

@ -90,6 +90,7 @@
#include "mozilla/dom/Link.h"
#include "mozilla/dom/HTMLAnchorElement.h"
#include "mozilla/dom/BrowserChild.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -1064,6 +1065,12 @@ void nsImageFrame::MaybeDecodeForPredictedSize() {
presShell->GetCumulativeResolution() *
nsLayoutUtils::GetTransformToAncestorScaleExcludingAnimated(this));
// If we are in a remote browser, then apply scaling from ancestor browsers
if (BrowserChild* browserChild = BrowserChild::GetFrom(presShell)) {
resolutionToScreen.xScale *= browserChild->GetEffectsInfo().mScaleX;
resolutionToScreen.yScale *= browserChild->GetEffectsInfo().mScaleY;
}
// ...and this frame's content box...
const nsPoint offset =
GetOffsetToCrossDoc(nsLayoutUtils::GetReferenceFrame(this));