Bug 1927375. Optimize relatively slow IsFixedPosFrameInDisplayPort call in OutOfFlowDisplayData::ComputeVisibleRectForFrame. r=gfx-reviewers,aosmond

IsFixedPosFrameInDisplayPort is relatively slow here taking basically all of the time in evaluating this if condition, the other ones are just checking bools basically. This is a good opportunity for optimization because IsPaintingToWindow is false relatively often (for hit testing and drawing svg iamges) and inPartialUpdate is also false relatively often.

Differential Revision: https://phabricator.services.mozilla.com/D227003
This commit is contained in:
Timothy Nikkel
2024-10-28 21:37:48 +00:00
parent 100a10aac9
commit c3db6fcc5f

View File

@@ -505,9 +505,9 @@ nsRect nsDisplayListBuilder::OutOfFlowDisplayData::ComputeVisibleRectForFrame(
bool inPartialUpdate =
aBuilder->IsRetainingDisplayList() && aBuilder->IsPartialUpdate();
if (StaticPrefs::apz_allow_zooming() &&
DisplayPortUtils::IsFixedPosFrameInDisplayPort(aFrame) &&
aBuilder->IsPaintingToWindow() && !inPartialUpdate) {
if (MOZ_LIKELY(StaticPrefs::apz_allow_zooming()) &&
aBuilder->IsPaintingToWindow() && !inPartialUpdate &&
DisplayPortUtils::IsFixedPosFrameInDisplayPort(aFrame)) {
dirtyRectRelativeToDirtyFrame =
nsRect(nsPoint(0, 0), aFrame->GetParent()->GetSize());