1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 17:48:07 +02:00

Merge pull request #14201 from Snuffleupagus/bug-1219400

Use the correct border-style for Annotations, when a dash array is specified (bug 1219400)
This commit is contained in:
Tim van der Meij 2021-10-30 12:39:46 +02:00 committed by GitHub
commit ec1633c33c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 2 deletions

View file

@ -660,7 +660,7 @@ class Annotation {
if (array.length === 4) {
// Dash array available
this.borderStyle.setDashArray(array[3]);
this.borderStyle.setDashArray(array[3], /* forceStyle = */ true);
}
}
} else {
@ -981,8 +981,9 @@ class AnnotationBorderStyle {
* @public
* @memberof AnnotationBorderStyle
* @param {Array} dashArray - The dash array with at least one element
* @param {boolean} [forceStyle]
*/
setDashArray(dashArray) {
setDashArray(dashArray, forceStyle = false) {
// We validate the dash array, but we do not use it because CSS does not
// allow us to change spacing of dashes. For more information, visit
// http://www.w3.org/TR/css3-background/#the-border-style.
@ -1002,6 +1003,12 @@ class AnnotationBorderStyle {
}
if (isValid && !allZeros) {
this.dashArray = dashArray;
if (forceStyle) {
// Even though we cannot use the dash array in the display layer,
// at least ensure that we use the correct border-style.
this.setStyle(Name.get("D"));
}
} else {
this.width = 0; // Adobe behavior when the array is invalid.
}