diff --git a/mozilla/layout/xul/base/src/nsButtonBoxFrame.cpp b/mozilla/layout/xul/base/src/nsButtonBoxFrame.cpp index ed6546b227b..27a148557e2 100644 --- a/mozilla/layout/xul/base/src/nsButtonBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsButtonBoxFrame.cpp @@ -150,7 +150,7 @@ nsButtonBoxFrame::HandleEvent(nsPresContext* aPresContext, } void -nsButtonBoxFrame::MouseClicked(nsPresContext* aPresContext, nsGUIEvent* aEvent) +nsButtonBoxFrame::DoMouseClick(nsGUIEvent* aEvent, PRBool aTrustEvent) { // Don't execute if we're disabled. nsAutoString disabled; @@ -160,7 +160,7 @@ nsButtonBoxFrame::MouseClicked(nsPresContext* aPresContext, nsGUIEvent* aEvent) // Execute the oncommand event handler. nsEventStatus status = nsEventStatus_eIgnore; - nsMouseEvent event(aEvent ? NS_IS_TRUSTED_EVENT(aEvent) : PR_FALSE, + nsMouseEvent event(aEvent ? NS_IS_TRUSTED_EVENT(aEvent) : aTrustEvent, NS_XUL_COMMAND, nsnull, nsMouseEvent::eReal); if(aEvent) { event.isShift = ((nsInputEvent*)(aEvent))->isShift; @@ -170,7 +170,7 @@ nsButtonBoxFrame::MouseClicked(nsPresContext* aPresContext, nsGUIEvent* aEvent) } // Have the content handle the event, propagating it according to normal DOM rules. - nsIPresShell *shell = aPresContext->GetPresShell(); + nsIPresShell *shell = GetPresContext()->GetPresShell(); if (shell) { shell->HandleDOMEventWithTarget(mContent, &event, &status); // shell may no longer be alive, don't use it here unless you keep a ref diff --git a/mozilla/layout/xul/base/src/nsButtonBoxFrame.h b/mozilla/layout/xul/base/src/nsButtonBoxFrame.h index 7ac253889c5..102472afbf1 100644 --- a/mozilla/layout/xul/base/src/nsButtonBoxFrame.h +++ b/mozilla/layout/xul/base/src/nsButtonBoxFrame.h @@ -57,9 +57,14 @@ public: NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough); - virtual void MouseClicked (nsPresContext* aPresContext, nsGUIEvent* aEvent); - + virtual void MouseClicked (nsPresContext* aPresContext, nsGUIEvent* aEvent) + { DoMouseClick(aEvent, PR_FALSE); } + /** + * Our implementation of MouseClicked. + * @param aTrustEvent if PR_TRUE and aEvent as null, then assume the event was trusted + */ + void DoMouseClick(nsGUIEvent* aEvent, PRBool aTrustEvent); }; // class nsButtonBoxFrame #endif /* nsButtonBoxFrame_h___ */ diff --git a/mozilla/layout/xul/base/src/nsScrollBoxFrame.cpp b/mozilla/layout/xul/base/src/nsScrollBoxFrame.cpp index dc2ae724638..a94610d64f5 100644 --- a/mozilla/layout/xul/base/src/nsScrollBoxFrame.cpp +++ b/mozilla/layout/xul/base/src/nsScrollBoxFrame.cpp @@ -75,15 +75,10 @@ public: nsGUIEvent* aEvent, nsEventStatus* aEventStatus); - NS_IMETHOD Init(nsPresContext* aPresContext, - nsIContent* aContent, - nsIFrame* aParent, - nsStyleContext* aContext, - nsIFrame* aPrevInFlow); - NS_DECL_NSITIMERCALLBACK - nsPresContext* mPresContext; - + +protected: + PRPackedBool mTrustedEvent; }; nsresult @@ -108,17 +103,6 @@ nsAutoRepeatBoxFrame::nsAutoRepeatBoxFrame(nsIPresShell* aPresShell) { } -NS_IMETHODIMP -nsAutoRepeatBoxFrame::Init(nsPresContext* aPresContext, - nsIContent* aContent, - nsIFrame* aParent, - nsStyleContext* aContext, - nsIFrame* aPrevInFlow) -{ - mPresContext = aPresContext; - return nsButtonBoxFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow); -} - NS_INTERFACE_MAP_BEGIN(nsAutoRepeatBoxFrame) NS_INTERFACE_MAP_ENTRY(nsITimerCallback) NS_INTERFACE_MAP_END_INHERITING(nsButtonBoxFrame) @@ -135,13 +119,16 @@ nsAutoRepeatBoxFrame::HandleEvent(nsPresContext* aPresContext, { case NS_MOUSE_ENTER: case NS_MOUSE_ENTER_SYNTH: - nsRepeatService::GetInstance()->Start(this); - break; + nsRepeatService::GetInstance()->Start(this); + mTrustedEvent = NS_IS_TRUSTED_EVENT(aEvent); + break; case NS_MOUSE_EXIT: case NS_MOUSE_EXIT_SYNTH: - nsRepeatService::GetInstance()->Stop(); - break; + nsRepeatService::GetInstance()->Stop(); + // Not really necessary but do this to be safe + mTrustedEvent = PR_FALSE; + break; } return nsButtonBoxFrame::HandleEvent(aPresContext, aEvent, aEventStatus); @@ -150,7 +137,7 @@ nsAutoRepeatBoxFrame::HandleEvent(nsPresContext* aPresContext, NS_IMETHODIMP nsAutoRepeatBoxFrame::Notify(nsITimer *timer) { - MouseClicked(mPresContext, nsnull); + DoMouseClick(nsnull, mTrustedEvent); return NS_OK; }