Bug 1452111 - Simplify dispatch-to-content regions as well. r?mattwoodrow
We already do this for the maybe-hit regions because on some pages we can get
oodles and oodles of regions and unioning them all takes a long time.
Simplifying the regions speeds this up massively. It should be functionally
correct since the dispatch-to-content region is allowed to overestimate the
actual dispatch-to-content region.
MozReview-Commit-ID: 6Wl5nuVXB7w
--- a/layout/painting/FrameLayerBuilder.cpp
+++ b/layout/painting/FrameLayerBuilder.cpp
@@ -3485,16 +3485,17 @@ void ContainerState::FinishPaintedLayerD
mContainerReferenceFrame,
data->mDispatchToContentHitRegion.GetBounds(),
containingPaintedLayerData->mReferenceFrame);
if (inactiveLayerClip) {
rect = inactiveLayerClip->ApplyNonRoundedIntersection(rect);
}
containingPaintedLayerData->mDispatchToContentHitRegion.Or(
containingPaintedLayerData->mDispatchToContentHitRegion, rect);
+ containingPaintedLayerData->mDispatchToContentHitRegion.SimplifyOutward(8);
if (data->mDTCRequiresTargetConfirmation) {
containingPaintedLayerData->mDTCRequiresTargetConfirmation = true;
}
}
if (!data->mMaybeHitRegion.GetBounds().IsEmpty()) {
nsRect rect = nsLayoutUtils::TransformFrameRectToAncestor(
mContainerReferenceFrame,
data->mMaybeHitRegion.GetBounds(),
@@ -3812,16 +3813,17 @@ PaintedLayerData::AccumulateEventRegions
mVerticalPanRegion.OrWith(aEventRegions->VerticalPanRegion());
if (alreadyHadRegions) {
mDispatchToContentHitRegion.OrWith(CombinedTouchActionRegion());
}
// Avoid quadratic performance as a result of the region growing to include
// and arbitrarily large number of rects, which can happen on some pages.
mMaybeHitRegion.SimplifyOutward(8);
+ mDispatchToContentHitRegion.SimplifyOutward(8);
// Calculate scaled versions of the bounds of mHitRegion and mMaybeHitRegion
// for quick access in FindPaintedLayerFor().
mScaledHitRegionBounds = aState->ScaleToOutsidePixels(mHitRegion.GetBounds());
mScaledMaybeHitRegionBounds = aState->ScaleToOutsidePixels(mMaybeHitRegion.GetBounds());
}
void
@@ -3916,16 +3918,17 @@ PaintedLayerData::AccumulateHitTestInfo(
if (alreadyHadRegions > 1) {
mDispatchToContentHitRegion.OrWith(CombinedTouchActionRegion());
}
// Avoid quadratic performance as a result of the region growing to include
// and arbitrarily large number of rects, which can happen on some pages.
mMaybeHitRegion.SimplifyOutward(8);
+ mDispatchToContentHitRegion.SimplifyOutward(8);
// Calculate scaled versions of the bounds of mHitRegion and mMaybeHitRegion
// for quick access in FindPaintedLayerFor().
mScaledHitRegionBounds =
aState->ScaleToOutsidePixels(mHitRegion.GetBounds());
mScaledMaybeHitRegionBounds =
aState->ScaleToOutsidePixels(mMaybeHitRegion.GetBounds());
}