Bug 1371508 - Simplify the dispatch-to-content region in nsDisplayLayerEventRegions::AddFrame() and AddInactiveScrollPort() if it starts to get large. r=tnikkel draft
authorBotond Ballo <botond@mozilla.com>
Wed, 14 Jun 2017 20:19:21 -0400
changeset 594359 55d37333f944a52f6214741870b9e6455e345784
parent 590317 a49112c7a5765802096b3fc298069b9495436107
child 633412 d868f471d8361210ad85788aabd07fb86c47f57c
push id64017
push userbballo@mozilla.com
push dateThu, 15 Jun 2017 00:20:33 +0000
reviewerstnikkel
bugs1371508
milestone55.0a1
Bug 1371508 - Simplify the dispatch-to-content region in nsDisplayLayerEventRegions::AddFrame() and AddInactiveScrollPort() if it starts to get large. r=tnikkel MozReview-Commit-ID: C7TCVlxsOFd
layout/painting/nsDisplayList.cpp
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -4434,22 +4434,24 @@ nsDisplayLayerEventRegions::AddFrame(nsD
       aBuilder->GetAncestorHasApzAwareEventHandler())
   {
     // Scrollbars may be painted into a layer below the actual layer they will
     // scroll, and therefore wheel events may be dispatched to the outer frame
     // instead of the intended scrollframe. To address this, we force a d-t-c
     // region on scrollbar frames that won't be placed in their own layer. See
     // bug 1213324 for details.
     mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, borderBox);
+    mDispatchToContentHitRegion.SimplifyOutward(8);
   } else if (aFrame->IsObjectFrame()) {
     // If the frame is a plugin frame and wants to handle wheel events as
     // default action, we should add the frame to dispatch-to-content region.
     nsPluginFrame* pluginFrame = do_QueryFrame(aFrame);
     if (pluginFrame && pluginFrame->WantsToHandleWheelEventAsDefaultAction()) {
       mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, borderBox);
+      mDispatchToContentHitRegion.SimplifyOutward(8);
     }
   }
 
   // Touch action region
 
   nsIFrame* touchActionFrame = aFrame;
   nsIScrollableFrame* scrollFrame = nsLayoutUtils::GetScrollableFrameFor(aFrame);
   if (scrollFrame) {
@@ -4476,25 +4478,27 @@ nsDisplayLayerEventRegions::AddFrame(nsD
         mHorizontalPanRegion.OrWith(borderBox);
       }
       if ((touchAction & NS_STYLE_TOUCH_ACTION_PAN_Y)) {
         mVerticalPanRegion.OrWith(borderBox);
       }
     }
     if (alreadyHadRegions) {
       mDispatchToContentHitRegion.OrWith(CombinedTouchActionRegion());
+      mDispatchToContentHitRegion.SimplifyOutward(8);
     }
   }
 }
 
 void
 nsDisplayLayerEventRegions::AddInactiveScrollPort(const nsRect& aRect)
 {
   mHitRegion.Or(mHitRegion, aRect);
   mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, aRect);
+  mDispatchToContentHitRegion.SimplifyOutward(8);
 }
 
 bool
 nsDisplayLayerEventRegions::IsEmpty() const
 {
   // If the hit region and maybe-hit region are empty, then the rest
   // must be empty too.
   if (mHitRegion.IsEmpty() && mMaybeHitRegion.IsEmpty()) {