Skip to content
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

Re-factor how PDFLayerViewer decides if the UI needs to updated on "optionalcontentconfigchanged" events #18829

Merged

Conversation

Snuffleupagus
Copy link
Collaborator

The current implementation won't work correctly in some cases, e.g. if RBGroups are present, which means that it's possible for the UI to get out-of-sync with the actual optionalContent-state.

To avoid querying the DOM unnecessarily we cache the last known UI-state and compare with the actual optionalContent-state, which thus replaces the previously used hash-comparison.


Please note: This patch is the result of taking an initial and cursory look at PR #18825, since the issue fixed here seems reasonable to address separately to reduce the number of review comments needed over there.

…"optionalcontentconfigchanged" events

The current implementation won't work correctly in some cases, e.g. if RBGroups are present, which means that it's possible for the UI to get out-of-sync with the actual optionalContent-state.

To avoid querying the DOM unnecessarily we cache the last known UI-state and compare with the actual optionalContent-state, which thus replaces the previously used hash-comparison.
@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/fc8494543a653c9/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/fc8494543a653c9/output.txt

Total script time: 1.02 mins

Published

@agrahn
Copy link

agrahn commented Oct 1, 2024

I tested your version of pdf_layer_viewer.js with the remaining code of my PR and it works very well. Thanks a lot.

Copy link
Contributor

@calixteman calixteman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you.

@Snuffleupagus Snuffleupagus merged commit 35a9a6a into mozilla:master Oct 1, 2024
6 checks passed
@Snuffleupagus Snuffleupagus deleted the PDFLayerViewer-update-UI branch October 1, 2024 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants