Bug 1449756 - Make DisplayPort suppression PresShell specific and not process global. r=kats

Originally, DisplayPort suppression was a process-global static. This change makes it possible
to control DisplayPort suppression on a per-PresShell basis.

Differential Revision: https://phabricator.services.mozilla.com/D1759
This commit is contained in:
Mike Conley
2018-06-25 21:42:25 +00:00
parent 2824a326f1
commit 1a33d3d8d9
11 changed files with 99 additions and 91 deletions

View File

@@ -877,7 +877,10 @@ GetDisplayPortFromMarginsData(nsIContent* aContent,
// the choosing of the resolution to display-list building time.
ScreenSize alignment;
if (APZCCallbackHelper::IsDisplayportSuppressed()) {
nsIPresShell* presShell = presContext->PresShell();
MOZ_ASSERT(presShell);
if (presShell->IsDisplayportSuppressed()) {
alignment = ScreenSize(1, 1);
} else if (gfxPrefs::LayersTilesEnabled()) {
// Don't align to tiles if they are too large, because we could expand
@@ -1098,10 +1101,21 @@ GetDisplayPortImpl(nsIContent* aContent, nsRect* aResult, float aMultiplier,
return true;
}
bool isDisplayportSuppressed = false;
nsIFrame* frame = aContent->GetPrimaryFrame();
if (frame) {
nsPresContext* presContext = frame->PresContext();
MOZ_ASSERT(presContext);
nsIPresShell* presShell = presContext->PresShell();
MOZ_ASSERT(presShell);
isDisplayportSuppressed = presShell->IsDisplayportSuppressed();
}
nsRect result;
if (rectData) {
result = GetDisplayPortFromRectData(aContent, rectData, aMultiplier);
} else if (APZCCallbackHelper::IsDisplayportSuppressed() ||
} else if (isDisplayportSuppressed ||
nsLayoutUtils::ShouldDisableApzForElement(aContent)) {
DisplayPortMarginsPropertyData noMargins(ScreenMargin(), 1);
result = GetDisplayPortFromMarginsData(aContent, &noMargins, aMultiplier);