Propagate trusted flag to synthesized events. b=265692 r=bzbarsky sr=jst a=asa

This commit is contained in:
dbaron%dbaron.org 2004-10-23 22:28:25 +00:00
Родитель c4e35051b7
Коммит 642604a088
1 изменённых файлов: 18 добавлений и 0 удалений

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

@ -1124,6 +1124,9 @@ void
nsEventStateManager::CreateClickHoldTimer(nsPresContext* inPresContext,
nsGUIEvent* inMouseDownEvent)
{
if (!(inMouseDownEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED))
return;
// just to be anal (er, safe)
if (mClickHoldTimer) {
mClickHoldTimer->Cancel();
@ -1231,6 +1234,7 @@ nsEventStateManager::FireContextClick()
event.clickCount = 1;
event.point = mEventPoint;
event.refPoint = mEventRefPoint;
event.internalAppFlags |= NS_APP_EVENT_FLAG_TRUSTED;
// Dispatch to the DOM. We have to fake out the ESM and tell it that the
// current target frame is actually where the mouseDown occurred, otherwise it
@ -1481,6 +1485,8 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
event.isControl = ((nsMouseEvent*)aEvent)->isControl;
event.isAlt = ((nsMouseEvent*)aEvent)->isAlt;
event.isMeta = ((nsMouseEvent*)aEvent)->isMeta;
event.internalAppFlags |=
aEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED;
// Dispatch to the DOM. We have to fake out the ESM and tell it that the
// current target frame is actually where the mouseDown occurred, otherwise it
@ -2508,6 +2514,8 @@ nsEventStateManager::DispatchMouseEvent(nsPresContext* aPresContext,
event.isAlt = ((nsMouseEvent*)aEvent)->isAlt;
event.isMeta = ((nsMouseEvent*)aEvent)->isMeta;
event.nativeMsg = ((nsMouseEvent*)aEvent)->nativeMsg;
event.internalAppFlags |=
aEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED;
mCurrentTargetContent = aTargetContent;
mCurrentRelatedContent = aRelatedContent;
@ -2563,6 +2571,8 @@ nsEventStateManager::MaybeDispatchMouseEventToIframe(
event.isAlt = ((nsMouseEvent*)aEvent)->isAlt;
event.isMeta = ((nsMouseEvent*)aEvent)->isMeta;
event.nativeMsg = ((nsMouseEvent*)aEvent)->nativeMsg;
event.internalAppFlags |=
aEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED;
parentShell->HandleDOMEventWithTarget(docContent, &event, &status);
}
@ -2715,6 +2725,8 @@ nsEventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
event.isControl = ((nsMouseEvent*)aEvent)->isControl;
event.isAlt = ((nsMouseEvent*)aEvent)->isAlt;
event.isMeta = ((nsMouseEvent*)aEvent)->isMeta;
event.internalAppFlags |=
aEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED;
//The frame has change but the content may not have. Check before dispatching to content
mLastDragOverFrame->GetContentForEvent(aPresContext, aEvent, getter_AddRefs(lastContent));
@ -2748,6 +2760,8 @@ nsEventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
event.isControl = ((nsMouseEvent*)aEvent)->isControl;
event.isAlt = ((nsMouseEvent*)aEvent)->isAlt;
event.isMeta = ((nsMouseEvent*)aEvent)->isMeta;
event.internalAppFlags |=
aEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED;
mCurrentTargetContent = targetContent;
mCurrentRelatedContent = lastContent;
@ -2789,6 +2803,8 @@ nsEventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
event.isControl = ((nsMouseEvent*)aEvent)->isControl;
event.isAlt = ((nsMouseEvent*)aEvent)->isAlt;
event.isMeta = ((nsMouseEvent*)aEvent)->isMeta;
event.internalAppFlags |=
aEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED;
// dispatch to content via DOM
nsCOMPtr<nsIContent> lastContent;
@ -2946,6 +2962,8 @@ nsEventStateManager::CheckForAndDispatchClick(nsPresContext* aPresContext,
event2.isControl = aEvent->isControl;
event2.isAlt = aEvent->isAlt;
event2.isMeta = aEvent->isMeta;
event2.internalAppFlags |=
aEvent->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED;
ret = presShell->HandleEventWithTarget(&event2, mCurrentTarget, mouseContent, flags, aStatus);
}