From 536af04afe3b4fad5a2f35f2754dde6b5ba761d5 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Wed, 8 Nov 2017 20:47:18 -0500 Subject: [PATCH] Bug 1415225 - Stop setting the EventRegionsOverride flag on root layers. r=botond,mattwoodrow As with the previous patch, instead of setting the override on the root layer, we set the flag on the nsDisplayListBuilder before building the display list, and the flag automatically forces all event regions display items to use their dispatch-to-content region instead of any other regions. Both the WebRender and non-WebRender codepaths were setting the override flag on their root layers and don't need to any more. MozReview-Commit-ID: KQV3w2nvlgs --HG-- extra : rebase_source : 5be30af2d928117519296ec238eac91139986531 --- gfx/layers/wr/WebRenderCommandBuilder.cpp | 6 ------ layout/base/nsLayoutUtils.cpp | 3 +++ layout/painting/nsDisplayList.cpp | 6 ------ 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/gfx/layers/wr/WebRenderCommandBuilder.cpp b/gfx/layers/wr/WebRenderCommandBuilder.cpp index aed64c29dd2d..de5cd058b48f 100644 --- a/gfx/layers/wr/WebRenderCommandBuilder.cpp +++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp @@ -80,12 +80,6 @@ WebRenderCommandBuilder::BuildWebRenderCommands(wr::DisplayListBuilder& aBuilder // Make a "root" layer data that has everything else as descendants mLayerScrollData.emplace_back(); mLayerScrollData.back().InitializeRoot(mLayerScrollData.size() - 1); - if (aDisplayListBuilder->IsBuildingLayerEventRegions()) { - nsIPresShell* shell = aDisplayListBuilder->RootReferenceFrame()->PresContext()->PresShell(); - if (nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(shell)) { - mLayerScrollData.back().SetEventRegionsOverride(EventRegionsOverride::ForceDispatchToContent); - } - } auto callback = [&aScrollData](FrameMetrics::ViewID aScrollId) -> bool { return aScrollData.HasMetadataFor(aScrollId); }; diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 510ca003f725..8b3384b3086c 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -3781,6 +3781,9 @@ nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame, builder.SetVisibleRect(visibleRect); builder.SetIsBuilding(true); + builder.SetAncestorHasApzAwareEventHandler( + builder.IsBuildingLayerEventRegions() && + nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(presShell)); const bool paintedPreviously = aFrame->HasProperty(nsIFrame::ModifiedFrameList()); diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index e1bcb8461ea8..d80781b3e18b 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -2481,12 +2481,6 @@ already_AddRefed nsDisplayList::PaintRoot(nsDisplayListBuilder* aB 1.0f/containerParameters.mYScale); root->SetScaleToResolution(presShell->ScaleToResolution(), containerParameters.mXScale); - if (aBuilder->IsBuildingLayerEventRegions() && - nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(presShell)) { - root->SetEventRegionsOverride(EventRegionsOverride::ForceDispatchToContent); - } else { - root->SetEventRegionsOverride(EventRegionsOverride::NoOverride); - } auto callback = [root](FrameMetrics::ViewID aScrollId) -> bool { return nsLayoutUtils::ContainsMetricsWithId(root, aScrollId);