Bug 1734478. Remove MaxSizeExceededBehaviour from displayport getter options as it is unused. r=botond

The reason that GetDisplayPortForVisibilityTesting was using Drop was because there is a test that sets a 10x zoom and we ran image visibility without updating the displayport base rect (painting would update it), so the returned displayport was based on the much larger base rect. The patches goal was to avoid the assert we removed. Using a displayport that large in that situation for image visibility seems fine because it shouldn't make us decode any more images then were previously already visible.

Depends on D127731

Differential Revision: https://phabricator.services.mozilla.com/D127732
This commit is contained in:
Timothy Nikkel 2021-10-18 07:48:11 +00:00
Родитель fcb5f0e008
Коммит b0abc39b82
2 изменённых файлов: 3 добавлений и 26 удалений

Просмотреть файл

@ -555,15 +555,9 @@ bool DisplayPortUtils::HasNonMinimalNonZeroDisplayPort(nsIContent* aContent) {
bool DisplayPortUtils::GetDisplayPortForVisibilityTesting(nsIContent* aContent,
nsRect* aResult) {
MOZ_ASSERT(aResult);
// Since the base rect might not have been updated very recently, it's
// possible to end up with an extra-large displayport at this point, if the
// zoom level is changed by a lot. Instead of using the default behaviour of
// asserting, we can just ignore the displayport if that happens, as this
// call site is best-effort.
return GetDisplayPortImpl(aContent, aResult, 1.0f,
DisplayPortOptions()
.With(MaxSizeExceededBehaviour::Drop)
.With(DisplayportRelativeTo::ScrollFrame));
return GetDisplayPortImpl(
aContent, aResult, 1.0f,
DisplayPortOptions().With(DisplayportRelativeTo::ScrollFrame));
}
void DisplayPortUtils::InvalidateForDisplayPortChange(

Просмотреть файл

@ -26,23 +26,12 @@ class PresShell;
// For GetDisplayPort
enum class DisplayportRelativeTo { ScrollPort, ScrollFrame };
enum class MaxSizeExceededBehaviour {
// Ask GetDisplayPort to assert if the calculated displayport exceeds
// the maximum allowed size.
Assert,
// Ask GetDisplayPort to pretend like there's no displayport at all, if
// the calculated displayport exceeds the maximum allowed size.
Drop,
};
// Is the displayport being applied to scrolled content or fixed content?
enum class ContentGeometryType { Scrolled, Fixed };
struct DisplayPortOptions {
// The default options.
DisplayportRelativeTo mRelativeTo = DisplayportRelativeTo::ScrollPort;
MaxSizeExceededBehaviour mMaxSizeExceededBehaviour =
MaxSizeExceededBehaviour::Assert;
ContentGeometryType mGeometryType = ContentGeometryType::Scrolled;
// Fluent interface for changing the defaults.
@ -51,12 +40,6 @@ struct DisplayPortOptions {
result.mRelativeTo = aRelativeTo;
return result;
}
DisplayPortOptions With(
MaxSizeExceededBehaviour aMaxSizeExceededBehaviour) const {
DisplayPortOptions result = *this;
result.mMaxSizeExceededBehaviour = aMaxSizeExceededBehaviour;
return result;
}
DisplayPortOptions With(ContentGeometryType aGeometryType) const {
DisplayPortOptions result = *this;
result.mGeometryType = aGeometryType;