Bug 1319560 Part 3: Change nsDisplayList::HitTest to exit early when HitTestShouldStopAtFirstOpaque() is true.
MozReview-Commit-ID: D8aKGX6z2TV
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -2213,16 +2213,23 @@ void nsDisplayList::HitTest(nsDisplayLis
for (uint32_t j = 0; j < outFrames.Length(); j++) {
nsIFrame *f = outFrames.ElementAt(j);
// Handle the XUL 'mousethrough' feature and 'pointer-events'.
if (!GetMouseThrough(f) && IsFrameReceivingPointerEvents(f)) {
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.
FlushFramesArray(temp, aOutFrames);
NS_ASSERTION(aState->mItemBuffer.Length() == uint32_t(itemBufferStart),
"How did we forget to pop some elements?");
}