-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PDFScriptingManager: Bind mousedown listener with capture=true #14722
PDFScriptingManager: Bind mousedown listener with capture=true #14722
Conversation
PDFScriptingManager uses the `mousedown` and `mouseup` listeners to keep track of whether the mouse pointer is pressed in the `isDown` flag. These listeners were registered to run during the bubbling phase of the event dispatch, which can be interrupted if any of the previous event listeners stopped the event propagation. An example of that is by `GrabToPan` in web/grab_to_pan.js. Since the mousedown (and mouseup) listeners of PDFScriptingManager are free of side effects, and the intention is to always run them, it makes most sense to register them with the capture flag.
What about all of the event listeners attached directly in the Also, does this still work even if the handTool is enabled before the |
These elements are input elements or links, which are already being recognized as targets where panning should not activate (source is linked in my previous comment).
Yes. The time of registration does not matter because PDFScriptingManager registers the event with |
/botio integrationtest |
From: Bot.io (Linux m4)ReceivedCommand cmd_integrationtest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.241.84.105:8877/a7e88adb963a226/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_integrationtest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.193.163.58:8877/92b11c3c5ab0091/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/a7e88adb963a226/output.txt Total script time: 3.97 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.193.163.58:8877/92b11c3c5ab0091/output.txt Total script time: 7.48 mins
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do this, thank you!
Would it be feasible to add an integration-test for this issue, e.g. in https://github.com/mozilla/pdf.js/blob/master/test/integration/scripting_spec.js, where we first enable the handTool and then ensure that the intended validation runs when the field loses focus?
Oops. I missed the question.
It may be feasible to have a regression test for this issue, by simulating the specific events in a particular order. I don't see any unit tests for the pdf.js/src/display/annotation_layer.js Line 1031 in 4d4c67d
|
PDFScriptingManager uses the
mousedown
andmouseup
listeners to keep track of whether the mouse pointer is pressed in theisDown
flag. These listeners were registered to run during the bubbling phase of the event dispatch, which can be interrupted if any of the previous event listeners stopped the event propagation. An example of that is byGrabToPan
in web/grab_to_pan.js.Since the mousedown (and mouseup) listeners of PDFScriptingManager are free of side effects, and the intention is to always run them, it makes most sense to register them with the capture flag.
More details at #14721 (comment)
Fixes #14721