diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 695395f7898d..9aa277a58825 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -3948,9 +3948,7 @@ nsContentUtils::GetNativeEvent(nsIDOMEvent* aDOMEvent) nsCOMPtr privateEvent(do_QueryInterface(aDOMEvent)); if (!privateEvent) return nsnull; - nsEvent* nativeEvent; - privateEvent->GetInternalNSEvent(&nativeEvent); - return nativeEvent; + return privateEvent->GetInternalNSEvent(); } //static diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index df275ff63b8b..585d00a5646d 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -3873,8 +3873,7 @@ nsDocument::DispatchContentLoadedEvents() // the ancestor document if we used the normal event // dispatching code. - nsEvent* innerEvent; - privateEvent->GetInternalNSEvent(&innerEvent); + nsEvent* innerEvent = privateEvent->GetInternalNSEvent(); if (innerEvent) { nsEventStatus status = nsEventStatus_eIgnore; diff --git a/content/base/src/nsXMLHttpRequest.h b/content/base/src/nsXMLHttpRequest.h index f05ed4d8e950..bd9e03ffe7b4 100644 --- a/content/base/src/nsXMLHttpRequest.h +++ b/content/base/src/nsXMLHttpRequest.h @@ -487,17 +487,17 @@ public: { return mInner->SetOriginalTarget(aTarget); } - NS_IMETHOD IsDispatchStopped(PRBool* aIsDispatchPrevented) + NS_IMETHOD_(PRBool) IsDispatchStopped() { - return mInner->IsDispatchStopped(aIsDispatchPrevented); + return mInner->IsDispatchStopped(); } - NS_IMETHOD GetInternalNSEvent(nsEvent** aNSEvent) + NS_IMETHOD_(nsEvent*) GetInternalNSEvent() { - return mInner->GetInternalNSEvent(aNSEvent); + return mInner->GetInternalNSEvent(); } - NS_IMETHOD HasOriginalTarget(PRBool* aResult) + NS_IMETHOD_(PRBool) HasOriginalTarget() { - return mInner->HasOriginalTarget(aResult); + return mInner->HasOriginalTarget(); } NS_IMETHOD SetTrusted(PRBool aTrusted) { diff --git a/content/events/public/nsIPrivateDOMEvent.h b/content/events/public/nsIPrivateDOMEvent.h index e0f2a5aca4d6..ea99e24c6670 100644 --- a/content/events/public/nsIPrivateDOMEvent.h +++ b/content/events/public/nsIPrivateDOMEvent.h @@ -64,10 +64,10 @@ public: NS_IMETHOD SetTarget(nsIDOMEventTarget* aTarget) = 0; NS_IMETHOD SetCurrentTarget(nsIDOMEventTarget* aTarget) = 0; NS_IMETHOD SetOriginalTarget(nsIDOMEventTarget* aTarget) = 0; - NS_IMETHOD IsDispatchStopped(PRBool* aIsDispatchPrevented) = 0; - NS_IMETHOD GetInternalNSEvent(nsEvent** aNSEvent) = 0; - NS_IMETHOD HasOriginalTarget(PRBool* aResult)=0; - NS_IMETHOD SetTrusted(PRBool aTrusted)=0; + NS_IMETHOD_(PRBool) IsDispatchStopped() = 0; + NS_IMETHOD_(nsEvent*) GetInternalNSEvent() = 0; + NS_IMETHOD_(PRBool) HasOriginalTarget() = 0; + NS_IMETHOD SetTrusted(PRBool aTrusted) = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIPrivateDOMEvent, NS_IPRIVATEDOMEVENT_IID) diff --git a/content/events/src/nsDOMEvent.cpp b/content/events/src/nsDOMEvent.cpp index 34b1acc5a25a..e2fccefb371b 100644 --- a/content/events/src/nsDOMEvent.cpp +++ b/content/events/src/nsDOMEvent.cpp @@ -328,11 +328,10 @@ nsDOMEvent::GetOriginalTarget(nsIDOMEventTarget** aOriginalTarget) return GetTarget(aOriginalTarget); } -NS_IMETHODIMP -nsDOMEvent::HasOriginalTarget(PRBool* aResult) +NS_IMETHODIMP_(PRBool) +nsDOMEvent::HasOriginalTarget() { - *aResult = !!(mEvent->originalTarget); - return NS_OK; + return !!mEvent->originalTarget; } NS_IMETHODIMP @@ -1052,23 +1051,16 @@ NS_METHOD nsDOMEvent::SetOriginalTarget(nsIDOMEventTarget* aOriginalTarget) return NS_OK; } -NS_IMETHODIMP -nsDOMEvent::IsDispatchStopped(PRBool* aIsDispatchStopped) +NS_IMETHODIMP_(PRBool) +nsDOMEvent::IsDispatchStopped() { - if (mEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH) { - *aIsDispatchStopped = PR_TRUE; - } else { - *aIsDispatchStopped = PR_FALSE; - } - return NS_OK; + return !!(mEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH); } -NS_IMETHODIMP -nsDOMEvent::GetInternalNSEvent(nsEvent** aNSEvent) +NS_IMETHODIMP_(nsEvent*) +nsDOMEvent::GetInternalNSEvent() { - NS_ENSURE_ARG_POINTER(aNSEvent); - *aNSEvent = mEvent; - return NS_OK; + return mEvent; } // return true if eventName is contained within events, delimited by diff --git a/content/events/src/nsDOMEvent.h b/content/events/src/nsDOMEvent.h index 8aa1e6f75dc4..da280990133d 100644 --- a/content/events/src/nsDOMEvent.h +++ b/content/events/src/nsDOMEvent.h @@ -181,9 +181,9 @@ public: NS_IMETHOD SetTarget(nsIDOMEventTarget* aTarget); NS_IMETHOD SetCurrentTarget(nsIDOMEventTarget* aCurrentTarget); NS_IMETHOD SetOriginalTarget(nsIDOMEventTarget* aOriginalTarget); - NS_IMETHOD IsDispatchStopped(PRBool* aIsDispatchStopped); - NS_IMETHOD GetInternalNSEvent(nsEvent** aNSEvent); - NS_IMETHOD HasOriginalTarget(PRBool* aResult); + NS_IMETHOD_(PRBool) IsDispatchStopped(); + NS_IMETHOD_(nsEvent*) GetInternalNSEvent(); + NS_IMETHOD_(PRBool) HasOriginalTarget(); NS_IMETHOD SetTrusted(PRBool aTrusted); static PopupControlState GetEventPopupControlState(nsEvent *aEvent); diff --git a/content/events/src/nsEventDispatcher.cpp b/content/events/src/nsEventDispatcher.cpp index 20e736d758f8..1539db8f36d6 100644 --- a/content/events/src/nsEventDispatcher.cpp +++ b/content/events/src/nsEventDispatcher.cpp @@ -416,8 +416,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget, if (aDOMEvent) { nsCOMPtr privEvt(do_QueryInterface(aDOMEvent)); if (privEvt) { - nsEvent* innerEvent = nsnull; - privEvt->GetInternalNSEvent(&innerEvent); + nsEvent* innerEvent = privEvt->GetInternalNSEvent(); NS_ASSERTION(innerEvent == aEvent, "The inner event of aDOMEvent is not the same as aEvent!"); } @@ -555,8 +554,7 @@ nsEventDispatcher::DispatchDOMEvent(nsISupports* aTarget, if (aDOMEvent) { nsCOMPtr privEvt(do_QueryInterface(aDOMEvent)); if (privEvt) { - nsEvent* innerEvent = nsnull; - privEvt->GetInternalNSEvent(&innerEvent); + nsEvent* innerEvent = privEvt->GetInternalNSEvent(); NS_ENSURE_TRUE(innerEvent, NS_ERROR_ILLEGAL_VALUE); PRBool dontResetTrusted = PR_FALSE; diff --git a/content/xbl/src/nsXBLPrototypeHandler.cpp b/content/xbl/src/nsXBLPrototypeHandler.cpp index 022ec6b9e3c7..fe9807fb7583 100644 --- a/content/xbl/src/nsXBLPrototypeHandler.cpp +++ b/content/xbl/src/nsXBLPrototypeHandler.cpp @@ -404,8 +404,7 @@ nsXBLPrototypeHandler::DispatchXBLCommand(nsPIDOMEventTarget* aTarget, nsIDOMEve nsCOMPtr privateEvent = do_QueryInterface(aEvent); if (privateEvent) { - PRBool dispatchStopped; - privateEvent->IsDispatchStopped(&dispatchStopped); + PRBool dispatchStopped = privateEvent->IsDispatchStopped(); if (dispatchStopped) return NS_OK; } diff --git a/content/xbl/src/nsXBLWindowKeyHandler.cpp b/content/xbl/src/nsXBLWindowKeyHandler.cpp index 8d5a30f746c2..f11da9caa5f2 100644 --- a/content/xbl/src/nsXBLWindowKeyHandler.cpp +++ b/content/xbl/src/nsXBLWindowKeyHandler.cpp @@ -519,8 +519,7 @@ nsXBLWindowKeyHandler::WalkHandlersAndExecute(nsIDOMKeyEvent* aKeyEvent, // Try all of the handlers until we find one that matches the event. for (nsXBLPrototypeHandler *currHandler = aHandler; currHandler; currHandler = currHandler->GetNextHandler()) { - PRBool stopped; - privateEvent->IsDispatchStopped(&stopped); + PRBool stopped = privateEvent->IsDispatchStopped(); if (stopped) { // The event is finished, don't execute any more handlers return NS_OK; diff --git a/dom/src/base/nsGlobalWindow.cpp b/dom/src/base/nsGlobalWindow.cpp index cd3a07d40fdc..c8da60c1fd87 100644 --- a/dom/src/base/nsGlobalWindow.cpp +++ b/dom/src/base/nsGlobalWindow.cpp @@ -5201,10 +5201,9 @@ PostMessageEvent::Run() if (shell) presContext = shell->GetPresContext(); - nsEvent* internalEvent; nsCOMPtr privEvent = do_QueryInterface(message); privEvent->SetTrusted(mTrustedCaller); - privEvent->GetInternalNSEvent(&internalEvent); + nsEvent *internalEvent = privEvent->GetInternalNSEvent(); nsEventStatus status = nsEventStatus_eIgnore; nsEventDispatcher::Dispatch(static_cast(mTargetWindow), diff --git a/dom/src/events/nsJSEventListener.cpp b/dom/src/events/nsJSEventListener.cpp index 06fed234bb5e..5d8cd234a073 100644 --- a/dom/src/events/nsJSEventListener.cpp +++ b/dom/src/events/nsJSEventListener.cpp @@ -183,8 +183,7 @@ nsJSEventListener::HandleEvent(nsIDOMEvent* aEvent) nsCOMPtr priv(do_QueryInterface(aEvent)); NS_ENSURE_TRUE(priv, NS_ERROR_UNEXPECTED); - nsEvent* event; - priv->GetInternalNSEvent(&event); + nsEvent *event = priv->GetInternalNSEvent(); if (event->message == NS_LOAD_ERROR && event->eventStructType == NS_SCRIPT_ERROR_EVENT) { nsScriptErrorEvent *scriptEvent = @@ -255,8 +254,7 @@ nsJSEventListener::HandleEvent(nsIDOMEvent* aEvent) nsCOMPtr priv(do_QueryInterface(aEvent)); NS_ENSURE_TRUE(priv, NS_ERROR_UNEXPECTED); - nsEvent* event; - priv->GetInternalNSEvent(&event); + nsEvent *event = priv->GetInternalNSEvent(); NS_ENSURE_TRUE(event && event->message == NS_BEFORE_PAGE_UNLOAD, NS_ERROR_UNEXPECTED); diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 8c3eab00b7f7..8e49a48a328a 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -621,9 +621,8 @@ nsLayoutUtils::GetDOMEventCoordinatesRelativeTo(nsIDOMEvent* aDOMEvent, nsIFrame NS_ASSERTION(privateEvent, "bad implementation"); if (!privateEvent) return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE); - nsEvent* event; - nsresult rv = privateEvent->GetInternalNSEvent(&event); - if (NS_FAILED(rv)) + nsEvent *event = privateEvent->GetInternalNSEvent(); + if (!event) return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE); return GetEventCoordinatesRelativeTo(event, aFrame); } diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index 8926e6997769..b63bd2594937 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -2010,7 +2010,7 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent) // so the right thing happens for the onclick event nsCOMPtr privateEvent(do_QueryInterface(aMouseEvent)); nsMouseEvent * mouseEvent; - privateEvent->GetInternalNSEvent((nsEvent**)&mouseEvent); + mouseEvent = (nsMouseEvent *) privateEvent->GetInternalNSEvent(); PRInt32 selectedIndex; if (NS_SUCCEEDED(GetIndexFromDOMEvent(aMouseEvent, selectedIndex))) { diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index 082a835e6dbd..cc99d0e6b423 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -3285,8 +3285,7 @@ nsresult nsPluginInstanceOwner::DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent) nsCOMPtr privateEvent(do_QueryInterface(aFocusEvent)); if (privateEvent) { - nsEvent * theEvent; - privateEvent->GetInternalNSEvent(&theEvent); + nsEvent * theEvent = privateEvent->GetInternalNSEvent(); if (theEvent) { // we only care about the message in ProcessEvent nsGUIEvent focusEvent(NS_IS_TRUSTED_EVENT(theEvent), theEvent->message, @@ -3404,8 +3403,7 @@ nsresult nsPluginInstanceOwner::KeyPress(nsIDOMEvent* aKeyEvent) // we won't send the plugin two keyDown events. nsCOMPtr privateEvent(do_QueryInterface(aKeyEvent)); if (privateEvent) { - nsEvent *theEvent; - privateEvent->GetInternalNSEvent(&theEvent); + nsEvent *theEvent = privateEvent->GetInternalNSEvent(); const nsGUIEvent *guiEvent = (nsGUIEvent*)theEvent; const EventRecord *ev = (EventRecord*)(guiEvent->nativeMsg); if (guiEvent && @@ -3450,8 +3448,7 @@ nsresult nsPluginInstanceOwner::DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent) if (mInstance) { nsCOMPtr privateEvent(do_QueryInterface(aKeyEvent)); if (privateEvent) { - nsKeyEvent* keyEvent = nsnull; - privateEvent->GetInternalNSEvent((nsEvent**)&keyEvent); + nsKeyEvent *keyEvent = (nsKeyEvent *) privateEvent->GetInternalNSEvent(); if (keyEvent) { nsEventStatus rv = ProcessEvent(*keyEvent); if (nsEventStatus_eConsumeNoDefault == rv) { @@ -3484,8 +3481,7 @@ nsPluginInstanceOwner::MouseMove(nsIDOMEvent* aMouseEvent) nsCOMPtr privateEvent(do_QueryInterface(aMouseEvent)); if (privateEvent) { - nsMouseEvent* mouseEvent = nsnull; - privateEvent->GetInternalNSEvent((nsEvent**)&mouseEvent); + nsMouseEvent* mouseEvent = (nsMouseEvent *) privateEvent->GetInternalNSEvent(); if (mouseEvent) { nsEventStatus rv = ProcessEvent(*mouseEvent); if (nsEventStatus_eConsumeNoDefault == rv) { @@ -3519,8 +3515,7 @@ nsPluginInstanceOwner::MouseDown(nsIDOMEvent* aMouseEvent) nsCOMPtr privateEvent(do_QueryInterface(aMouseEvent)); if (privateEvent) { - nsMouseEvent* mouseEvent = nsnull; - privateEvent->GetInternalNSEvent((nsEvent**)&mouseEvent); + nsMouseEvent* mouseEvent = (nsMouseEvent *) privateEvent->GetInternalNSEvent(); if (mouseEvent) { nsEventStatus rv = ProcessEvent(*mouseEvent); if (nsEventStatus_eConsumeNoDefault == rv) { @@ -3578,8 +3573,7 @@ nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent) nsCOMPtr privateEvent(do_QueryInterface(aMouseEvent)); if (privateEvent) { - nsMouseEvent* mouseEvent = nsnull; - privateEvent->GetInternalNSEvent((nsEvent**)&mouseEvent); + nsMouseEvent* mouseEvent = (nsMouseEvent *) privateEvent->GetInternalNSEvent(); if (mouseEvent) { nsEventStatus rv = ProcessEvent(*mouseEvent); if (nsEventStatus_eConsumeNoDefault == rv) { diff --git a/layout/xul/base/src/nsXULPopupManager.cpp b/layout/xul/base/src/nsXULPopupManager.cpp index 5d8ece253c0b..8882266f27ba 100644 --- a/layout/xul/base/src/nsXULPopupManager.cpp +++ b/layout/xul/base/src/nsXULPopupManager.cpp @@ -321,8 +321,8 @@ nsXULPopupManager::SetTriggerEvent(nsIDOMEvent* aEvent, nsIContent* aPopup) if (privateEvent) { NS_ASSERTION(aPopup, "Expected a popup node"); nsEvent* event; - nsresult rv = privateEvent->GetInternalNSEvent(&event); - if (NS_SUCCEEDED(rv) && event) { + event = privateEvent->GetInternalNSEvent(); + if (event) { nsIDocument* doc = aPopup->GetCurrentDoc(); if (doc) { nsIPresShell* presShell = doc->GetPrimaryShell(); diff --git a/security/manager/ssl/src/nsSmartCardEvent.cpp b/security/manager/ssl/src/nsSmartCardEvent.cpp index 075cea98929e..9917044d3ad9 100644 --- a/security/manager/ssl/src/nsSmartCardEvent.cpp +++ b/security/manager/ssl/src/nsSmartCardEvent.cpp @@ -118,22 +118,28 @@ NS_IMETHODIMP nsSmartCardEvent::SetOriginalTarget(nsIDOMEventTarget *aTarget) return mPrivate->SetOriginalTarget(aTarget); } -NS_IMETHODIMP nsSmartCardEvent::IsDispatchStopped(PRBool *aIsDispatchPrevented) +NS_IMETHODIMP_(PRBool ) nsSmartCardEvent::IsDispatchStopped() { + PRBool isDispatchPrevented = nsnull; + PRBool * aIsDispatchPrevented = &isDispatchPrevented; NS_ASSERTION(mPrivate, "SmartCardEvent called without Init"); - return mPrivate->IsDispatchStopped(aIsDispatchPrevented); + return mPrivate->IsDispatchStopped(); } -NS_IMETHODIMP nsSmartCardEvent::GetInternalNSEvent(nsEvent** aNSEvent) +NS_IMETHODIMP_(nsEvent*) nsSmartCardEvent::GetInternalNSEvent() { + nsEvent* nSEvent = nsnull; + nsEvent** aNSEvent = &nSEvent; NS_ASSERTION(mPrivate, "SmartCardEvent called without Init"); - return mPrivate->GetInternalNSEvent(aNSEvent); + return mPrivate->GetInternalNSEvent(); } -NS_IMETHODIMP nsSmartCardEvent::HasOriginalTarget(PRBool *aResult) +NS_IMETHODIMP_(PRBool ) nsSmartCardEvent::HasOriginalTarget() { + PRBool result = nsnull; + PRBool * aResult = &result; NS_ASSERTION(mPrivate, "SmartCardEvent called without Init"); - return mPrivate->HasOriginalTarget(aResult); + return mPrivate->HasOriginalTarget(); } NS_IMETHODIMP nsSmartCardEvent::SetTrusted(PRBool aResult) diff --git a/security/manager/ssl/src/nsSmartCardEvent.h b/security/manager/ssl/src/nsSmartCardEvent.h index 84bb412fefdd..02781c29d867 100644 --- a/security/manager/ssl/src/nsSmartCardEvent.h +++ b/security/manager/ssl/src/nsSmartCardEvent.h @@ -65,9 +65,9 @@ public: NS_IMETHOD SetTarget(nsIDOMEventTarget *aTarget); NS_IMETHOD SetCurrentTarget(nsIDOMEventTarget *aTarget); NS_IMETHOD SetOriginalTarget(nsIDOMEventTarget *aTarget); - NS_IMETHOD GetInternalNSEvent(nsEvent** aNSEvent); - NS_IMETHOD IsDispatchStopped(PRBool *aIsDispatchPrevented); - NS_IMETHOD HasOriginalTarget(PRBool *aResult); + NS_IMETHOD_(nsEvent*) GetInternalNSEvent(); + NS_IMETHOD_(PRBool ) IsDispatchStopped(); + NS_IMETHOD_(PRBool ) HasOriginalTarget(); NS_IMETHOD SetTrusted(PRBool aResult); NS_DECL_NSIDOMEVENT