Bug 758179. Part 1: Flush layout before calling nsFrame::HandlePress/HandleRelease. r=mats

This commit is contained in:
Robert O'Callahan 2012-05-30 01:13:36 +12:00
parent cde3e8ec6a
commit c35029e3ba

View File

@ -462,6 +462,15 @@ public:
virtual void HandleEvent(nsEventChainPostVisitor& aVisitor)
{
if (aVisitor.mPresContext && aVisitor.mEvent->eventStructType != NS_EVENT) {
if (aVisitor.mEvent->message == NS_MOUSE_BUTTON_DOWN ||
aVisitor.mEvent->message == NS_MOUSE_BUTTON_UP) {
// Mouse-up and mouse-down events call nsFrame::HandlePress/Release
// which call GetContentOffsetsFromPoint which requires up-to-date layout.
// Bring layout up-to-date now so that GetCurrentEventFrame() below
// will return a real frame and we don't have to worry about
// destroying it by flushing later.
mPresShell->FlushPendingNotifications(Flush_Layout);
}
nsIFrame* frame = mPresShell->GetCurrentEventFrame();
if (frame) {
frame->HandleEvent(aVisitor.mPresContext,