mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1917356 - Update remote frame sizes for printing reliably. r=mstange
Printing has a weird code-path which doesn't use the refresh driver. Update frame sizes explicitly, and remove the hack in nsDisplayRemote::Paint (which is what probably papered over this). Differential Revision: https://phabricator.services.mozilla.com/D222372
This commit is contained in:
parent
bb17d77850
commit
640f58866c
@ -16840,9 +16840,10 @@ static void UpdateEffectsOnBrowsingContext(BrowsingContext* aBc,
|
||||
// for example.
|
||||
return EffectsInfo::FullyHidden();
|
||||
}
|
||||
Maybe<nsRect> visibleRect;
|
||||
gfx::MatrixScales rasterScale;
|
||||
visibleRect = subDocFrame->GetVisibleRect();
|
||||
Maybe<nsRect> visibleRect = subDocFrame->GetVisibleRect();
|
||||
if (subDocFrame->PresContext()->IsPrintingOrPrintPreview()) {
|
||||
visibleRect = Some(subDocFrame->GetDestRect());
|
||||
}
|
||||
if (!visibleRect) {
|
||||
// If we have no visible rect (e.g., because we are zero-sized) we
|
||||
// still want to provide the intersection rect in order to get the
|
||||
@ -16850,7 +16851,7 @@ static void UpdateEffectsOnBrowsingContext(BrowsingContext* aBc,
|
||||
visibleRect.emplace(*output.mIntersectionRect -
|
||||
output.mTargetRect.TopLeft());
|
||||
}
|
||||
rasterScale = subDocFrame->GetRasterScale();
|
||||
gfx::MatrixScales rasterScale = subDocFrame->GetRasterScale();
|
||||
ParentLayerToScreenScale2D transformToAncestorScale =
|
||||
ParentLayerToParentLayerScale(
|
||||
subDocFrame->PresShell()->GetCumulativeResolution()) *
|
||||
|
@ -1252,13 +1252,6 @@ nsDisplayRemote::nsDisplayRemote(nsDisplayListBuilder* aBuilder,
|
||||
namespace mozilla {
|
||||
|
||||
void nsDisplayRemote::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
|
||||
nsPresContext* pc = mFrame->PresContext();
|
||||
nsFrameLoader* fl = GetFrameLoader();
|
||||
if (pc->GetPrintSettings() && fl->IsRemoteFrame()) {
|
||||
// See the comment below in CreateWebRenderCommands() as for why doing this.
|
||||
fl->UpdatePositionAndSize(static_cast<nsSubDocumentFrame*>(mFrame));
|
||||
}
|
||||
|
||||
DrawTarget* target = aCtx->GetDrawTarget();
|
||||
if (!target->IsRecording() || mPaintData.mTabId == 0) {
|
||||
NS_WARNING("Remote iframe not rendered");
|
||||
@ -1273,7 +1266,8 @@ void nsDisplayRemote::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
|
||||
//
|
||||
// Similarly, rendering the inner document will scale up by the cross process
|
||||
// paint scale again, so we also need to account for that.
|
||||
const int32_t appUnitsPerDevPixel = pc->AppUnitsPerDevPixel();
|
||||
const int32_t appUnitsPerDevPixel =
|
||||
mFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
|
||||
gfxContextMatrixAutoSaveRestore saveMatrix(aCtx);
|
||||
gfxFloat targetAuPerDev =
|
||||
|
@ -742,8 +742,8 @@ nsresult nsPrintJob::ReconstructAndReflow() {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult rv = UpdateSelectionAndShrinkPrintObject(po, documentIsTopLevel);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
po->mDocument->UpdateRemoteFrameEffects();
|
||||
MOZ_TRY(UpdateSelectionAndShrinkPrintObject(po, documentIsTopLevel));
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1421,6 +1421,7 @@ nsresult nsPrintJob::ReflowPrintObject(const UniquePtr<nsPrintObject>& aPO) {
|
||||
}
|
||||
// Process the reflow event Initialize posted
|
||||
presShell->FlushPendingNotifications(FlushType::Layout);
|
||||
aPO->mDocument->UpdateRemoteFrameEffects();
|
||||
|
||||
MOZ_TRY(UpdateSelectionAndShrinkPrintObject(aPO.get(), documentIsTopLevel));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user