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
--- 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()) {