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

implementing optional content radiobutton groups #18825

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

agrahn
Copy link
Contributor

@agrahn agrahn commented Sep 30, 2024

This PR implements OC radio button groups. It could resolve #18823.

The suggested code parses the /RBGroups entry in the optional content configuration dict and adds the property myRbGroups to instances of the OptionalContentGroup class. myRbGroups takes an array of Sets , where each Set instance represents a radio button group the OptionalContentGroup instance is a member of. Such a Set instance contains all OCG ids within the corresponding RB group. The RB groups an OCG is associated with are processed when its visibility is set to true, as required by the PDF spec.

@agrahn
Copy link
Contributor Author

agrahn commented Oct 1, 2024

@Snuffleupagus I updated the PR with your version of pdf_layer_viewer.js from master. Only two changed files remain for review :).

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

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

Thanks for the patch; based on an initial look I've left a number of inline comments.

Please remember to include the information from #18825 (comment) in the commit message as well, such that the patch is easier to understand also on the Git command line.

src/core/catalog.js Outdated Show resolved Hide resolved
src/core/catalog.js Outdated Show resolved Hide resolved
src/core/catalog.js Outdated Show resolved Hide resolved
src/core/catalog.js Outdated Show resolved Hide resolved
src/core/catalog.js Outdated Show resolved Hide resolved
src/core/catalog.js Outdated Show resolved Hide resolved
src/display/optional_content_config.js Outdated Show resolved Hide resolved
@agrahn
Copy link
Contributor Author

agrahn commented Oct 2, 2024

Thank you, @Snuffleupagus, for your comments. I am going to work through all of them. Is it OK to do the code changes locally and to force-push them afterwards?

src/core/catalog.js Outdated Show resolved Hide resolved
@agrahn
Copy link
Contributor Author

agrahn commented Oct 2, 2024

Please remember to include the information from #18825 (comment) in the commit message as well, such that the patch is easier to understand also on the Git command line.

That's a lot of text. I thought a commit message should fit on a single line. But I will do so when appropriate.

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

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

This also needs tests, and I'd suggest adding a couple of reference tests for this.

  • Add the PDF document that you attached in [Feature]: Optional Content Radio Button Groups #18823 (comment) to the test/pdfs/ folder, but name it issue18823.pdf.
  • Run node test/add_test.mjs test/pdfs/issue18823.pdf in the root of your local PDF.js Git-clone.
  • Open the test/test_manifest.json file and find the newly added test-case. Here we also want to add another test-case for a non-default optionalContent-state.

To make this process slightly less daunting I've done these steps in the following diff, which you're obviously welcome to copy and include as-is in your patch: master...Snuffleupagus:pdf.js:issue-18823-test

src/core/catalog.js Outdated Show resolved Hide resolved
src/core/catalog.js Outdated Show resolved Hide resolved
src/core/catalog.js Show resolved Hide resolved
src/core/catalog.js Outdated Show resolved Hide resolved
src/display/optional_content_config.js Outdated Show resolved Hide resolved
src/display/optional_content_config.js Outdated Show resolved Hide resolved
src/display/optional_content_config.js Outdated Show resolved Hide resolved
src/display/optional_content_config.js Outdated Show resolved Hide resolved
src/core/catalog.js Outdated Show resolved Hide resolved
@agrahn agrahn force-pushed the rbgroups branch 2 times, most recently from 7e7817a to bd46207 Compare October 14, 2024 09:41
@agrahn
Copy link
Contributor Author

agrahn commented Oct 14, 2024

This also needs tests, and I'd suggest adding a couple of reference tests for this.

  • Add the PDF document that you attached in [Feature]: Optional Content Radio Button Groups #18823 (comment) to the test/pdfs/ folder, but name it issue18823.pdf.

  • Run node test/add_test.mjs test/pdfs/issue18823.pdf in the root of your local PDF.js Git-clone.

  • Open the test/test_manifest.json file and find the newly added test-case. Here we also want to add another test-case for a non-default optionalContent-state.

To make this process slightly less daunting I've done these steps in the following diff, which you're obviously welcome to copy and include as-is in your patch: master...Snuffleupagus:pdf.js:issue-18823-test

Thanks a lot for this, I merged the test case into the patch. I just don't quite understand what is to be done regarding the other test case for a non-default OC state (third item in your comment).

@Snuffleupagus
Copy link
Collaborator

Thanks a lot for this, I merged the test case into the patch. I just don't quite understand what is to be done regarding the other test case for a non-default OC state (third item in your comment).

That patch already includes all of those steps, however I just wanted to highlight that the script can only create "simple" entries in the test/test_manifest.json file.


It seems that the PR currently contains unrelated commits, maybe a rebase gone wrong?

@agrahn
Copy link
Contributor Author

agrahn commented Oct 14, 2024

  • The third point cannot be automatically generated, however I've manually added it in that diff here: [3bacbf6#diff-9bc50ce4ba8a4ba8d322114a3cc05fa62005a40b52223059200ca07087dd5a61R6885-R6894](3bacbf6#diff-9bc50ce4ba8a4ba8d322114a3

OK, so nothing else needs to be done regarding this.

It seems that the PR currently contains unrelated commits, maybe a rebase gone wrong?

I hope the commit history is in sync again. Going to work on the other changes now.

src/core/catalog.js Outdated Show resolved Hide resolved
…ozilla#18823.

The code parses the /RBGroups entry in the OC configuration dict and adds the property `rbGroups' to instances of the OptionalContentGroup class. rbGroups takes an array of Sets, where each Set instance represents an RB group the OptionalContentGroup instance is a member of. Such a Set instance contains all OCG ids within the corresponding RB group. RB groups an OCG is associated with are processed when its visibility is set to true, as required by the PDF spec.
@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/0dddf080415168d/output.txt

@mozilla mozilla deleted a comment from moz-tools-bot Oct 15, 2024
@mozilla mozilla deleted a comment from moz-tools-bot Oct 15, 2024
@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/0dddf080415168d/output.txt

Total script time: 1.02 mins

Published

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

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

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

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

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

Live output at: http://54.193.163.58:8877/3332fffe33746b9/output.txt

@mozilla mozilla deleted a comment from moz-tools-bot Oct 15, 2024
@mozilla mozilla deleted a comment from moz-tools-bot Oct 15, 2024
@mozilla mozilla deleted a comment from moz-tools-bot Oct 15, 2024
@mozilla mozilla deleted a comment from moz-tools-bot Oct 15, 2024
@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

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

Total script time: 31.49 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 17
  different first/second rendering: 1

Image differences available at: http://54.241.84.105:8877/e5f2c5253faf64a/reftest-analyzer.html#web=eq.log

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/3332fffe33746b9/output.txt

Total script time: 52.87 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 2

Image differences available at: http://54.193.163.58:8877/3332fffe33746b9/reftest-analyzer.html#web=eq.log

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

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

r=me, thank you.

@Snuffleupagus Snuffleupagus merged commit 424f81c into mozilla:master Oct 15, 2024
8 checks passed
@Snuffleupagus
Copy link
Collaborator

/botio makeref

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.241.84.105:8877/813a9fbb6328fdf/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

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

Live output at: http://54.193.163.58:8877/1a80bcacdd4199c/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/813a9fbb6328fdf/output.txt

Total script time: 21.01 mins

  • Make references: Passed
  • Check references: Passed

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/1a80bcacdd4199c/output.txt

Total script time: 30.15 mins

  • Make references: Passed
  • Check references: Passed

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.

[Feature]: Optional Content Radio Button Groups
3 participants