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

Check OffscreenCanvas support once on the worker-thread

Currently we repeat the `FeatureTest.isOffscreenCanvasSupported` checks all over the worker-thread code, and with upcoming changes this will become even "worse".

Hence this patch, which changes the *worker-thread* default value for the `isOffscreenCanvasSupported`-parameter to `false` and moves the feature-testing into the `BasePdfManager`-constructor.

*Please note:* This patch is written using the GitHub UI, since I'm currently without a dev machine, so hopefully it works correctly.
This commit is contained in:
Jonas Jenwald 2023-02-27 12:27:28 +01:00 committed by GitHub
parent 2da2ac492e
commit 45c332110e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 16 deletions

View file

@ -23,7 +23,6 @@ import {
AnnotationType,
assert,
BASELINE_FACTOR,
FeatureTest,
getModificationDate,
IDENTITY_MATRIX,
LINE_DESCENT_FACTOR,
@ -147,7 +146,6 @@ class AnnotationFactory {
!collectFields && acroFormDict.get("NeedAppearances") === true,
pageIndex,
isOffscreenCanvasSupported:
FeatureTest.isOffscreenCanvasSupported &&
pdfManager.evaluatorOptions.isOffscreenCanvasSupported,
};
@ -306,10 +304,8 @@ class AnnotationFactory {
}
const xref = evaluator.xref;
const { isOffscreenCanvasSupported } = evaluator.options;
const promises = [];
const isOffscreenCanvasSupported =
FeatureTest.isOffscreenCanvasSupported &&
evaluator.options.isOffscreenCanvasSupported;
for (const annotation of annotations) {
switch (annotation.annotationType) {
case AnnotationEditorType.FREETEXT: