1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Merge pull request #18387 from Snuffleupagus/RenderingIntentFlag-IS_EDITING

Move the internal API/Worker `isEditing`-state into `RenderingIntentFlag`
This commit is contained in:
Tim van der Meij 2024-07-04 23:42:44 +02:00 committed by GitHub
commit 9065ee465b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 6 deletions

View file

@ -411,7 +411,6 @@ class Page {
intent,
cacheKey,
annotationStorage = null,
isEditing = false,
modifiedIds = null,
}) {
const contentStreamPromise = this.getContentStream();
@ -570,6 +569,7 @@ class Page {
return { length: pageOpList.totalLength };
}
const renderForms = !!(intent & RenderingIntentFlag.ANNOTATIONS_FORMS),
isEditing = !!(intent & RenderingIntentFlag.IS_EDITING),
intentAny = !!(intent & RenderingIntentFlag.ANY),
intentDisplay = !!(intent & RenderingIntentFlag.DISPLAY),
intentPrint = !!(intent & RenderingIntentFlag.PRINT);

View file

@ -752,7 +752,6 @@ class WorkerMessageHandler {
intent: data.intent,
cacheKey: data.cacheKey,
annotationStorage: data.annotationStorage,
isEditing: data.isEditing,
modifiedIds: data.modifiedIds,
})
.then(

View file

@ -1818,7 +1818,6 @@ class PDFPageProxy {
renderingIntent,
cacheKey,
annotationStorageSerializable,
isEditing,
modifiedIds,
}) {
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
@ -1836,7 +1835,6 @@ class PDFPageProxy {
intent: renderingIntent,
cacheKey,
annotationStorage: map,
isEditing,
modifiedIds,
},
transfer
@ -2473,6 +2471,9 @@ class WorkerTransport {
warn(`getRenderingIntent - invalid annotationMode: ${annotationMode}`);
}
if (isEditing) {
renderingIntent += RenderingIntentFlag.IS_EDITING;
}
if (isOpList) {
renderingIntent += RenderingIntentFlag.OPLIST;
}
@ -2483,7 +2484,6 @@ class WorkerTransport {
const cacheKeyBuf = [
renderingIntent,
annotationStorageSerializable.hash,
isEditing ? 1 : 0,
modifiedIdsHash,
];
@ -2491,7 +2491,6 @@ class WorkerTransport {
renderingIntent,
cacheKey: cacheKeyBuf.join("_"),
annotationStorageSerializable,
isEditing,
modifiedIds,
};
}

View file

@ -41,10 +41,12 @@ const BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR;
* how these flags are being used:
* - ANY, DISPLAY, and PRINT are the normal rendering intents, note the
* `PDFPageProxy.{render, getOperatorList, getAnnotations}`-methods.
* - SAVE is used, on the worker-thread, when saving modified annotations.
* - ANNOTATIONS_FORMS, ANNOTATIONS_STORAGE, ANNOTATIONS_DISABLE control which
* annotations are rendered onto the canvas (i.e. by being included in the
* operatorList), note the `PDFPageProxy.{render, getOperatorList}`-methods
* and their `annotationMode`-option.
* - IS_EDITING is used when editing is active in the viewer.
* - OPLIST is used with the `PDFPageProxy.getOperatorList`-method, note the
* `OperatorList`-constructor (on the worker-thread).
*/
@ -56,6 +58,7 @@ const RenderingIntentFlag = {
ANNOTATIONS_FORMS: 0x10,
ANNOTATIONS_STORAGE: 0x20,
ANNOTATIONS_DISABLE: 0x40,
IS_EDITING: 0x80,
OPLIST: 0x100,
};