Inline loadStyles calls in the rasterization classes in test/driver.js

The wrapper functions in this case only really added indirection, so
this commit simplifies the code a bit.
This commit is contained in:
Tim van der Meij 2021-12-05 13:46:41 +01:00
parent a58700b0dc
commit 1d1f713bfc
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762

View File

@ -154,10 +154,6 @@ var rasterizeTextLayer = (function rasterizeTextLayerClosure() {
}, },
}; };
function getTextLayerStyle() {
return loadStyles(styles);
}
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
function rasterizeTextLayer( function rasterizeTextLayer(
ctx, ctx,
@ -180,7 +176,7 @@ var rasterizeTextLayer = (function rasterizeTextLayerClosure() {
foreignObject.setAttribute("width", viewport.width + "px"); foreignObject.setAttribute("width", viewport.width + "px");
foreignObject.setAttribute("height", viewport.height + "px"); foreignObject.setAttribute("height", viewport.height + "px");
var style = document.createElement("style"); var style = document.createElement("style");
var stylePromise = getTextLayerStyle(); var stylePromise = loadStyles(styles);
foreignObject.appendChild(style); foreignObject.appendChild(style);
var div = document.createElement("div"); var div = document.createElement("div");
div.className = "textLayer"; div.className = "textLayer";
@ -237,10 +233,6 @@ var rasterizeAnnotationLayer = (function rasterizeAnnotationLayerClosure() {
}, },
}; };
function getAnnotationLayerStyle() {
return loadStyles(styles);
}
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
function rasterizeAnnotationLayer( function rasterizeAnnotationLayer(
ctx, ctx,
@ -264,7 +256,7 @@ var rasterizeAnnotationLayer = (function rasterizeAnnotationLayerClosure() {
foreignObject.setAttribute("width", viewport.width + "px"); foreignObject.setAttribute("width", viewport.width + "px");
foreignObject.setAttribute("height", viewport.height + "px"); foreignObject.setAttribute("height", viewport.height + "px");
var style = document.createElement("style"); var style = document.createElement("style");
var stylePromise = getAnnotationLayerStyle(); var stylePromise = loadStyles(styles);
foreignObject.appendChild(style); foreignObject.appendChild(style);
var div = document.createElement("div"); var div = document.createElement("div");
div.className = "annotationLayer"; div.className = "annotationLayer";
@ -322,10 +314,6 @@ var rasterizeXfaLayer = (function rasterizeXfaLayerClosure() {
}, },
}; };
function getXfaLayerStyle() {
return loadStyles(styles);
}
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
function rasterizeXfaLayer( function rasterizeXfaLayer(
ctx, ctx,
@ -349,7 +337,7 @@ var rasterizeXfaLayer = (function rasterizeXfaLayerClosure() {
foreignObject.setAttribute("width", viewport.width + "px"); foreignObject.setAttribute("width", viewport.width + "px");
foreignObject.setAttribute("height", viewport.height + "px"); foreignObject.setAttribute("height", viewport.height + "px");
const style = document.createElement("style"); const style = document.createElement("style");
const stylePromise = getXfaLayerStyle(); const stylePromise = loadStyles(styles);
foreignObject.appendChild(style); foreignObject.appendChild(style);
const div = document.createElement("div"); const div = document.createElement("div");
foreignObject.appendChild(div); foreignObject.appendChild(div);