Bug 1691160. Make MaybeCreateDisplayPortInFirstScrollFrameEncountered consider a zero margin display a not having a display port so it sets one. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D104359
This commit is contained in:
Timothy Nikkel 2021-02-09 01:41:00 +00:00
parent c72349ac1a
commit 12fb741116
2 changed files with 33 additions and 1 deletions

View File

@ -635,6 +635,32 @@ bool DisplayPortUtils::HasNonMinimalDisplayPort(nsIContent* aContent) {
!aContent->GetProperty(nsGkAtoms::MinimalDisplayPort);
}
bool DisplayPortUtils::HasNonMinimalNonZeroDisplayPort(nsIContent* aContent) {
if (!HasDisplayPort(aContent)) {
return false;
}
if (aContent->GetProperty(nsGkAtoms::MinimalDisplayPort)) {
return false;
}
DisplayPortMarginsPropertyData* currentData =
static_cast<DisplayPortMarginsPropertyData*>(
aContent->GetProperty(nsGkAtoms::DisplayPortMargins));
if (!currentData) {
// We have a display port, so if we don't have margin data we must have rect
// data. We consider such as non zero and non minimal, it's probably not too
// important as display port rects are only used in tests.
return true;
}
if (currentData->mMargins.mMargins != ScreenMargin()) {
return true;
}
return false;
}
/* static */
bool DisplayPortUtils::GetDisplayPortForVisibilityTesting(nsIContent* aContent,
nsRect* aResult) {
@ -948,7 +974,7 @@ bool DisplayPortUtils::MaybeCreateDisplayPort(nsDisplayListBuilder* aBuilder,
return false;
}
bool haveDisplayPort = HasNonMinimalDisplayPort(content);
bool haveDisplayPort = HasNonMinimalNonZeroDisplayPort(content);
// We perform an optimization where we ensure that at least one
// async-scrollable frame (i.e. one that WantsAsyncScroll()) has a

View File

@ -185,6 +185,12 @@ class DisplayPortUtils {
*/
static bool HasNonMinimalDisplayPort(nsIContent* aContent);
/**
* Check whether the given element has a non-minimal displayport that also has
* non-zero margins. A display port rect is considered non-minimal non-zero.
*/
static bool HasNonMinimalNonZeroDisplayPort(nsIContent* aContent);
/**
* Check if the given element has a margins based displayport but is missing a
* displayport base rect that it needs to properly compute a displayport rect.