Bug 1452111 - Simplify dispatch-to-content regions as well. r?mattwoodrow draft
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 13 Apr 2018 12:51:59 -0400
changeset 781782 50ec592b678e21d67966b27e647750b49708ae35
parent 781781 f38a91679fbb75103caa12af07a1b30914c86963
push id106412
push userkgupta@mozilla.com
push dateFri, 13 Apr 2018 16:52:27 +0000
reviewersmattwoodrow
bugs1452111
milestone61.0a1
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
layout/painting/FrameLayerBuilder.cpp
--- 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());
 }