Closed Bug 1778486 Opened 2 years ago Closed 2 years ago

Paste button for clipboard.readText() doesn't showed on touched position on Windows

Categories

(Core :: DOM: Copy & Paste and Drag & Drop, defect, P3)

Unspecified
Windows
defect

Tracking

()

RESOLVED FIXED
104 Branch
Tracking Status
firefox104 --- fixed

People

(Reporter: edgar, Assigned: edgar)

References

Details

(Whiteboard: [fission:android:m2])

Attachments

(1 file)

STR:
a) Flipping the pref "dom.events.asyncClipboard.readText" to true.
b) Open https://jsfiddle.net/68hng59s/.
c) Touch the "X" button and check where a "Paste" button shows.

Expected:
Paste button is showed near the touched position.

Actually:
Paste buttons is showed near the last mouse position instead.

It is because nsIDOMWindowUtils.getLastOverWindowMouseLocationInCSSPixels doesn't record the touch position in parent process.
And the recording of nsIDOMWindowUtils.getLastOverWindowMouseLocationInCSSPixels rely on the synthesized mouse event for touch which is fired from APZ. Hi :botond, I am not sure whether it is expected that the synthesized mouse event for touch isn't fired on parent process, could you shed some light here? Thanks!

Flags: needinfo?(botond)

Even though synthesized mouse was fired on parent, this still might not be enough, because the synthesized mouse event is dispatched after touch and pointer event, the recorded position will not be accurate if clipboard.readText is called from pointer/touch event handler. I think we could record the pointer event instead, which will be fired for all input (mouse, touch or pen).

Assignee: nobody → echen

Comment on attachment 9284592 [details]
Bug 1778486 - Use Pointer event to record last user input position; r=smaug

Hi Makoto, would you mind trying whether this patch fixes the issue you encounter in bug 1776843 comment# 7 on Android? Thanks!

Attachment #9284592 - Flags: feedback?(m_kato)

Hi Makoto, would you mind trying whether this patch fixes the issue you encounter in bug 1776843 comment# 7 on Android? Thanks!

Yes, it works as expected.

Attachment #9284592 - Flags: feedback?(m_kato) → feedback+

