[api-minor] Remove the TextLayer timeout
parameter (PR 15742 follow-up)
The deprecation is included in the current release, i.e. version `3.1.81`, and given the edge-case nature of this option I really don't think that we need to keep it deprecated for multiple releases.
This commit is contained in:
parent
1f082d3e1d
commit
7c25b1b455
@ -18,7 +18,6 @@ import {
|
|||||||
createPromiseCapability,
|
createPromiseCapability,
|
||||||
Util,
|
Util,
|
||||||
} from "../shared/util.js";
|
} from "../shared/util.js";
|
||||||
import { deprecated } from "./display_utils.js";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Text layer render parameters.
|
* Text layer render parameters.
|
||||||
@ -38,8 +37,6 @@ import { deprecated } from "./display_utils.js";
|
|||||||
* @property {Array<string>} [textContentItemsStr] - Strings that correspond to
|
* @property {Array<string>} [textContentItemsStr] - Strings that correspond to
|
||||||
* the `str` property of the text items of the textContent input.
|
* the `str` property of the text items of the textContent input.
|
||||||
* This is output and shall initially be set to an empty array.
|
* This is output and shall initially be set to an empty array.
|
||||||
* @property {number} [timeout] - Delay in milliseconds before rendering of the
|
|
||||||
* text runs occurs.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const MAX_TEXT_DIVS_TO_RENDER = 100000;
|
const MAX_TEXT_DIVS_TO_RENDER = 100000;
|
||||||
@ -250,7 +247,6 @@ class TextLayerRenderTask {
|
|||||||
this._renderingDone = false;
|
this._renderingDone = false;
|
||||||
this._canceled = false;
|
this._canceled = false;
|
||||||
this._capability = createPromiseCapability();
|
this._capability = createPromiseCapability();
|
||||||
this._renderTimer = null;
|
|
||||||
this._devicePixelRatio = globalThis.devicePixelRatio || 1;
|
this._devicePixelRatio = globalThis.devicePixelRatio || 1;
|
||||||
|
|
||||||
// Always clean-up the temporary canvas once rendering is no longer pending.
|
// Always clean-up the temporary canvas once rendering is no longer pending.
|
||||||
@ -293,10 +289,6 @@ class TextLayerRenderTask {
|
|||||||
});
|
});
|
||||||
this._reader = null;
|
this._reader = null;
|
||||||
}
|
}
|
||||||
if (this._renderTimer !== null) {
|
|
||||||
clearTimeout(this._renderTimer);
|
|
||||||
this._renderTimer = null;
|
|
||||||
}
|
|
||||||
this._capability.reject(new Error("TextLayer task cancelled."));
|
this._capability.reject(new Error("TextLayer task cancelled."));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,7 +370,7 @@ class TextLayerRenderTask {
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_render(timeout = 0) {
|
_render() {
|
||||||
const capability = createPromiseCapability();
|
const capability = createPromiseCapability();
|
||||||
let styleCache = Object.create(null);
|
let styleCache = Object.create(null);
|
||||||
|
|
||||||
@ -417,23 +409,7 @@ class TextLayerRenderTask {
|
|||||||
|
|
||||||
capability.promise.then(() => {
|
capability.promise.then(() => {
|
||||||
styleCache = null;
|
styleCache = null;
|
||||||
if (!timeout) {
|
|
||||||
// Render right away
|
|
||||||
render(this);
|
render(this);
|
||||||
} else {
|
|
||||||
if (typeof PDFJSDev !== "undefined" && !PDFJSDev.test("GENERIC")) {
|
|
||||||
throw new Error("The `timeout` parameter was removed.");
|
|
||||||
}
|
|
||||||
deprecated(
|
|
||||||
"The TextLayerRender `timeout` parameter will be removed in the " +
|
|
||||||
"future, since streaming of textContent has made it obsolete."
|
|
||||||
);
|
|
||||||
// Schedule
|
|
||||||
this._renderTimer = setTimeout(() => {
|
|
||||||
render(this);
|
|
||||||
this._renderTimer = null;
|
|
||||||
}, timeout);
|
|
||||||
}
|
|
||||||
}, this._capability.reject);
|
}, this._capability.reject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -451,7 +427,7 @@ function renderTextLayer(renderParameters) {
|
|||||||
textDivs: renderParameters.textDivs,
|
textDivs: renderParameters.textDivs,
|
||||||
textContentItemsStr: renderParameters.textContentItemsStr,
|
textContentItemsStr: renderParameters.textContentItemsStr,
|
||||||
});
|
});
|
||||||
task._render(renderParameters.timeout);
|
task._render();
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,11 +79,8 @@ class TextLayerBuilder {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the text layer.
|
* Renders the text layer.
|
||||||
*
|
|
||||||
* @param {number} [timeout] - Wait for a specified amount of milliseconds
|
|
||||||
* before rendering.
|
|
||||||
*/
|
*/
|
||||||
render(timeout = 0) {
|
render() {
|
||||||
if (!(this.textContent || this.textContentStream) || this.renderingDone) {
|
if (!(this.textContent || this.textContentStream) || this.renderingDone) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -101,7 +98,6 @@ class TextLayerBuilder {
|
|||||||
viewport: this.viewport,
|
viewport: this.viewport,
|
||||||
textDivs: this.textDivs,
|
textDivs: this.textDivs,
|
||||||
textContentItemsStr: this.textContentItemsStr,
|
textContentItemsStr: this.textContentItemsStr,
|
||||||
timeout,
|
|
||||||
});
|
});
|
||||||
this.textLayerRenderTask.promise.then(
|
this.textLayerRenderTask.promise.then(
|
||||||
() => {
|
() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user