Open Bug 1671981 Opened 5 years ago Updated 5 years ago

Convert draggableregionleftmousedown into a chrome-only MouseEvent

Categories

(Toolkit :: Video/Audio Controls, task, P3)

task

Tracking

()

People

(Reporter: mconley, Unassigned)

References

Details

draggableregionleftmousedown is a CustomEvent that was added in bug 1628948 to make it easier for our URL bar dropdown to close if the user clicks on a draggable region on Windows.

For bug 1604247, we also want to use this event, as most of the Picture-in-Picture player window is a draggable region. In addition to knowing if the user has mousedown'd on a draggable region, we'd like to know if the user is holding down the Meta key at the same time.

It looks like this can only happen if draggableregionleftmousedown is a MouseEvent.

So my proposal here is to convert draggableregionleftmousedown in to a privileged chrome-only MouseEvent. Any objections to this idea, Neil?

Flags: needinfo?(enndeakin)

Hey Manish,

So presuming we get buy-in to do this, here's what I'd suggest on how to proceed:

  1. Ensure you've got a binary build of Firefox working on your Windows machine
  2. Add a new message here: https://searchfox.org/mozilla-central/rev/61728de8273c04fe2417c475fc0637e8b79210d7/widget/EventMessageList.h#79, something like eMouseDownOnDraggableRegion.
  3. Instead of doing DispatchCustomEvent here: https://searchfox.org/mozilla-central/rev/819be4899a92213abf121b449779ced662f2ce13/widget/windows/nsWindow.cpp#5966, use a technique like this: https://searchfox.org/mozilla-central/rev/819be4899a92213abf121b449779ced662f2ce13/widget/windows/nsWindow.cpp#5953-5954,5957, to dispatch your new eMouseDownOnDraggableRegion event.
  4. At this point, we have created a WidgetMouseEvent... and we need to somehow get it to chrome-only dispatch so that it can appear to our privileged JS in player.js. I'm not 100% sure what the best pathway to do that would be. Any suggestions, Neil?

I assume that the picture in picture window here is setting the entire window to behave as a titlebar? The draggableregionleftmousedown event only applies when dragging the titlebar of a window.

Note that draggableregionleftmousedown only does anything on Windows.

  1. At this point, we have created a WidgetMouseEvent... and we need to somehow get it to chrome-only dispatch so that it can appear to our privileged JS in player.js. I'm not 100% sure what the best pathway to do that would be. Any suggestions, Neil?

You should be able to just convert the existing draggableregionleftmousedown event to a mouse event. There's an event flag mOnlyChromeDispatch.

Flags: needinfo?(enndeakin)
Severity: -- → N/A
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.