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()) {