Bug 1363423 - Prevent the maybe-hit region from growing too large (in terms of number of rectangles) in PaintedLayerData::AccumulateEventRegions(). r=jrmuizel
MozReview-Commit-ID: E7Pco25mlBc
--- a/layout/painting/FrameLayerBuilder.cpp
+++ b/layout/painting/FrameLayerBuilder.cpp
@@ -3592,16 +3592,20 @@ PaintedLayerData::AccumulateEventRegions
!mVerticalPanRegion.IsEmpty();
mNoActionRegion.OrWith(aEventRegions->NoActionRegion());
mHorizontalPanRegion.OrWith(aEventRegions->HorizontalPanRegion());
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);
+
// 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());
}
PaintedLayerData
ContainerState::NewPaintedLayerData(nsDisplayItem* aItem,