(In reply to Edgar Chen [:edgar] (PTO 07/09 ~ 07/17) from comment #1)

Hi :botond, I am not sure whether it is expected that the synthesized mouse event for touch isn't fired on parent process, could you shed some light here? Thanks!

I believe this is expected. The mouse events are synthesized in the content process, and, as far as I know, we have not implemented a code path which dispatches them in the parent process (I guess we never needed one).

We could consider adding that, though it may introduce some latency (if we wait for the round-trip back from the parent process before the dispatching the event in the content) or some complexity / dealing with edge cases (if we dispatch in the content first and then the parent), so if your current patch fixes the bug. I would say let's not make changes to how the synthesized events work.

Flags: needinfo?(botond)
Blocks: 1776829

Makoto says Android Fission will need this touchevent fix.

Whiteboard: [fission:android:m2]
Attachment #9284592 - Attachment description: WIP: Bug 1778486 - Use Pointer event to record last user input position; → Bug 1778486 - Use Pointer event to record last user input position; r=smaug
Pushed by echen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9a5d1eaadf39 Use Pointer event to record last user input position; r=smaug

Backed out for causing mochitest-crash failures on test_getLastOverWindowPointerLocationInCSSPixels.html.

Push with failures

Failure log

Backout link

[task 2022-07-20T15:38:11.571Z] 15:38:11     INFO - TEST-START | dom/base/test/test_getLastOverWindowPointerLocationInCSSPixels.html
[task 2022-07-20T15:38:11.575Z] 15:38:11     INFO - GECKO(2295) | [Parent 2295, Main Thread] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004005 (NS_ERROR_FAILURE): file /builds/worker/checkouts/gecko/chrome/nsChromeRegistry.cpp:180
[task 2022-07-20T15:38:11.575Z] 15:38:11     INFO - GECKO(2295) | [Parent 2295, Main Thread] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004005 (NS_ERROR_FAILURE): file /builds/worker/checkouts/gecko/dom/security/nsCSPService.cpp:190
[task 2022-07-20T15:38:11.586Z] 15:38:11     INFO - GECKO(2295) | [Parent 2295, Main Thread] WARNING: early callback, or time went backwards: '!aAllowIdleDispatch', file /builds/worker/checkouts/gecko/xpcom/threads/IdleTaskRunner.cpp:198
[task 2022-07-20T15:38:11.620Z] 15:38:11     INFO - GECKO(2295) | [Parent 2295, Main Thread] WARNING: Failed to retarget HTML data delivery to the parser thread.: file /builds/worker/checkouts/gecko/parser/html/nsHtml5StreamParser.cpp:1234
[task 2022-07-20T15:38:11.707Z] 15:38:11     INFO - GECKO(2295) | [Parent 2295, Main Thread] WARNING: early callback, or time went backwards: '!aAllowIdleDispatch', file /builds/worker/checkouts/gecko/xpcom/threads/IdleTaskRunner.cpp:198
[task 2022-07-20T15:38:11.735Z] 15:38:11     INFO - GECKO(2295) | WaitUntilApzStable: done promiseFocus
[task 2022-07-20T15:38:11.737Z] 15:38:11     INFO - GECKO(2295) | WaitUntilApzStable: done promiseAllPaintsDone
[task 2022-07-20T15:38:11.738Z] 15:38:11     INFO - GECKO(2295) | PromiseApzRepaintsFlushed: Flushing APZ repaints was a no-op, triggering callback directly...
[task 2022-07-20T15:38:11.739Z] 15:38:11     INFO - GECKO(2295) | PromiseApzRepaintsFlushed: APZ flush done
[task 2022-07-20T15:38:11.741Z] 15:38:11     INFO - GECKO(2295) | WaitUntilApzStable: all done
[task 2022-07-20T15:38:11.818Z] 15:38:11     INFO - GECKO(2295) | [Parent 2295, Main Thread] WARNING: early callback, or time went backwards: '!aAllowIdleDispatch', file /builds/worker/checkouts/gecko/xpcom/threads/IdleTaskRunner.cpp:198
<...>
[task 2022-07-20T15:38:12.090Z] 15:38:12     INFO - GECKO(2295) | [Parent 2295, Main Thread] WARNING: early callback, or time went backwards: '!aAllowIdleDispatch', file /builds/worker/checkouts/gecko/xpcom/threads/IdleTaskRunner.cpp:198
[task 2022-07-20T15:43:23.146Z] 15:43:23     INFO - TEST-INFO | started process screentopng
[task 2022-07-20T15:43:23.288Z] 15:43:23     INFO - TEST-INFO | screentopng: exit 0
[task 2022-07-20T15:43:23.290Z] 15:43:23     INFO - Buffered messages logged at 15:38:11
[task 2022-07-20T15:43:23.292Z] 15:43:23     INFO - add_task | Entering test init
[task 2022-07-20T15:43:23.293Z] 15:43:23     INFO - add_task | Leaving test init
[task 2022-07-20T15:43:23.294Z] 15:43:23     INFO - add_task | Entering test test_mouse
[task 2022-07-20T15:43:23.294Z] 15:43:23     INFO - TEST-PASS | dom/base/test/test_getLastOverWindowPointerLocationInCSSPixels.html | check last pointer location 
[task 2022-07-20T15:43:23.295Z] 15:43:23     INFO - add_task | Leaving test test_mouse
[task 2022-07-20T15:43:23.296Z] 15:43:23     INFO - add_task | Entering test test_touch
[task 2022-07-20T15:43:23.296Z] 15:43:23     INFO - Buffered messages finished
[task 2022-07-20T15:43:23.297Z] 15:43:23     INFO - TEST-UNEXPECTED-FAIL | dom/base/test/test_getLastOverWindowPointerLocationInCSSPixels.html | Test timed out. - 
[task 2022-07-20T15:43:24.149Z] 15:43:24     INFO - GECKO(2295) | MEMORY STAT | vsize 3072MB | residentFast 407MB | heapAllocated 160MB
[task 2022-07-20T15:43:24.155Z] 15:43:24     INFO - TEST-OK | dom/base/test/test_getLastOverWindowPointerLocationInCSSPixels.html | took 312583ms
[task 2022-07-20T15:43:24.162Z] 15:43:24     INFO - GECKO(2295) | [Parent 2295, Main Thread] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004005 (NS_ERROR_FAILURE): file /builds/worker/checkouts/gecko/chrome/nsChromeRegistry.cpp:180
[task 2022-07-20T15:43:24.164Z] 15:43:24     INFO - GECKO(2295) | [Parent 2295, Main Thread] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004005 (NS_ERROR_FAILURE): file /builds/worker/checkouts/gecko/dom/security/nsCSPService.cpp:190
[task 2022-07-20T15:43:24.203Z] 15:43:24     INFO - GECKO(2295) | [Parent 2295, Main Thread] WARNING: Failed to retarget HTML data delivery to the parser thread.: file /builds/worker/checkouts/gecko/parser/html/nsHtml5StreamParser.cpp:1234
[task 2022-07-20T15:43:24.245Z] 15:43:24     INFO - TEST-START | dom/base/test/test_messagemanager_send_principal.html
Flags: needinfo?(echen)
Flags: needinfo?(echen)
Pushed by echen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5ffdcd317253 Use Pointer event to record last user input position; r=smaug
Backout by bszekely@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e4ec56a9e42a Backed out changeset 5ffdcd317253 for causing mochitest failures on test_getLastOverWindowPointerLocationInCSSPixels.html CLOSED TREE
Pushed by echen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/84da8d3b49ec Use Pointer event to record last user input position; r=smaug
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: