Introduce some logical assignment in the src/core/ folder

This commit is contained in:
Jonas Jenwald 2022-07-17 11:24:05 +02:00
parent 317abd6d07
commit d950b91c4e
20 changed files with 62 additions and 103 deletions

View file

@ -495,12 +495,8 @@ class Page {
for (const { opList, separateForm, separateCanvas } of opLists) {
pageOpList.addOpList(opList);
if (separateForm) {
form = separateForm;
}
if (separateCanvas) {
canvas = separateCanvas;
}
form ||= separateForm;
canvas ||= separateCanvas;
}
pageOpList.flush(
/* lastChunk = */ true,
@ -580,8 +576,8 @@ class Page {
return [];
}
const textContentPromises = [];
const annotationsData = [];
const annotationsData = [],
textContentPromises = [];
let partialEvaluator;
const intentAny = !!(intent & RenderingIntentFlag.ANY),
@ -597,19 +593,18 @@ class Page {
}
if (annotation.hasTextContent && isVisible) {
if (!partialEvaluator) {
partialEvaluator = new PartialEvaluator({
xref: this.xref,
handler,
pageIndex: this.pageIndex,
idFactory: this._localIdFactory,
fontCache: this.fontCache,
builtInCMapCache: this.builtInCMapCache,
standardFontDataCache: this.standardFontDataCache,
globalImageCache: this.globalImageCache,
options: this.evaluatorOptions,
});
}
partialEvaluator ||= new PartialEvaluator({
xref: this.xref,
handler,
pageIndex: this.pageIndex,
idFactory: this._localIdFactory,
fontCache: this.fontCache,
builtInCMapCache: this.builtInCMapCache,
standardFontDataCache: this.standardFontDataCache,
globalImageCache: this.globalImageCache,
options: this.evaluatorOptions,
});
textContentPromises.push(
annotation
.extractTextContent(partialEvaluator, task, this.view)
@ -665,10 +660,7 @@ class Page {
continue;
}
if (annotation instanceof PopupAnnotation) {
if (!popupAnnotations) {
popupAnnotations = [];
}
popupAnnotations.push(annotation);
(popupAnnotations ||= []).push(annotation);
continue;
}
sortedAnnotations.push(annotation);