Bug 1365333 - Avoid quadratic performance in nsDisplayLayerEventRegions::AddFrame() when the maybe-hit region has many rects. r=tnikkel
authorBotond Ballo <botond@mozilla.com>
Wed, 31 May 2017 14:42:59 -0400
changeset 409797 44c831aee2d0dc9a96c7a3f792420d9af0998b65
parent 409796 c0db7825ec5b09c128924ae1f9b1e4186430f512
child 409798 27e39a0dead1a034e2bbc08fa6e88e2840fc15b8
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs1365333
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1365333 - Avoid quadratic performance in nsDisplayLayerEventRegions::AddFrame() when the maybe-hit region has many rects. r=tnikkel MozReview-Commit-ID: 99QrhFpHw15
layout/painting/nsDisplayList.cpp
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -4417,16 +4417,20 @@ nsDisplayLayerEventRegions::AddFrame(nsD
     if (clip->GetRoundedRectCount() > 0) {
       borderBoxHasRoundedCorners = true;
     }
   }
 
   if (borderBoxHasRoundedCorners ||
       (aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT)) {
     mMaybeHitRegion.Or(mMaybeHitRegion, borderBox);
+
+    // Avoid quadratic performance as a result of the region growing to include
+    // an arbitrarily large number of rects, which can happen on some pages.
+    mMaybeHitRegion.SimplifyOutward(8);
   } else {
     mHitRegion.Or(mHitRegion, borderBox);
   }
 
   if (aBuilder->IsBuildingNonLayerizedScrollbar() ||
       aBuilder->GetAncestorHasApzAwareEventHandler())
   {
     // Scrollbars may be painted into a layer below the actual layer they will