зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1259656 part.7 Rename WidgetEvent::originalTarget to WidgetEvent::mOriginalTarget r=smaug
MozReview-Commit-ID: G1WVCWkS0Lt --HG-- extra : rebase_source : e4790266f4efa33269c073bca1d98f9e8e6c90d7
This commit is contained in:
Родитель
8caf2f2633
Коммит
9170348baf
|
@ -3025,7 +3025,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
|
|||
}
|
||||
case eLegacyDOMActivate:
|
||||
{
|
||||
if (aVisitor.mEvent->originalTarget == this) {
|
||||
if (aVisitor.mEvent->mOriginalTarget == this) {
|
||||
nsAutoString target;
|
||||
GetLinkTarget(target);
|
||||
const InternalUIEvent* activeEvent = aVisitor.mEvent->AsUIEvent();
|
||||
|
|
|
@ -692,7 +692,7 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
// dispatched or when we're about to propagate from
|
||||
// chrome access only subtree or if we are about to propagate out of
|
||||
// a shadow root to a shadow root host.
|
||||
((this == aVisitor.mEvent->originalTarget &&
|
||||
((this == aVisitor.mEvent->mOriginalTarget &&
|
||||
!ChromeOnlyAccess()) || isAnonForEvents || GetShadowRoot())) {
|
||||
nsCOMPtr<nsIContent> relatedTarget =
|
||||
do_QueryInterface(aVisitor.mEvent->AsMouseEvent()->relatedTarget);
|
||||
|
@ -717,7 +717,7 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
// If this is the original target, aVisitor.mRelatedTargetIsInAnon
|
||||
// must be updated.
|
||||
if (isAnonForEvents || aVisitor.mRelatedTargetIsInAnon ||
|
||||
(aVisitor.mEvent->originalTarget == this &&
|
||||
(aVisitor.mEvent->mOriginalTarget == this &&
|
||||
(aVisitor.mRelatedTargetIsInAnon =
|
||||
relatedTarget->ChromeOnlyAccess()))) {
|
||||
nsIContent* anonOwner = FindChromeAccessOnlySubtreeOwner(this);
|
||||
|
@ -736,7 +736,7 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
if (anonOwner == anonOwnerRelated) {
|
||||
#ifdef DEBUG_smaug
|
||||
nsCOMPtr<nsIContent> originalTarget =
|
||||
do_QueryInterface(aVisitor.mEvent->originalTarget);
|
||||
do_QueryInterface(aVisitor.mEvent->mOriginalTarget);
|
||||
nsAutoString ot, ct, rt;
|
||||
if (originalTarget) {
|
||||
originalTarget->NodeInfo()->NameAtom()->ToString(ot);
|
||||
|
@ -875,7 +875,8 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
#ifdef DEBUG
|
||||
// If a DOM event is explicitly dispatched using node.dispatchEvent(), then
|
||||
// all the events are allowed even in the native anonymous content..
|
||||
nsCOMPtr<nsIContent> t = do_QueryInterface(aVisitor.mEvent->originalTarget);
|
||||
nsCOMPtr<nsIContent> t =
|
||||
do_QueryInterface(aVisitor.mEvent->mOriginalTarget);
|
||||
NS_ASSERTION(!t || !t->ChromeOnlyAccess() ||
|
||||
aVisitor.mEvent->mClass != eMutationEventClass ||
|
||||
aVisitor.mDOMEvent,
|
||||
|
|
|
@ -5369,7 +5369,7 @@ bool
|
|||
nsContentUtils::CheckForSubFrameDrop(nsIDragSession* aDragSession,
|
||||
WidgetDragEvent* aDropEvent)
|
||||
{
|
||||
nsCOMPtr<nsIContent> target = do_QueryInterface(aDropEvent->originalTarget);
|
||||
nsCOMPtr<nsIContent> target = do_QueryInterface(aDropEvent->mOriginalTarget);
|
||||
if (!target) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -3123,7 +3123,7 @@ nsGlobalWindow::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
// QIing to window so that we can keep the old behavior also in case
|
||||
// a child window is handling resize.
|
||||
nsCOMPtr<nsPIDOMWindowInner> window =
|
||||
do_QueryInterface(aVisitor.mEvent->originalTarget);
|
||||
do_QueryInterface(aVisitor.mEvent->mOriginalTarget);
|
||||
if (window) {
|
||||
mIsHandlingResizeEvent = true;
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Event)
|
|||
if (tmp->mEventIsInternal) {
|
||||
tmp->mEvent->mTarget = nullptr;
|
||||
tmp->mEvent->mCurrentTarget = nullptr;
|
||||
tmp->mEvent->originalTarget = nullptr;
|
||||
tmp->mEvent->mOriginalTarget = nullptr;
|
||||
switch (tmp->mEvent->mClass) {
|
||||
case eMouseEventClass:
|
||||
case eMouseScrollEventClass:
|
||||
|
@ -193,7 +193,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Event)
|
|||
if (tmp->mEventIsInternal) {
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEvent->mTarget)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEvent->mCurrentTarget)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEvent->originalTarget)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEvent->mOriginalTarget)
|
||||
switch (tmp->mEvent->mClass) {
|
||||
case eMouseEventClass:
|
||||
case eMouseScrollEventClass:
|
||||
|
@ -348,8 +348,8 @@ Event::GetExplicitOriginalTarget(nsIDOMEventTarget** aRealEventTarget)
|
|||
EventTarget*
|
||||
Event::GetOriginalTarget() const
|
||||
{
|
||||
if (mEvent->originalTarget) {
|
||||
return GetDOMEventTarget(mEvent->originalTarget);
|
||||
if (mEvent->mOriginalTarget) {
|
||||
return GetDOMEventTarget(mEvent->mOriginalTarget);
|
||||
}
|
||||
|
||||
return GetTarget();
|
||||
|
@ -588,7 +588,7 @@ Event::InitEvent(const nsAString& aEventTypeArg,
|
|||
// Clearing the old targets, so that the event is targeted correctly when
|
||||
// re-dispatching it.
|
||||
mEvent->mTarget = nullptr;
|
||||
mEvent->originalTarget = nullptr;
|
||||
mEvent->mOriginalTarget = nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -403,7 +403,7 @@ EventTargetChainItem::HandleEventTargetChain(
|
|||
aVisitor.mEvent->mFlags.mImmediatePropagationStopped = false;
|
||||
|
||||
// Setting back the original target of the event.
|
||||
aVisitor.mEvent->mTarget = aVisitor.mEvent->originalTarget;
|
||||
aVisitor.mEvent->mTarget = aVisitor.mEvent->mOriginalTarget;
|
||||
|
||||
// Special handling if PresShell (or some other caller)
|
||||
// used a callback object.
|
||||
|
@ -515,7 +515,7 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
|
|||
do_QueryInterface(content->FindFirstNonChromeOnlyAccessContent());
|
||||
NS_ENSURE_STATE(newTarget);
|
||||
|
||||
aEvent->originalTarget = target;
|
||||
aEvent->mOriginalTarget = target;
|
||||
target = newTarget;
|
||||
retargeted = true;
|
||||
}
|
||||
|
@ -605,15 +605,15 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
|
|||
}
|
||||
|
||||
if (retargeted) {
|
||||
aEvent->originalTarget =
|
||||
aEvent->originalTarget->GetTargetForEventTargetChain();
|
||||
NS_ENSURE_STATE(aEvent->originalTarget);
|
||||
aEvent->mOriginalTarget =
|
||||
aEvent->mOriginalTarget->GetTargetForEventTargetChain();
|
||||
NS_ENSURE_STATE(aEvent->mOriginalTarget);
|
||||
}
|
||||
else {
|
||||
aEvent->originalTarget = aEvent->mTarget;
|
||||
aEvent->mOriginalTarget = aEvent->mTarget;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aEvent->originalTarget);
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aEvent->mOriginalTarget);
|
||||
bool isInAnon = (content && (content->IsInAnonymousSubtree() ||
|
||||
content->IsInShadowTree()));
|
||||
|
||||
|
@ -751,7 +751,7 @@ EventDispatcher::DispatchDOMEvent(nsISupports* aTarget,
|
|||
bool dontResetTrusted = false;
|
||||
if (innerEvent->mFlags.mDispatchedAtLeastOnce) {
|
||||
innerEvent->mTarget = nullptr;
|
||||
innerEvent->originalTarget = nullptr;
|
||||
innerEvent->mOriginalTarget = nullptr;
|
||||
} else {
|
||||
aDOMEvent->GetIsTrusted(&dontResetTrusted);
|
||||
}
|
||||
|
|
|
@ -1225,7 +1225,7 @@ EventListenerManager::HandleEventInternal(nsPresContext* aPresContext,
|
|||
if (!*aDOMEvent) {
|
||||
// This is tiny bit slow, but happens only once per event.
|
||||
nsCOMPtr<EventTarget> et =
|
||||
do_QueryInterface(aEvent->originalTarget);
|
||||
do_QueryInterface(aEvent->mOriginalTarget);
|
||||
RefPtr<Event> event = EventDispatcher::CreateEvent(et, aPresContext,
|
||||
aEvent,
|
||||
EmptyString());
|
||||
|
|
|
@ -146,7 +146,7 @@ TouchEvent::TargetTouches()
|
|||
// touch that is ending
|
||||
if ((mEvent->mMessage != eTouchEnd && mEvent->mMessage != eTouchCancel) ||
|
||||
!touches[i]->mChanged) {
|
||||
if (touches[i]->mTarget == mEvent->originalTarget) {
|
||||
if (touches[i]->mTarget == mEvent->mOriginalTarget) {
|
||||
targetTouches.AppendElement(touches[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -491,7 +491,7 @@ nsresult
|
|||
HTMLFormElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
aVisitor.mWantsWillHandleEvent = true;
|
||||
if (aVisitor.mEvent->originalTarget == static_cast<nsIContent*>(this)) {
|
||||
if (aVisitor.mEvent->mOriginalTarget == static_cast<nsIContent*>(this)) {
|
||||
uint32_t msg = aVisitor.mEvent->mMessage;
|
||||
if (msg == eFormSubmit) {
|
||||
if (mGeneratingSubmit) {
|
||||
|
@ -524,7 +524,7 @@ HTMLFormElement::WillHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
if ((aVisitor.mEvent->mMessage == eFormSubmit ||
|
||||
aVisitor.mEvent->mMessage == eFormReset) &&
|
||||
aVisitor.mEvent->mFlags.mInBubblingPhase &&
|
||||
aVisitor.mEvent->originalTarget != static_cast<nsIContent*>(this)) {
|
||||
aVisitor.mEvent->mOriginalTarget != static_cast<nsIContent*>(this)) {
|
||||
aVisitor.mEvent->StopPropagation();
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -533,7 +533,7 @@ HTMLFormElement::WillHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
nsresult
|
||||
HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
||||
{
|
||||
if (aVisitor.mEvent->originalTarget == static_cast<nsIContent*>(this)) {
|
||||
if (aVisitor.mEvent->mOriginalTarget == static_cast<nsIContent*>(this)) {
|
||||
EventMessage msg = aVisitor.mEvent->mMessage;
|
||||
if (msg == eFormSubmit) {
|
||||
// let the form know not to defer subsequent submissions
|
||||
|
|
|
@ -3429,7 +3429,7 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
// nsIContent::PreHandleEvent doesn't reset any change we make to mCanHandle.
|
||||
if (mType == NS_FORM_INPUT_NUMBER &&
|
||||
aVisitor.mEvent->IsTrusted() &&
|
||||
aVisitor.mEvent->originalTarget != this) {
|
||||
aVisitor.mEvent->mOriginalTarget != this) {
|
||||
// <input type=number> has an anonymous <input type=text> descendant. If
|
||||
// 'input' or 'change' events are fired at that text control then we need
|
||||
// to do some special handling here.
|
||||
|
@ -3439,7 +3439,7 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
if (numberControlFrame) {
|
||||
textControl = numberControlFrame->GetAnonTextControl();
|
||||
}
|
||||
if (textControl && aVisitor.mEvent->originalTarget == textControl) {
|
||||
if (textControl && aVisitor.mEvent->mOriginalTarget == textControl) {
|
||||
if (aVisitor.mEvent->mMessage == eEditorInput) {
|
||||
// Propogate the anon text control's new value to our HTMLInputElement:
|
||||
nsAutoString value;
|
||||
|
@ -3715,7 +3715,7 @@ HTMLInputElement::MaybeInitPickers(EventChainPostVisitor& aVisitor)
|
|||
// directory picker, else we open the file picker.
|
||||
FilePickerType type = FILE_PICKER_FILE;
|
||||
nsCOMPtr<nsIContent> target =
|
||||
do_QueryInterface(aVisitor.mEvent->originalTarget);
|
||||
do_QueryInterface(aVisitor.mEvent->mOriginalTarget);
|
||||
if (target &&
|
||||
target->GetParent() == this &&
|
||||
target->IsRootOfNativeAnonymousSubtree() &&
|
||||
|
@ -3782,7 +3782,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
|||
mType != NS_FORM_INPUT_NUMBER) {
|
||||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||
if (mouseEvent && mouseEvent->IsLeftClickEvent() &&
|
||||
!ShouldPreventDOMActivateDispatch(aVisitor.mEvent->originalTarget)) {
|
||||
!ShouldPreventDOMActivateDispatch(aVisitor.mEvent->mOriginalTarget)) {
|
||||
// DOMActive event should be trusted since the activation is actually
|
||||
// occurred even if the cause is an untrusted click event.
|
||||
InternalUIEvent actEvent(true, eLegacyDOMActivate, mouseEvent);
|
||||
|
|
|
@ -2277,7 +2277,7 @@ nsGenericHTMLFormElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
// this parent file control -- leave focus on the child.
|
||||
nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
|
||||
if (formControlFrame &&
|
||||
aVisitor.mEvent->originalTarget == static_cast<nsINode*>(this))
|
||||
aVisitor.mEvent->mOriginalTarget == static_cast<nsINode*>(this))
|
||||
formControlFrame->SetFocus(true, true);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -439,7 +439,7 @@ nsXBLWindowKeyHandler::HandleEventOnCaptureInSystemEventGroup(
|
|||
}
|
||||
|
||||
nsCOMPtr<mozilla::dom::Element> originalTarget =
|
||||
do_QueryInterface(aEvent->AsEvent()->WidgetEventPtr()->originalTarget);
|
||||
do_QueryInterface(aEvent->AsEvent()->WidgetEventPtr()->mOriginalTarget);
|
||||
if (!EventStateManager::IsRemoteTarget(originalTarget)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1289,7 +1289,7 @@ nsXULElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
|||
}
|
||||
if (aVisitor.mEvent->mMessage == eXULCommand &&
|
||||
aVisitor.mEvent->mClass == eInputEventClass &&
|
||||
aVisitor.mEvent->originalTarget == static_cast<nsIContent*>(this) &&
|
||||
aVisitor.mEvent->mOriginalTarget == static_cast<nsIContent*>(this) &&
|
||||
!IsXULElement(nsGkAtoms::command)) {
|
||||
// Check that we really have an xul command event. That will be handled
|
||||
// in a special way.
|
||||
|
|
|
@ -609,13 +609,13 @@ nsNumberControlFrame::GetSpinButtonForPointerEvent(WidgetGUIEvent* aEvent) const
|
|||
// we don't have a spinner
|
||||
return eSpinButtonNone;
|
||||
}
|
||||
if (aEvent->originalTarget == mSpinUp) {
|
||||
if (aEvent->mOriginalTarget == mSpinUp) {
|
||||
return eSpinButtonUp;
|
||||
}
|
||||
if (aEvent->originalTarget == mSpinDown) {
|
||||
if (aEvent->mOriginalTarget == mSpinDown) {
|
||||
return eSpinButtonDown;
|
||||
}
|
||||
if (aEvent->originalTarget == mSpinBox) {
|
||||
if (aEvent->mOriginalTarget == mSpinBox) {
|
||||
// In the case that the up/down buttons are hidden (display:none) we use
|
||||
// just the spin box element, spinning up if the pointer is over the top
|
||||
// half of the element, or down if it's over the bottom half. This is
|
||||
|
@ -678,7 +678,7 @@ nsNumberControlFrame::IsFocused() const
|
|||
void
|
||||
nsNumberControlFrame::HandleFocusEvent(WidgetEvent* aEvent)
|
||||
{
|
||||
if (aEvent->originalTarget != mTextField) {
|
||||
if (aEvent->mOriginalTarget != mTextField) {
|
||||
// Move focus to our text field
|
||||
HTMLInputElement::FromContent(mTextField)->Focus();
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
// exception.
|
||||
bool mExceptionHasBeenRisen : 1;
|
||||
// If mRetargetToNonNativeAnonymous is true and the target is in a non-native
|
||||
// native anonymous subtree, the event target is set to originalTarget.
|
||||
// native anonymous subtree, the event target is set to mOriginalTarget.
|
||||
bool mRetargetToNonNativeAnonymous : 1;
|
||||
// If mNoCrossProcessBoundaryForwarding is true, the event is not allowed to
|
||||
// cross process boundary.
|
||||
|
@ -348,7 +348,7 @@ public:
|
|||
// Event targets, needed by DOM Events
|
||||
nsCOMPtr<dom::EventTarget> mTarget;
|
||||
nsCOMPtr<dom::EventTarget> mCurrentTarget;
|
||||
nsCOMPtr<dom::EventTarget> originalTarget;
|
||||
nsCOMPtr<dom::EventTarget> mOriginalTarget;
|
||||
|
||||
void AssignEventData(const WidgetEvent& aEvent, bool aCopyTargets)
|
||||
{
|
||||
|
@ -362,7 +362,7 @@ public:
|
|||
// mSpecifiedEventTypeString should be copied manually if it's necessary.
|
||||
mTarget = aCopyTargets ? aEvent.mTarget : nullptr;
|
||||
mCurrentTarget = aCopyTargets ? aEvent.mCurrentTarget : nullptr;
|
||||
originalTarget = aCopyTargets ? aEvent.originalTarget : nullptr;
|
||||
mOriginalTarget = aCopyTargets ? aEvent.mOriginalTarget : nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче