Bug 1743533. Handle the visible rect of oop iframes that span multiple pages in print documents. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D132789
This commit is contained in:
Timothy Nikkel 2021-12-06 01:08:55 +00:00
parent 53092b50ed
commit 57a0ff75ad
2 changed files with 24 additions and 3 deletions

View File

@ -742,6 +742,28 @@ void nsDisplayListBuilder::BeginFrame() {
}
}
void nsDisplayListBuilder::AddEffectUpdate(dom::RemoteBrowser* aBrowser,
const dom::EffectsInfo& aUpdate) {
dom::EffectsInfo update = aUpdate;
// For printing we create one display item for each page that an iframe
// appears on, the proper visible rect is the union of all the visible rects
// we get from each display item.
nsPresContext* pc =
mReferenceFrame ? mReferenceFrame->PresContext() : nullptr;
if (pc && (pc->Type() != nsPresContext::eContext_Galley)) {
Maybe<dom::EffectsInfo> existing = mEffectsUpdates.MaybeGet(aBrowser);
if (existing.isSome()) {
// Only the visible rect should differ, the scales should match.
MOZ_ASSERT(existing->mScaleX == aUpdate.mScaleX &&
existing->mScaleY == aUpdate.mScaleY &&
existing->mTransformToAncestorScale ==
aUpdate.mTransformToAncestorScale);
update.mVisibleRect = update.mVisibleRect.Union(existing->mVisibleRect);
}
}
mEffectsUpdates.InsertOrUpdate(aBrowser, update);
}
void nsDisplayListBuilder::EndFrame() {
NS_ASSERTION(!mInInvalidSubtree,
"Someone forgot to cleanup mInInvalidSubtree!");

View File

@ -875,9 +875,8 @@ class nsDisplayListBuilder {
return mEffectsUpdates;
}
void AddEffectUpdate(dom::RemoteBrowser* aBrowser, dom::EffectsInfo aUpdate) {
mEffectsUpdates.InsertOrUpdate(aBrowser, aUpdate);
}
void AddEffectUpdate(dom::RemoteBrowser* aBrowser,
const dom::EffectsInfo& aUpdate);
/**
* Allocate memory in our arena. It will only be freed when this display list