Nothing Special   »   [go: up one dir, main page]

Closed Bug 1907489 Opened 3 months ago Closed 3 months ago

`TextPropertyEditor.prototype._draggingOnMouseDown` uses `Element.setPointerCapture` with `undefined`

Categories

(DevTools :: Inspector: Rules, defect)

defect

Tracking

(firefox-esr115 wontfix, firefox-esr128 wontfix, firefox128 wontfix, firefox129 wontfix, firefox130 fixed)

RESOLVED FIXED
130 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr128 --- wontfix
firefox128 --- wontfix
firefox129 --- wontfix
firefox130 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(1 file)

https://searchfox.org/mozilla-central/rev/f7b41fc41c5505db507d076c16961a8da67dd318/devtools/client/inspector/rules/views/text-property-editor.js#1474

  _draggingOnMouseDown(event) {
    this._isDragging = true;
    this.valueSpan.setPointerCapture(event.pointerId);

This is a mousedown event listener. So, event is a MouseEvent interface, but MouseEvent does not have pointerId.
https://searchfox.org/mozilla-central/rev/f7b41fc41c5505db507d076c16961a8da67dd318/dom/webidl/MouseEvent.webidl

So, the value must be undefined which can be treated as 0. 0 is used for mouse events and first touch of active touches. Therefore, this could work as expected for mouse inputs, but this may cause unexpected exception if the event is the compatibility mouse events of Touch Events. Additionally, this pointerId value is set by different rules from the other browsers. Therefore, the value could be changed for solving web compat issues.

I think that it should listen to pointerdown, pointerup and pointercancel instead, and it should handle it only when the pointerType is mouse.

Set release status flags based on info from the regressing bug 1731734

Hi Masayuki,

I see this bug is currently blocking Bug 1885232, is this DevTools bug causing an issue for wpt tests? If yes, how so?

Flags: needinfo?(masayuki)
Assignee: nobody → masayuki
Status: NEW → ASSIGNED
Flags: needinfo?(masayuki)

According to the tryserver result with my patch, this is not directly blocks to fix bug 1885232. However, the fix of bug 1885232 will change the click event target during capturing pointer. So, without fixing this bug, that would change some behavior at least in edge cases.

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #3)

According to the tryserver result with my patch, this is not directly blocks to fix bug 1885232. However, the fix of bug 1885232 will change the click event target during capturing pointer. So, without fixing this bug, that would change some behavior at least in edge cases.

Could you give us a link to your patch so we can check how DevTools is impacted?

Flags: needinfo?(masayuki)

MouseEvent.pointerId is undefined so that setPointerCapture(undefined)
means setPointerCapture(0) and it captures both click of mouse and first
touch of touch input devices. It needs to listen to pointerdown event to
get the correct pointerId value. Then, it can use only pointerdown and
pointerup because they are fired before mousedown and mouseup.
Additionally, it handles a drag while a mouse button is pressed. Therefore,
it can ignore pointer events which are caused by other devices.

Although it's not required explicitly to release the capture when the pointer
is up, it needs to release capturing the pointer if Escape is pressed.
Therefore, this patch keeps the explicit release call.

Depends on D217214

(In reply to Nicolas Chevobbe [:nchevobbe] from comment #4)

Could you give us a link to your patch so we can check how DevTools is impacted?

I posted the patches and requested their review in each bug, could you check them? Thanks!

Flags: needinfo?(masayuki)
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/68256d2415b2 Make `TextPropertyEditor` listen to `pointerdown` to capture the pointer r=devtools-reviewers,nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 130 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: