1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

[Regression] Re-factor the *internal* renderInteractiveForms handling, since it's currently subtly wrong

The value of the `renderInteractiveForms` parameter, as passed to the `PDFPageProxy.render` method, will (potentially) affect the size/content of the operatorList that's returned from the worker (for documents with forms).
Given that operatorLists will generally, unless they contain huge images, be cached in the API, repeated `PDFPageProxy.render` calls that *only* change the `renderInteractiveForms` parameter can thus return an incorrect operatorList.

As far as I can tell, this *subtle* bug has existed ever since `renderInteractiveForms`-support was first added in PR 7633 (which is almost five years ago).
With the previous patch, fixing this is now really simple by "encoding" the `renderInteractiveForms` parameter in the *internal* renderingIntent handling.
This commit is contained in:
Jonas Jenwald 2021-08-05 11:04:09 +02:00
parent 47f94235ab
commit 107efdb178
4 changed files with 12 additions and 14 deletions

View file

@ -320,14 +320,7 @@ class Page {
});
}
getOperatorList({
handler,
sink,
task,
intent,
renderInteractiveForms,
annotationStorage,
}) {
getOperatorList({ handler, sink, task, intent, annotationStorage }) {
const contentStreamPromise = this.getContentStream(handler);
const resourcesPromise = this.loadResources([
"ColorSpace",
@ -384,7 +377,8 @@ class Page {
pageOpList.flush(true);
return { length: pageOpList.totalLength };
}
const intentAny = !!(intent & RenderingIntentFlag.ANY),
const renderForms = !!(intent & RenderingIntentFlag.ANNOTATION_FORMS),
intentAny = !!(intent & RenderingIntentFlag.ANY),
intentDisplay = !!(intent & RenderingIntentFlag.DISPLAY),
intentPrint = !!(intent & RenderingIntentFlag.PRINT);
@ -402,7 +396,7 @@ class Page {
.getOperatorList(
partialEvaluator,
task,
renderInteractiveForms,
renderForms,
annotationStorage
)
.catch(function (reason) {