Merge pull request #22539 from calixteman/hidden_form_state

Save and restore the state of hidden form XObjects
This commit is contained in:
calixteman
2026-11-16 17:05:00 +01:00
committed by GitHub
4 changed files with 51 additions and 6 deletions
+2 -6
View File
@@ -3352,9 +3352,8 @@ class CanvasGraphics {
}
paintFormXObjectBegin(opIdx, matrix, bbox) {
if (!this.contentVisible) {
return;
}
// Hidden forms still need their own state, since their transforms and
// clips are applied.
this.save(opIdx);
this.baseTransformStack.push(this.baseTransform);
@@ -3379,9 +3378,6 @@ class CanvasGraphics {
}
paintFormXObjectEnd(opIdx) {
if (!this.contentVisible) {
return;
}
this.restore(opIdx);
this.baseTransform = this.baseTransformStack.pop();
}
+1
View File
@@ -1074,3 +1074,4 @@
!issue16880.pdf
!issue16754.pdf
!scripting_user_activation.pdf
!hidden_oc_form_cm.pdf
+40
View File
@@ -0,0 +1,40 @@
%PDF-1.7
%âãÏÓ
1 0 obj
<< /Type /Catalog /Pages 2 0 R /OCProperties << /OCGs [5 0 R] /D << /OFF [5 0 R] >> >> >>
endobj
2 0 obj
<< /Type /Pages /Kids [3 0 R] /Count 1 >>
endobj
3 0 obj
<< /Type /Page /Parent 2 0 R /MediaBox [0 0 200 200] /Resources << /Properties << /oc1 5 0 R >> /XObject << /Fm0 6 0 R >> >> /Contents 4 0 R >>
endobj
4 0 obj
<< /Length 50 >>
stream
/OC /oc1 BDC /Fm0 Do EMC 1 0 0 rg 10 10 40 40 re f
endstream
endobj
5 0 obj
<< /Type /OCG /Name (Hidden) >>
endobj
6 0 obj
<< /Type /XObject /Subtype /Form /BBox [0 0 200 200] /Length 42 >>
stream
1 0 0 1 100 100 cm 0 0 1 rg 0 0 50 50 re f
endstream
endobj
xref
0 7
0000000000 65535 f
0000000015 00000 n
0000000120 00000 n
0000000177 00000 n
0000000337 00000 n
0000000438 00000 n
0000000485 00000 n
trailer
<< /Size 7 /Root 1 0 R >>
startxref
627
%%EOF
+8
View File
@@ -15381,5 +15381,13 @@
"rounds": 1,
"type": "eq",
"about": "Duplicate .notdef glyphs in a CFF font; char code 0 uses the last."
},
{
"id": "hidden_oc_form_cm",
"file": "pdfs/hidden_oc_form_cm.pdf",
"md5": "578897c16495b96ce9997be1ec481f6e",
"rounds": 1,
"type": "eq",
"about": "The transform of a form in hidden optional content doesn't leak."
}
]