Bug 1424782 - Ensure nsDisplayEventReceiver is only created when building the display list for hit-testing. r?mattwoodrow
MozReview-Commit-ID: 1c14siwpzYB
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -4325,16 +4325,17 @@ public:
/**
* A class that lets you receive events within the frame bounds but never paints.
*/
class nsDisplayEventReceiver : public nsDisplayItem {
public:
nsDisplayEventReceiver(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayEventReceiver);
+ MOZ_ASSERT(aBuilder->IsForEventDelivery());
}
#ifdef NS_BUILD_REFCNT_LOGGING
virtual ~nsDisplayEventReceiver() {
MOZ_COUNT_DTOR(nsDisplayEventReceiver);
}
#endif
void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
--- a/layout/xul/nsSplitterFrame.cpp
+++ b/layout/xul/nsSplitterFrame.cpp
@@ -366,17 +366,17 @@ nsSplitterFrame::HandleRelease(nsPresCon
void
nsSplitterFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists)
{
nsBoxFrame::BuildDisplayList(aBuilder, aLists);
// if the mouse is captured always return us as the frame.
- if (mInner->mDragging)
+ if (mInner->mDragging && aBuilder->IsForEventDelivery())
{
// XXX It's probably better not to check visibility here, right?
aLists.Outlines()->AppendNewToTop(new (aBuilder)
nsDisplayEventReceiver(aBuilder, this));
return;
}
}