-
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
[Form] Don't use field appearances when /NeedAppearances is set to true (bug 1796741) #15615
Conversation
I can't access the bug, can you please CC me on it so that I have the complete context here? |
203cd6d
to
18a9b49
Compare
src/core/document.js
Outdated
return null; | ||
}) | ||
); | ||
const acroFormPromise = this.pdfManager.ensureCatalog("acroForm"); |
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.
With the comment above addressed, do we actually need to make any changes in this file?
src/core/annotation.js
Outdated
@@ -1480,6 +1491,10 @@ class WidgetAnnotation extends Annotation { | |||
constructor(params) { | |||
super(params); | |||
|
|||
if (params.needAppearances) { | |||
this.appearance = null; |
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.
Could we break any other code-path, e.g. related to saving or similar, if we simply clear out the this.appearance
data here?
Since I don't know the annotation-related code well enough to tell right away, I figured that it couldn't hurt to ask.
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.
Normally no.
When the appearance is null, a new one should be generated from the field value..
src/core/annotation.js
Outdated
@@ -138,6 +148,7 @@ class AnnotationFactory { | |||
attachments, | |||
xfaDatasets, | |||
collectFields, | |||
needAppearances, |
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.
Given
Line 79 in 987062c
pdfManager.ensureCatalog("acroForm"), |
needAppearances, | |
needAppearances: (acroForm instanceof Dict && acroForm.get("NeedAppearances)) || false, |
18a9b49
to
6221f7f
Compare
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.
r=me, with passing tests; thank you!
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @calixteman received. Current queue size: 1 Live output at: http://54.241.84.105:8877/2f856d9e3d7e740/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @calixteman received. Current queue size: 1 Live output at: http://54.193.163.58:8877/ec8896a3056a300/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/2f856d9e3d7e740/output.txt Total script time: 3.92 mins
Image differences available at: http://54.241.84.105:8877/2f856d9e3d7e740/reftest-analyzer.html#web=eq.log |
6221f7f
to
c8360d0
Compare
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.241.84.105:8877/cf49613e5a6475b/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @calixteman received. Current queue size: 1 Live output at: http://54.193.163.58:8877/af3b00702ab3e94/output.txt |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/ec8896a3056a300/output.txt Total script time: 7.17 mins
Image differences available at: http://54.193.163.58:8877/ec8896a3056a300/reftest-analyzer.html#web=eq.log |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/cf49613e5a6475b/output.txt Total script time: 24.95 mins
Image differences available at: http://54.241.84.105:8877/cf49613e5a6475b/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/af3b00702ab3e94/output.txt Total script time: 29.97 mins
Image differences available at: http://54.193.163.58:8877/af3b00702ab3e94/reftest-analyzer.html#web=eq.log |
c8360d0
to
3e08113
Compare
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.241.84.105:8877/d80fe200618527a/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.193.163.58:8877/78fbc63a7b218e9/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/d80fe200618527a/output.txt Total script time: 24.81 mins
Image differences available at: http://54.241.84.105:8877/d80fe200618527a/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/78fbc63a7b218e9/output.txt Total script time: 29.04 mins
Image differences available at: http://54.193.163.58:8877/78fbc63a7b218e9/reftest-analyzer.html#web=eq.log |
3e08113
to
8a6acbf
Compare
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.
Revoking approval, while there's still ref-test regressions.
src/core/annotation.js
Outdated
attachments, | ||
xfaDatasets, | ||
collectFields, | ||
needAppearances: | ||
!collectFields && (acroFormDict.get("NeedAppearances") || false), |
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.
Given that this should be a boolean value, can we please check explicitly for that to prevent any future surprises/bugs in corrupt documents?
For example, what if the entry happens to be a non-empty string or any other truthy value?
!collectFields && (acroFormDict.get("NeedAppearances") || false), | |
!collectFields && acroFormDict.get("NeedAppearances") === true, |
8a6acbf
to
b650c4e
Compare
/botio test |
Sorry, but that still doesn't explain why it can be reproduced in the viewer with |
Very likely because of: Line 2354 in 098ca67
|
b650c4e
to
38d0593
Compare
I still don't at all understand why these changes lead to the double rendering here, and I don't think it's correct to just leave this as-is. (And this PR now looks way to risky to land less than a week before the next release...) |
The annotation is rendered one time in the |
The pdf has the flag |
Maybe the fix is just to add |
Based on a brief look the solution is probably to update the
No, it must be possible to render annotations without also enabling forms (this was the behaviour for years). |
38d0593
to
755e6ce
Compare
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.241.84.105:8877/bf7b8f4607e84bf/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.193.163.58:8877/3e9a664a01f42b2/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/bf7b8f4607e84bf/output.txt Total script time: 25.07 mins
Image differences available at: http://54.241.84.105:8877/bf7b8f4607e84bf/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/3e9a664a01f42b2/output.txt Total script time: 29.78 mins
Image differences available at: http://54.193.163.58:8877/3e9a664a01f42b2/reftest-analyzer.html#web=eq.log |
src/core/annotation.js
Outdated
@@ -3020,18 +3036,26 @@ class ChoiceWidgetAnnotation extends WidgetAnnotation { | |||
return super._getAppearance(evaluator, task, annotationStorage); | |||
} | |||
|
|||
if (!annotationStorage) { | |||
if (!annotationStorage && this.appearance) { |
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.
Won't this cause an error to be thrown below if annotationStorage === undefined
and this.appearance === undefined
(or this.appearance === null
)?
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.
Yep, you're right, thanks for catching that.
I updated to have something similar to what we have in the appearance getter for text fields.
…ue (bug 1796741) When a form isn't changed, we used the appearances we had in the file, but when /NeedAppearances is true, all the appearances have to be regenerated whatever they're.
755e6ce
to
9f95a14
Compare
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.241.84.105:8877/353591a9847c29b/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @calixteman received. Current queue size: 0 Live output at: http://54.193.163.58:8877/537d5f92a158de0/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/353591a9847c29b/output.txt Total script time: 25.23 mins
Image differences available at: http://54.241.84.105:8877/353591a9847c29b/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/537d5f92a158de0/output.txt Total script time: 30.48 mins
Image differences available at: http://54.193.163.58:8877/537d5f92a158de0/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.
Hopefully we've now fixed all problems here, since the remaining movement in the tests should be expected/improvements.
Given that the double rendering has now been fully understood, and that the fix was pretty simple and straightforward I'm less worried about that.
Your call whether to land this now, or wait until after the upcoming release from the 3
-branch.
/botio makeref |
From: Bot.io (Linux m4)ReceivedCommand cmd_makeref from @calixteman received. Current queue size: 0 Live output at: http://54.241.84.105:8877/769f9c638febd8a/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_makeref from @calixteman received. Current queue size: 0 Live output at: http://54.193.163.58:8877/404000e086d6906/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/769f9c638febd8a/output.txt Total script time: 21.22 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.193.163.58:8877/404000e086d6906/output.txt Total script time: 23.23 mins
|
When a form isn't changed, we used the appearances we had in the file, but when /NeedAppearances is true, all the appearances have to be regenerated whatever they're.