Add inactive subframes to the dispatch-to-content region. (bug 1082594, r=tn,kats)

This commit is contained in:
David Anderson 2014-11-19 20:24:15 -08:00
parent 3234ab1f7d
commit 397b1a3520
4 changed files with 24 additions and 15 deletions

View File

@ -402,19 +402,6 @@ APZCTreeManager::PrepareAPZCForLayer(const LayerMetricsWrapper& aLayer,
return apzc;
}
static EventRegions
EventRegionsFor(const LayerMetricsWrapper& aLayer)
{
// This is a workaround for bug 1082594. We should be able to replace this
// with just a call to aLayer.GetEventRegions() once that bug is fixed.
if (aLayer.IsScrollInfoLayer()) {
EventRegions regions(ParentLayerIntRect::ToUntyped(RoundedIn(aLayer.Metrics().mCompositionBounds)));
regions.mDispatchToContentHitRegion = regions.mHitRegion;
return regions;
}
return aLayer.GetEventRegions();
}
AsyncPanZoomController*
APZCTreeManager::UpdatePanZoomControllerTree(TreeBuildingState& aState,
const LayerMetricsWrapper& aLayer,
@ -497,7 +484,7 @@ APZCTreeManager::UpdatePanZoomControllerTree(TreeBuildingState& aState,
// region as we loop backwards through the children.
nsIntRegion childRegion;
if (gfxPrefs::LayoutEventRegionsEnabled()) {
childRegion = EventRegionsFor(child).mHitRegion;
childRegion = child.GetEventRegions().mHitRegion;
} else {
childRegion = child.GetVisibleRegion();
}
@ -531,7 +518,7 @@ APZCTreeManager::UpdatePanZoomControllerTree(TreeBuildingState& aState,
// we count the children as obscuring the parent or not.
EventRegions unobscured;
unobscured.Sub(EventRegionsFor(aLayer), obscured);
unobscured.Sub(aLayer.GetEventRegions(), obscured);
APZCTM_LOG("Picking up unobscured hit region %s from layer %p\n", Stringify(unobscured).c_str(), aLayer.GetLayer());
// Take the hit region of the |aLayer|'s subtree (which has already been

View File

@ -2890,6 +2890,12 @@ nsDisplayLayerEventRegions::AddFrame(nsDisplayListBuilder* aBuilder,
}
}
void
nsDisplayLayerEventRegions::AddInactiveScrollPort(const nsRect& aRect)
{
mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, aRect);
}
nsDisplayCaret::nsDisplayCaret(nsDisplayListBuilder* aBuilder,
nsIFrame* aCaretFrame)
: nsDisplayItem(aBuilder, aCaretFrame)

View File

@ -2583,6 +2583,11 @@ public:
// this layer. aFrame must have the same reference frame as mFrame.
void AddFrame(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame);
// Indicate that an inactive scrollframe's scrollport should be added to the
// dispatch-to-content region, to ensure that APZ lets content create a
// displayport.
void AddInactiveScrollPort(const nsRect& aRect);
const nsRegion& HitRegion() { return mHitRegion; }
const nsRegion& MaybeHitRegion() { return mMaybeHitRegion; }
const nsRegion& DispatchToContentHitRegion() { return mDispatchToContentHitRegion; }

View File

@ -2952,6 +2952,17 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
(!mIsRoot || aBuilder->RootReferenceFrame()->PresContext() != mOuter->PresContext());
}
if (aBuilder->IsPaintingToWindow() &&
!mShouldBuildScrollableLayer &&
shouldBuildLayer)
{
if (nsDisplayLayerEventRegions *eventRegions = aBuilder->GetLayerEventRegions()) {
// Make sure that APZ will dispatch events back to content so we can
// create a displayport for this frame.
eventRegions->AddInactiveScrollPort(mScrollPort + aBuilder->ToReferenceFrame(mOuter));
}
}
mScrollParentID = aBuilder->GetCurrentScrollParentId();
nsDisplayListCollection scrolledContent;