Closed Bug 1357405 Opened 7 years ago Closed 7 years ago

Popup trigger nodes should use originaltarget rather than target from originating mouse events

Categories

(Toolkit :: UI Widgets, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: Gijs, Assigned: Gijs)

References

Details

Attachments

(1 obsolete file)

STR:

1. have a toolbarbutton element inside a <panelview> in a <panelmultiview> and open a context menu on it:

Expected:
I can work out what toolbarbutton the context menu is fired on

Actual:
I can't. The popup's triggerNode (and therefore document's popupNode) is the <panelmultiview>, and the rangeParent is the parent of the toolbarbutton. There's literally nothing on the event object to work this out.
Attachment #8859163 - Flags: review?(enndeakin)
Comment on attachment 8859163 [details]
Bug 1357405 - expose the original target of popups rather than only the target,

https://reviewboard.mozilla.org/r/131202/#review133760

::: layout/xul/nsXULPopupManager.cpp:618
(Diff revision 1)
>    if (aTriggerContent) {
>      *aTriggerContent = nullptr;
>      if (aEvent) {
>        // get the trigger content from the event
> -      nsCOMPtr<nsIContent> target = do_QueryInterface(
> -        aEvent->InternalDOMEvent()->GetTarget());
> +      nsCOMPtr<nsIDOMEventTarget> target;
> +      aEvent->InternalDOMEvent()->GetOriginalTarget(getter_AddRefs(target));

You can just use the no-argument GetOriginalTarget, no?
(In reply to Neil Deakin from comment #2)
> Comment on attachment 8859163 [details]
> Bug 1357405 - expose the original target of popups rather than only the
> target,
> 
> https://reviewboard.mozilla.org/r/131202/#review133760
> 
> ::: layout/xul/nsXULPopupManager.cpp:618
> (Diff revision 1)
> >    if (aTriggerContent) {
> >      *aTriggerContent = nullptr;
> >      if (aEvent) {
> >        // get the trigger content from the event
> > -      nsCOMPtr<nsIContent> target = do_QueryInterface(
> > -        aEvent->InternalDOMEvent()->GetTarget());
> > +      nsCOMPtr<nsIDOMEventTarget> target;
> > +      aEvent->InternalDOMEvent()->GetOriginalTarget(getter_AddRefs(target));
> 
> You can just use the no-argument GetOriginalTarget, no?

Yes, somehow I missed that. Updated patch in a second.
Comment on attachment 8859163 [details]
Bug 1357405 - expose the original target of popups rather than only the target,

https://reviewboard.mozilla.org/r/131202/#review133770
Attachment #8859163 - Flags: review?(enndeakin) → review+
The trypush is... pretty orange. Neil, is there a better way to fix this, beyond just updating all the consumers (and hoping there aren't too many broken add-ons and/or that those'll update themselves) ?

https://treeherder.mozilla.org/#/jobs?repo=try&revision=e6ad4e6d4c55&selectedJob=92357900
Flags: needinfo?(enndeakin)
I found a workaround (setting the context attribute for the popup inside the XBL binding seems to help, though don't ask me why) that we also used for the main panel menu, so that should be acceptable. I expect given the test breakage in the trypush that fixing this is not feasible, at least not before 57, so going to unassign and mark wontfix for now. We can re-evaluate if there are good reasons to do so.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Flags: needinfo?(enndeakin)
Resolution: --- → WONTFIX
Attachment #8859163 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: