-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Fix AcroForm printing/saving edge cases #12263
Conversation
…ption selection The export value is used when the document is saved, so it should also be used when the document is opened to determine which choice widget option is selected. The display value is, as the name implies, only to be used for viewer display purposes and not for other logic. This makes sure that in the document from mozilla#12233 the "Favourite colour" choice widget is correctly initialized with "Red" instead of "Black" because the field value is equal to the export value (always the case), but not the display value (not always the case). Moreover, saving now also correctly uses the export value and not the display value.
…ion storage This commit makes the following improvements: - The code is similar to the other interactive form widgets now, with a clear note for the only difference. - Calling `getOrCreateValue` unconditionally ensures that choice widgets always have a value in the annotation storage. Previously we only inserted a value in the annotation storage when an option matched or when a selection was changed. However, this causes breakage when saving/printing because comboboxes, which we don't fully support yet but are rendered, might not have a value in storage at all. Their field value might not match any option since it allows the user to enter a custom value. - Calling `getOrCreateValue` unconditionally ensures that forms with choice widgets no longer always trigger a warning when the user navigates away from the page. This fixes mozilla#12241 (comment)
/botio-linux preview |
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/e82e8c9a919525a/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/e82e8c9a919525a/output.txt Total script time: 3.31 mins Published |
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 1 Live output at: http://54.215.176.217:8877/8cb713621af7408/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/eaa6c3d34e10719/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/eaa6c3d34e10719/output.txt Total script time: 27.28 mins
Image differences available at: http://54.67.70.0:8877/eaa6c3d34e10719/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.215.176.217:8877/8cb713621af7408/output.txt Total script time: 29.55 mins
Image differences available at: http://54.215.176.217:8877/8cb713621af7408/reftest-analyzer.html#web=eq.log |
Also, looking at the test-results for
|
You're right. It turns out that the |
Well, there's the answer. I'll update the patch; thanks for noticing! |
302007f
to
917fbbe
Compare
I have addressed all comments; see https://github.com/mozilla/pdf.js/compare/302007fdd1d2da34e93a628fb5948fbc7add9169..917fbbe5e207b94d78ad8ff39cd8b464db3c7a8c for the interdiff. I also found that I accidentally added the test file to /botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/67a44ed4e98c4b1/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 1 Live output at: http://54.215.176.217:8877/bacb6a3e6844c11/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/67a44ed4e98c4b1/output.txt Total script time: 27.12 mins
Image differences available at: http://54.67.70.0:8877/67a44ed4e98c4b1/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.215.176.217:8877/bacb6a3e6844c11/output.txt Total script time: 29.33 mins
Image differences available at: http://54.215.176.217:8877/bacb6a3e6844c11/reftest-analyzer.html#web=eq.log |
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.
Looks good to me, modulo a couple of comments; thank you!
The helper method `_decodeFormValue` is used to ensure that it happens in one place. Note that form values are field values, display values and export values.
The down appearance (`D`) is optional and not available in the document from mozilla#12233, so the checkboxes are never saved/printed as checked because the checked appearance is based on the export value that is missing because the `D` entry is not available. Instead, we should use the normal appearance (`N`) since that one is required and therefore always available. Finally, the /Off appearance is optional according to section 12.7.4.2.3 of the specification, so that needs to be taken into account to match the specification and to fix reference test failures for the `annotation-button-widget-print` test. That is a file that doesn't specify an /Off appearance in the normal appearance dictionary.
In addition to the unit tests these reference tests make sure that this document, that triggered some edge cases in our code, can be rendered and printed successfully now.
917fbbe
to
73bc8e1
Compare
/botio test |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://54.215.176.217:8877/1f58f02a189f55f/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/6f72d8d6f3e20d9/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.67.70.0:8877/6f72d8d6f3e20d9/output.txt Total script time: 26.95 mins
Image differences available at: http://54.67.70.0:8877/6f72d8d6f3e20d9/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.215.176.217:8877/1f58f02a189f55f/output.txt Total script time: 29.08 mins
Image differences available at: http://54.215.176.217:8877/1f58f02a189f55f/reftest-analyzer.html#web=eq.log |
/botio makeref |
From: Bot.io (Linux m4)ReceivedCommand cmd_makeref from @timvandermeij received. Current queue size: 0 Live output at: http://54.67.70.0:8877/9ee69b24bd625f0/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_makeref from @timvandermeij received. Current queue size: 0 Live output at: http://54.215.176.217:8877/bdc53727e0369f3/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.67.70.0:8877/9ee69b24bd625f0/output.txt Total script time: 25.48 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.215.176.217:8877/bdc53727e0369f3/output.txt Total script time: 28.94 mins
|
The commit message contain more information about the individual changes.
Fixes #12233.