From bffacaf61caca936ae7b32a9186a55478531d926 Mon Sep 17 00:00:00 2001 From: Brad Werth Date: Mon, 28 Nov 2016 13:22:15 -0800 Subject: [PATCH] Bug 1319560 Part 3: Change nsDisplayList::HitTest to exit early when HitTestShouldStopAtFirstOpaque() is true. r=mattwoodrow MozReview-Commit-ID: D8aKGX6z2TV --HG-- extra : rebase_source : 8a698f3ab58cd571c58d346e8ad2fcc3b0eef4c7 --- layout/painting/nsDisplayList.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 6a8bb17c90c2..bca5f1228a75 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -2218,6 +2218,13 @@ void nsDisplayList::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect, writeFrames->AppendElement(f); } } + + if (aBuilder->HitTestShouldStopAtFirstOpaque() && + item->GetOpaqueRegion(aBuilder, &snap).Contains(aRect)) { + // We're exiting early, so pop the remaining items off the buffer. + aState->mItemBuffer.SetLength(itemBufferStart); + break; + } } } // Clear any remaining preserve-3d transforms.