Bug 1760880 - Push document resolution in initial cache. r=morgan

Testing this is hard because the point of failure would be if we
recieved NotifyOfResolutionChange before the IPC doc is constructed.

Differential Revision: https://phabricator.services.mozilla.com/D141904
This commit is contained in:
Eitan Isaacson 2022-03-23 22:24:52 +00:00
Родитель 2c0c956707
Коммит ced0d9770b
2 изменённых файлов: 10 добавлений и 0 удалений

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

@ -3366,6 +3366,15 @@ already_AddRefed<AccAttributes> LocalAccessible::BundleFieldsForCache(
mStateFlags &= ~eOldFrameHasValidTransformStyle;
}
}
if (IsDoc()) {
if (PresShell* presShell = AsDoc()->PresShellPtr()) {
// Send the initial resolution of the document. When this changes, we
// will ne notified via nsAS::NotifyOfResolutionChange
float resolution = presShell->GetResolution();
fields->SetAttribute(nsGkAtoms::resolution, resolution);
}
}
}
return fields.forget();

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

@ -423,6 +423,7 @@ LayoutDeviceIntRect RemoteAccessibleBase<Derived>::Bounds() const {
// be scaled relative to its parent doc.
res = remoteAcc->AsDoc()->mCachedFields->GetAttribute<float>(
nsGkAtoms::resolution);
MOZ_ASSERT(res, "No cached document resolution found.");
bounds.ScaleRoundOut(res.valueOr(1.0f));
}