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: 1cz0ahqwkOm
--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp
+++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ -75,22 +75,16 @@ WebRenderCommandBuilder::BuildWebRenderC
StackingContextHelper pageRootSc(sc, aBuilder);
CreateWebRenderCommandsFromDisplayList(aDisplayList, aDisplayListBuilder,
pageRootSc, aBuilder, aResourceUpdates);
}
// 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()->PresShell();
- if (nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(shell)) {
- mLayerScrollData.back().SetEventRegionsOverride(EventRegionsOverride::ForceDispatchToContent);
- }
- }
auto callback = [&aScrollData](FrameMetrics::ViewID aScrollId) -> bool {
return aScrollData.HasMetadataFor(aScrollId);
};
if (Maybe<ScrollMetadata> rootMetadata = nsLayoutUtils::GetRootMetadata(
aDisplayListBuilder, mManager, ContainerLayerParameters(), callback)) {
mLayerScrollData.back().AppendScrollMetadata(aScrollData, rootMetadata.ref());
}
// Append the WebRenderLayerScrollData items into WebRenderScrollData
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -3775,16 +3775,19 @@ nsLayoutUtils::PaintFrame(gfxContext* aR
id = nsLayoutUtils::FindOrCreateIDFor(element);
}
}
nsDisplayListBuilder::AutoCurrentScrollParentIdSetter idSetter(&builder, id);
builder.SetVisibleRect(visibleRect);
builder.SetIsBuilding(true);
+ builder.SetAncestorHasApzAwareEventHandler(
+ builder.IsBuildingLayerEventRegions() &&
+ nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(presShell));
const bool paintedPreviously =
aFrame->HasProperty(nsIFrame::ModifiedFrameList());
// Attempt to do a partial build and merge into the existing list.
// This calls BuildDisplayListForStacking context on a subset of the
// viewport.
bool merged = false;
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -2476,22 +2476,16 @@ already_AddRefed<LayerManager> nsDisplay
layerManager->SetUserData(&gLayerManagerLayerBuilder, oldBuilder);
return nullptr;
}
// Root is being scaled up by the X/Y resolution. Scale it back down.
root->SetPostScale(1.0f/containerParameters.mXScale,
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);
};
if (Maybe<ScrollMetadata> rootMetadata = nsLayoutUtils::GetRootMetadata(
aBuilder, root->Manager(), containerParameters, callback)) {
root->SetScrollMetadata(rootMetadata.value());
}