1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #19128 from nicolo-ribaudo/draw-page-portion

[api-minor] Render high-res partial page views when falling back to CSS zoom (bug 1492303)
This commit is contained in:
Jonas Jenwald 2025-02-21 22:24:41 +01:00 committed by GitHub
commit 553ec7babc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 1466 additions and 311 deletions

View file

@ -3232,17 +3232,27 @@ class PDFObjects {
class RenderTask {
#internalRenderTask = null;
/**
* Callback for incremental rendering -- a function that will be called
* each time the rendering is paused. To continue rendering call the
* function that is the first argument to the callback.
* @type {function}
*/
onContinue = null;
/**
* A function that will be synchronously called when the rendering tasks
* finishes with an error (either because of an actual error, or because the
* rendering is cancelled).
*
* @type {function}
* @param {Error} error
*/
onError = null;
constructor(internalRenderTask) {
this.#internalRenderTask = internalRenderTask;
/**
* Callback for incremental rendering -- a function that will be called
* each time the rendering is paused. To continue rendering call the
* function that is the first argument to the callback.
* @type {function}
*/
this.onContinue = null;
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
// For testing purposes.
Object.defineProperty(this, "getOperatorList", {
@ -3399,13 +3409,13 @@ class InternalRenderTask {
}
InternalRenderTask.#canvasInUse.delete(this._canvas);
this.callback(
error ||
new RenderingCancelledException(
`Rendering cancelled, page ${this._pageIndex + 1}`,
extraDelay
)
error ||= new RenderingCancelledException(
`Rendering cancelled, page ${this._pageIndex + 1}`,
extraDelay
);
this.callback(error);
this.task.onError?.(error);
}
operatorListChanged() {