Bug 1767124 - Change the return type of nsLayoutUtils::GetTransformToAncestorScaleExcludingAnimated to MatrixScalesDouble. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D147100
This commit is contained in:
Razvan Cojocaru 2022-05-27 19:23:33 +00:00
Родитель 2add5dfe81
Коммит 331a6fea02
3 изменённых файлов: 11 добавлений и 7 удалений

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

@ -2144,15 +2144,15 @@ static Matrix4x4Flagged GetTransformToAncestorExcludingAnimated(
return ctm;
}
gfxSize nsLayoutUtils::GetTransformToAncestorScaleExcludingAnimated(
MatrixScalesDouble nsLayoutUtils::GetTransformToAncestorScaleExcludingAnimated(
nsIFrame* aFrame) {
Matrix4x4Flagged transform = GetTransformToAncestorExcludingAnimated(
aFrame, nsLayoutUtils::GetDisplayRootFrame(aFrame));
Matrix transform2D;
if (transform.Is2D(&transform2D)) {
return ThebesMatrix(transform2D).ScaleFactors().ToSize();
return ThebesMatrix(transform2D).ScaleFactors();
}
return gfxSize(1, 1);
return MatrixScalesDouble();
}
const nsIFrame* nsLayoutUtils::FindNearestCommonAncestorFrame(

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

@ -955,7 +955,8 @@ class nsLayoutUtils {
* If some frame on the path from aFrame to the display root frame may have an
* animated scale, returns the identity scale factors.
*/
static gfxSize GetTransformToAncestorScaleExcludingAnimated(nsIFrame* aFrame);
static MatrixScalesDouble GetTransformToAncestorScaleExcludingAnimated(
nsIFrame* aFrame);
/**
* Gets a scale that includes CSS transforms in this process as well as the

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

@ -1080,9 +1080,12 @@ void nsImageFrame::MaybeDecodeForPredictedSize() {
// OK, we're ready to decode. Compute the scale to the screen...
mozilla::PresShell* presShell = PresContext()->PresShell();
LayoutDeviceToScreenScale2D resolutionToScreen(
presShell->GetCumulativeResolution() *
nsLayoutUtils::GetTransformToAncestorScaleExcludingAnimated(this));
MatrixScalesDouble scale =
ScaleFactor<UnknownUnits, UnknownUnits>(
presShell->GetCumulativeResolution()) *
nsLayoutUtils::GetTransformToAncestorScaleExcludingAnimated(this);
auto resolutionToScreen =
ViewAs<LayoutDeviceToScreenScale2D>(scale.ConvertTo<float>());
// If we are in a remote browser, then apply scaling from ancestor browsers
if (BrowserChild* browserChild = BrowserChild::GetFrom(presShell)) {