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

View File

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

View File

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

View File

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