diff --git a/src/display/display_utils.js b/src/display/display_utils.js index e12c702a0..61fc8585f 100644 --- a/src/display/display_utils.js +++ b/src/display/display_utils.js @@ -799,7 +799,7 @@ class CSSConstants { } function applyOpacity(r, g, b, opacity) { - opacity = Math.min(Math.max(opacity ?? 1, 0), 1); + opacity = MathClamp(opacity ?? 1, 0, 1); const white = 255 * (1 - opacity); r = Math.round(r * opacity + white); g = Math.round(g * opacity + white); diff --git a/src/shared/util.js b/src/shared/util.js index df9138133..ccbc2f56a 100644 --- a/src/shared/util.js +++ b/src/shared/util.js @@ -1235,9 +1235,12 @@ function MathClamp(v, min, max) { return Math.min(Math.max(v, min), max); } -// TODO: Remove this once the `javascript.options.experimental.math_sumprecise` -// preference is removed from Firefox. -if (typeof Math.sumPrecise !== "function") { +// TODO: Remove this once `Math.sumPrecise` is generally available. +if ( + (typeof PDFJSDev === "undefined" || + PDFJSDev.test("SKIP_BABEL && !MOZCENTRAL")) && + typeof Math.sumPrecise !== "function" +) { // Note that this isn't a "proper" polyfill, but since we're only using it to // replace `Array.prototype.reduce()` invocations it should be fine. Math.sumPrecise = function (numbers) {