Bug 1875424 - Make PresShell::HandleEvent flush pending synthetic mouse move at handling eMouseMove r=smaug
`mouse_boundary_events_after_removing_last_over_element.html` expects that a `mouseover` should be fired between `click` and `mousemove`, but it's dispatched by a synthetic mouse move event caused by removing the click target. The fix of bug 1864654 tried to fix this kind of issues, but it does not flush pending event at `eMouseMove`. Therefore, the synthetic mouse move may not be handled before handling `eMouseMove` which is caused by `pointerMove()` in the test. I guess that we need to make it flush before all events which are directly caused by a user input. However, I don't want to do it for now because of the risk. Depends on D199607 Differential Revision: https://phabricator.services.mozilla.com/D199694
This commit is contained in:
@@ -6946,10 +6946,16 @@ nsresult PresShell::HandleEvent(nsIFrame* aFrameForPresShell,
|
||||
|
||||
if (mPresContext) {
|
||||
switch (aGUIEvent->mMessage) {
|
||||
case eMouseMove:
|
||||
if (!aGUIEvent->AsMouseEvent()->IsReal()) {
|
||||
break;
|
||||
}
|
||||
[[fallthrough]];
|
||||
case eMouseDown:
|
||||
case eMouseUp: {
|
||||
// We should flush pending mousemove event before that because the event
|
||||
// may occur without proper boundary event. E.g., if a mousedown event
|
||||
// We should flush pending mousemove event now because some mouse
|
||||
// boundary events which should've already been dispatched before a user
|
||||
// input may have not been dispatched. E.g., if a mousedown event
|
||||
// listener removed or appended an element under the cursor and mouseup
|
||||
// event comes immediately after that, mouseover or mouseout may have
|
||||
// not been dispatched on the new element yet.
|
||||
@@ -6959,6 +6965,8 @@ nsresult PresShell::HandleEvent(nsIFrame* aFrameForPresShell,
|
||||
// eMouseUp. That could cause unexpected behavior if a `mouseover`
|
||||
// event listener assumes it's always disptached before `mousedown`.
|
||||
// However, we're not sure whether it could happen with users' input.
|
||||
// FIXME: Perhaps, we need to do this for all events which are directly
|
||||
// caused by user input, e.g., eKeyDown, etc.
|
||||
RefPtr<PresShell> rootPresShell =
|
||||
mPresContext->IsRoot() ? this : GetRootPresShell();
|
||||
if (rootPresShell && rootPresShell->mSynthMouseMoveEvent.IsPending()) {
|
||||
|
||||
Reference in New Issue
Block a user