From fe0adb47d6b0ce38e87b1cf220f92037424fb9b2 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Wed, 20 Nov 2024 08:18:42 +0000 Subject: [PATCH] Bug 1931798. Only check for apz listeners when building compositor hit test info. r=gfx-reviewers,nical The info that we get from the check is only used for compositor hit test info and it takes a decent amount of time to check. Differential Revision: https://phabricator.services.mozilla.com/D229290 --- layout/generic/nsSubDocumentFrame.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/layout/generic/nsSubDocumentFrame.cpp b/layout/generic/nsSubDocumentFrame.cpp index 0f5ccb53b9e3..cc89676cedd6 100644 --- a/layout/generic/nsSubDocumentFrame.cpp +++ b/layout/generic/nsSubDocumentFrame.cpp @@ -467,12 +467,16 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, visible, dirty); if (subdocRootFrame) { - bool hasDocumentLevelListenersForApzAwareEvents = - gfxPlatform::AsyncPanZoomEnabled() && - nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(presShell); + if (aBuilder->BuildCompositorHitTestInfo()) { + bool hasDocumentLevelListenersForApzAwareEvents = + gfxPlatform::AsyncPanZoomEnabled() && + nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents( + presShell); + + aBuilder->SetAncestorHasApzAwareEventHandler( + hasDocumentLevelListenersForApzAwareEvents); + } - aBuilder->SetAncestorHasApzAwareEventHandler( - hasDocumentLevelListenersForApzAwareEvents); subdocRootFrame->BuildDisplayListForStackingContext(aBuilder, &childItems); if (!aBuilder->IsForEventDelivery()) {