Skip to content

Commit

Permalink
Bug 1725267 - Remove unused region from PresShell::Paint. r=tnikkel
Browse files Browse the repository at this point in the history
PaintFrame only uses the input region if !WidgetLayers, which Paint always passes.

Differential Revision: https://phabricator.services.mozilla.com/D125795
  • Loading branch information
mattwoodrow committed Sep 22, 2021
1 parent e8232ec commit 9773c60
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 26 deletions.
3 changes: 1 addition & 2 deletions dom/base/nsDOMWindowUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,7 @@ nsDOMWindowUtils::UpdateLayerTree() {
RefPtr<nsViewManager> vm = presShell->GetViewManager();
if (nsView* view = vm->GetRootView()) {
nsAutoScriptBlocker scriptBlocker;
presShell->Paint(view, view->GetBounds(),
PaintFlags::PaintSyncDecodeImages);
presShell->Paint(view, PaintFlags::PaintSyncDecodeImages);
presShell->GetWindowRenderer()->WaitOnTransactionProcessed();
}
}
Expand Down
2 changes: 1 addition & 1 deletion dom/ipc/BrowserChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2734,7 +2734,7 @@ mozilla::ipc::IPCResult BrowserChild::RecvRenderLayers(
} else {
RefPtr<nsViewManager> vm = presShell->GetViewManager();
if (nsView* view = vm->GetRootView()) {
presShell->Paint(view, view->GetBounds(), PaintFlags::None);
presShell->Paint(view, PaintFlags::None);
}
}
presShell->SuppressDisplayport(false);
Expand Down
5 changes: 2 additions & 3 deletions layout/base/PresShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6263,8 +6263,7 @@ bool PresShell::Composite(nsView* aViewToPaint) {
return false;
}

void PresShell::Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
PaintFlags aFlags) {
void PresShell::Paint(nsView* aViewToPaint, PaintFlags aFlags) {
nsCString url;
nsIURI* uri = mDocument->GetDocumentURI();
Document* contentRoot = GetPrimaryContentDocument();
Expand Down Expand Up @@ -6394,7 +6393,7 @@ void PresShell::Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,

if (frame) {
// We can paint directly into the widget using its layer manager.
nsLayoutUtils::PaintFrame(nullptr, frame, aDirtyRegion, bgcolor,
nsLayoutUtils::PaintFrame(nullptr, frame, nsRegion(), bgcolor,
nsDisplayListBuilderMode::Painting, flags);
return;
}
Expand Down
3 changes: 1 addition & 2 deletions layout/base/PresShell.h
Original file line number Diff line number Diff line change
Expand Up @@ -1266,8 +1266,7 @@ class PresShell final : public nsStubDocumentObserver,
void BackingScaleFactorChanged() { mPresContext->UIResolutionChangedSync(); }

MOZ_CAN_RUN_SCRIPT
void Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
PaintFlags aFlags);
void Paint(nsView* aViewToPaint, PaintFlags aFlags);

bool Composite(nsView* aViewToPaint);

Expand Down
21 changes: 3 additions & 18 deletions view/nsViewManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,22 +286,7 @@ void nsViewManager::Refresh(nsView* aView,
return;
}

// damageRegion is the damaged area, in twips, relative to the view origin
nsRegion damageRegion = aRegion.ToAppUnits(AppUnitsPerDevPixel());

// move region from widget coordinates into view coordinates
damageRegion.MoveBy(-aView->ViewToWidgetOffset());

if (damageRegion.IsEmpty()) {
#ifdef DEBUG_roc
nsRect viewRect = aView->GetDimensions();
nsRect damageRect = damageRegion.GetBounds();
printf_stderr(
"XXX Damage rectangle (%d,%d,%d,%d) does not intersect the widget's "
"view (%d,%d,%d,%d)!\n",
damageRect.x, damageRect.y, damageRect.width, damageRect.height,
viewRect.x, viewRect.y, viewRect.width, viewRect.height);
#endif
if (aRegion.IsEmpty()) {
return;
}

Expand Down Expand Up @@ -340,7 +325,7 @@ void nsViewManager::Refresh(nsView* aView,
// we can remove it and only have the call to Paint for
// FallbackRenderer.
if (!presShell->Composite(aView)) {
presShell->Paint(aView, damageRegion, PaintFlags::PaintComposite);
presShell->Paint(aView, PaintFlags::PaintComposite);
}
}
#ifdef MOZ_DUMP_PAINTING
Expand Down Expand Up @@ -464,7 +449,7 @@ void nsViewManager::ProcessPendingUpdatesPaint(nsIWidget* aWidget) {
}
#endif

presShell->Paint(view, nsRegion(), PaintFlags::None);
presShell->Paint(view, PaintFlags::None);
view->SetForcedRepaint(false);

#ifdef MOZ_DUMP_PAINTING
Expand Down

0 comments on commit 9773c60

Please sign in to comment.