Add default icons for FileAttachment annotations (bug 1230933)

*Please note:* This "borrows" the icons from Thunderbird.

According to the PDF specification, see https://web.archive.org/web/20220309040754if_/https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf#G11.2096626, we should be providing default icons for FileAttachment annotations without appearances.
This commit is contained in:
Jonas Jenwald 2022-11-25 17:00:57 +01:00
parent 4f1b6f345b
commit aa5b678f94
6 changed files with 42 additions and 2 deletions

View file

@ -2509,7 +2509,20 @@ class FileAttachmentAnnotationElement extends AnnotationElement {
render() {
this.container.className = "fileAttachmentAnnotation";
const trigger = document.createElement("div");
let trigger;
if (this.data.hasAppearance) {
trigger = document.createElement("div");
} else {
// Unfortunately it seems that it's not clearly specified exactly what
// names are actually valid, since Table 184 contains:
// Conforming readers shall provide predefined icon appearances for at
// least the following standard names: GraphPushPin, PaperclipTag.
// Additional names may be supported as well. Default value: PushPin.
trigger = document.createElement("img");
trigger.src = `${this.imageResourcesPath}annotation-${
/paperclip/i.test(this.data.name) ? "paperclip" : "pushpin"
}.svg`;
}
trigger.className = "popupTriggerArea";
trigger.addEventListener("dblclick", this._download.bind(this));