Skip to content

Commit

Permalink
Merge pull request #18394 from Snuffleupagus/rm-annotation-getOperato…
Browse files Browse the repository at this point in the history
…rList-renderForms

Remove the `renderForms` parameter from the Annotation `getOperatorList` methods
  • Loading branch information
timvandermeij authored Jul 5, 2024
2 parents 9065ee4 + 38528d1 commit cf9dfbc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 58 deletions.
51 changes: 7 additions & 44 deletions src/core/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -1105,13 +1105,7 @@ class Annotation {
});
}

async getOperatorList(
evaluator,
task,
intent,
renderForms,
annotationStorage
) {
async getOperatorList(evaluator, task, intent, annotationStorage) {
const { hasOwnCanvas, id, rect } = this.data;
let appearance = this.appearance;
const isUsingOwnCanvas = !!(
Expand Down Expand Up @@ -1959,17 +1953,11 @@ class WidgetAnnotation extends Annotation {
return str;
}

async getOperatorList(
evaluator,
task,
intent,
renderForms,
annotationStorage
) {
async getOperatorList(evaluator, task, intent, annotationStorage) {
// Do not render form elements on the canvas when interactive forms are
// enabled. The display layer is responsible for rendering them instead.
if (
renderForms &&
intent & RenderingIntentFlag.ANNOTATIONS_FORMS &&
!(this instanceof SignatureWidgetAnnotation) &&
!this.data.noHTML &&
!this.data.hasOwnCanvas
Expand All @@ -1982,13 +1970,7 @@ class WidgetAnnotation extends Annotation {
}

if (!this._hasText) {
return super.getOperatorList(
evaluator,
task,
intent,
renderForms,
annotationStorage
);
return super.getOperatorList(evaluator, task, intent, annotationStorage);
}

const content = await this._getAppearance(
Expand All @@ -1998,13 +1980,7 @@ class WidgetAnnotation extends Annotation {
annotationStorage
);
if (this.appearance && content === null) {
return super.getOperatorList(
evaluator,
task,
intent,
renderForms,
annotationStorage
);
return super.getOperatorList(evaluator, task, intent, annotationStorage);
}

const opList = new OperatorList();
Expand Down Expand Up @@ -2934,13 +2910,7 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
}
}

async getOperatorList(
evaluator,
task,
intent,
renderForms,
annotationStorage
) {
async getOperatorList(evaluator, task, intent, annotationStorage) {
if (this.data.pushButton) {
return super.getOperatorList(
evaluator,
Expand All @@ -2962,13 +2932,7 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
if (value === null && this.appearance) {
// Nothing in the annotationStorage.
// But we've a default appearance so use it.
return super.getOperatorList(
evaluator,
task,
intent,
renderForms,
annotationStorage
);
return super.getOperatorList(evaluator, task, intent, annotationStorage);
}

if (value === null || value === undefined) {
Expand Down Expand Up @@ -3001,7 +2965,6 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
evaluator,
task,
intent,
renderForms,
annotationStorage
);
this.appearance = savedAppearance;
Expand Down
1 change: 0 additions & 1 deletion src/core/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,6 @@ class Page {
partialEvaluator,
task,
intent,
renderForms,
annotationStorage
)
.catch(function (reason) {
Expand Down
13 changes: 0 additions & 13 deletions test/unit/annotation_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,6 @@ describe("annotation", function () {
partialEvaluator,
task,
RenderingIntentFlag.PRINT,
false,
annotationStorage
);
expect(opList.argsArray.length).toEqual(3);
Expand Down Expand Up @@ -2523,7 +2522,6 @@ describe("annotation", function () {
checkboxEvaluator,
task,
RenderingIntentFlag.PRINT,
false,
annotationStorage
);
expect(opList.argsArray.length).toEqual(5);
Expand Down Expand Up @@ -2584,7 +2582,6 @@ describe("annotation", function () {
partialEvaluator,
task,
RenderingIntentFlag.PRINT,
false,
annotationStorage
);
expect(opList1.argsArray.length).toEqual(3);
Expand All @@ -2608,7 +2605,6 @@ describe("annotation", function () {
partialEvaluator,
task,
RenderingIntentFlag.PRINT,
false,
annotationStorage
);
expect(opList2.argsArray.length).toEqual(3);
Expand Down Expand Up @@ -2670,7 +2666,6 @@ describe("annotation", function () {
partialEvaluator,
task,
RenderingIntentFlag.PRINT,
false,
annotationStorage
);
expect(opList.argsArray.length).toEqual(3);
Expand Down Expand Up @@ -2732,7 +2727,6 @@ describe("annotation", function () {
partialEvaluator,
task,
RenderingIntentFlag.PRINT,
false,
annotationStorage
);
expect(opList.argsArray.length).toEqual(3);
Expand Down Expand Up @@ -2986,7 +2980,6 @@ describe("annotation", function () {
partialEvaluator,
task,
RenderingIntentFlag.PRINT,
false,
annotationStorage
);
expect(opList1.argsArray.length).toEqual(3);
Expand All @@ -3010,7 +3003,6 @@ describe("annotation", function () {
partialEvaluator,
task,
RenderingIntentFlag.PRINT,
false,
annotationStorage
);
expect(opList2.argsArray.length).toEqual(3);
Expand Down Expand Up @@ -3070,7 +3062,6 @@ describe("annotation", function () {
partialEvaluator,
task,
RenderingIntentFlag.PRINT,
false,
annotationStorage
);
expect(opList.argsArray.length).toEqual(3);
Expand Down Expand Up @@ -4242,7 +4233,6 @@ describe("annotation", function () {
partialEvaluator,
task,
RenderingIntentFlag.PRINT,
false,
null
);

Expand Down Expand Up @@ -4503,7 +4493,6 @@ describe("annotation", function () {
partialEvaluator,
task,
RenderingIntentFlag.PRINT,
false,
null
);

Expand Down Expand Up @@ -4672,7 +4661,6 @@ describe("annotation", function () {
partialEvaluator,
task,
RenderingIntentFlag.PRINT,
false,
null
);

Expand Down Expand Up @@ -4791,7 +4779,6 @@ describe("annotation", function () {
partialEvaluator,
task,
RenderingIntentFlag.PRINT,
false,
null
);

Expand Down

0 comments on commit cf9dfbc

Please sign in to comment.