Use appearance stream to render locked annotations (bug 1723568)

This commit is contained in:
Calixte Denizet 2023-03-07 12:58:59 +01:00
parent e11371c75f
commit 8db77cc361
4 changed files with 26 additions and 1 deletions

View File

@ -471,6 +471,12 @@ class Annotation {
this._streams.push(this.appearance);
}
// The annotation cannot be changed (neither its position/visibility nor its
// contents), hence we can just display its appearance and don't generate
// a HTML element for it.
const isLocked = !!(this.flags & AnnotationFlag.LOCKED);
const isContentLocked = !!(this.flags & AnnotationFlag.LOCKEDCONTENTS);
// Expose public properties using a data object.
this.data = {
annotationFlags: this.flags,
@ -487,6 +493,7 @@ class Annotation {
subtype: params.subtype,
hasOwnCanvas: false,
noRotate: !!(this.flags & AnnotationFlag.NOROTATE),
noHTML: isLocked && isContentLocked,
};
if (params.collectFields) {
@ -1694,7 +1701,11 @@ class WidgetAnnotation extends Annotation {
) {
// Do not render form elements on the canvas when interactive forms are
// enabled. The display layer is responsible for rendering them instead.
if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
if (
renderForms &&
!(this instanceof SignatureWidgetAnnotation) &&
!this.data.noHTML
) {
return {
opList: new OperatorList(),
separateForm: true,

View File

@ -2621,6 +2621,9 @@ class AnnotationLayer {
let zIndex = 0;
for (const data of annotations) {
if (data.noHTML) {
continue;
}
if (data.annotationType !== AnnotationType.POPUP) {
const { width, height } = getRectDims(data.rect);
if (width <= 0 || height <= 0) {

View File

@ -0,0 +1,2 @@
https://bugzilla.mozilla.org/attachment.cgi?id=9234308

View File

@ -7421,5 +7421,14 @@
"type": "eq",
"annotations": true,
"rotation": 270
},
{
"id": "bug1723568",
"file": "pdfs/bug1723568.pdf",
"md5": "c5cc9f1e01d195b96eadf8be0a819578",
"rounds": 1,
"link": true,
"type": "eq",
"forms": true
}
]