From b0abc39b829b8936c7eeaa0eb8d9c795f53f6321 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Mon, 18 Oct 2021 07:48:11 +0000 Subject: [PATCH] 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 --- layout/base/DisplayPortUtils.cpp | 12 +++--------- layout/base/DisplayPortUtils.h | 17 ----------------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/layout/base/DisplayPortUtils.cpp b/layout/base/DisplayPortUtils.cpp index 7e75999805f7..c6d504987798 100644 --- a/layout/base/DisplayPortUtils.cpp +++ b/layout/base/DisplayPortUtils.cpp @@ -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( diff --git a/layout/base/DisplayPortUtils.h b/layout/base/DisplayPortUtils.h index 9de9e31c5a78..b3394810be44 100644 --- a/layout/base/DisplayPortUtils.h +++ b/layout/base/DisplayPortUtils.h @@ -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;