Bug 456099: outparamdel nsIPrivateDOMEvent r+sr=jst

This commit is contained in:
Taras Glek 2008-10-09 16:23:07 -07:00
Родитель e0eb376859
Коммит e4062632a7
17 изменённых файлов: 57 добавлений и 76 удалений

Просмотреть файл

@ -3948,9 +3948,7 @@ nsContentUtils::GetNativeEvent(nsIDOMEvent* aDOMEvent)
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(aDOMEvent));
if (!privateEvent)
return nsnull;
nsEvent* nativeEvent;
privateEvent->GetInternalNSEvent(&nativeEvent);
return nativeEvent;
return privateEvent->GetInternalNSEvent();
}
//static

Просмотреть файл

@ -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;

Просмотреть файл

@ -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)
{

Просмотреть файл

@ -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)

Просмотреть файл

@ -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

Просмотреть файл

@ -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);

Просмотреть файл

@ -416,8 +416,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget,
if (aDOMEvent) {
nsCOMPtr<nsIPrivateDOMEvent> 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<nsIPrivateDOMEvent> 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;

Просмотреть файл

@ -404,8 +404,7 @@ nsXBLPrototypeHandler::DispatchXBLCommand(nsPIDOMEventTarget* aTarget, nsIDOMEve
nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(aEvent);
if (privateEvent) {
PRBool dispatchStopped;
privateEvent->IsDispatchStopped(&dispatchStopped);
PRBool dispatchStopped = privateEvent->IsDispatchStopped();
if (dispatchStopped)
return NS_OK;
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -5201,10 +5201,9 @@ PostMessageEvent::Run()
if (shell)
presContext = shell->GetPresContext();
nsEvent* internalEvent;
nsCOMPtr<nsIPrivateDOMEvent> privEvent = do_QueryInterface(message);
privEvent->SetTrusted(mTrustedCaller);
privEvent->GetInternalNSEvent(&internalEvent);
nsEvent *internalEvent = privEvent->GetInternalNSEvent();
nsEventStatus status = nsEventStatus_eIgnore;
nsEventDispatcher::Dispatch(static_cast<nsPIDOMWindow*>(mTargetWindow),

Просмотреть файл

@ -183,8 +183,7 @@ nsJSEventListener::HandleEvent(nsIDOMEvent* aEvent)
nsCOMPtr<nsIPrivateDOMEvent> 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<nsIPrivateDOMEvent> 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);

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -2010,7 +2010,7 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent)
// so the right thing happens for the onclick event
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(aMouseEvent));
nsMouseEvent * mouseEvent;
privateEvent->GetInternalNSEvent((nsEvent**)&mouseEvent);
mouseEvent = (nsMouseEvent *) privateEvent->GetInternalNSEvent();
PRInt32 selectedIndex;
if (NS_SUCCEEDED(GetIndexFromDOMEvent(aMouseEvent, selectedIndex))) {

Просмотреть файл

@ -3285,8 +3285,7 @@ nsresult nsPluginInstanceOwner::DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent)
nsCOMPtr<nsIPrivateDOMEvent> 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<nsIPrivateDOMEvent> 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<nsIPrivateDOMEvent> 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<nsIPrivateDOMEvent> 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<nsIPrivateDOMEvent> 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<nsIPrivateDOMEvent> 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) {

Просмотреть файл

@ -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();

Просмотреть файл

@ -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)

Просмотреть файл

@ -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