From 118da8e85d9cb28c40252e6e94bee0bd2374b64f Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Thu, 25 Aug 2022 12:58:50 +0200 Subject: [PATCH] [api-minor] Deprecate the `imageLayer` functionality This functionality has never been used anywhere in the PDF.js library/viewer itself, since it was added in 2013. Furthermore this functionality is, and has always been, *completely untested* and also unmaintained. Finally, there's (at least) one old issue about `appendImage` not returning the correct position; see issue 4182. All-in-all, it seems that keeping very old, untested, unmaintained, and partially broken code around probably isn't what we want here. (On the off-chance that any future a11y-work requires getting access to image-positions, it'd likely be much better to re-implement the necessary functionality from scratch and also make sure that it's properly tested from the beginning.) --- src/display/canvas.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/display/canvas.js b/src/display/canvas.js index eebfdbcc4..bf959b24f 100644 --- a/src/display/canvas.js +++ b/src/display/canvas.js @@ -13,6 +13,13 @@ * limitations under the License. */ +import { + deprecated, + getCurrentTransform, + getCurrentTransformInverse, + getRGB, + PixelsPerInch, +} from "./display_utils.js"; import { FeatureTest, FONT_IDENTITY_MATRIX, @@ -26,12 +33,6 @@ import { Util, warn, } from "../shared/util.js"; -import { - getCurrentTransform, - getCurrentTransformInverse, - getRGB, - PixelsPerInch, -} from "./display_utils.js"; import { getShadingPattern, PathType, @@ -1184,6 +1185,9 @@ class CanvasGraphics { this.baseTransform = getCurrentTransform(this.ctx); if (this.imageLayer) { + deprecated( + "The `imageLayer` functionality will be removed in the future." + ); this.imageLayer.beginLayout(); } }