Skip to content

Commit 0e335d5

Browse files
committed
Fix nested non-isolated groups in knockout rendering
It fixes #18032. Only use the special inner-backdrop compositing path for nested non-isolated groups that actually need isolation. This preserves the parent/page backdrop for simple nested groups inside knockout groups, preventing later group compositing from erasing existing backdrop content.
1 parent 0c66063 commit 0e335d5

4 files changed

Lines changed: 14 additions & 3 deletions

File tree

src/display/canvas.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3342,13 +3342,15 @@ class CanvasGraphics {
33423342
// #compositeKnockoutSurface so it doesn't become part of the group
33433343
// source itself.
33443344
const backdropCtx = group.knockout && !group.isolated ? currentCtx : null;
3345-
// Non-isolated non-KO subgroup inside a KO parent: at endGroup we'll
3346-
// blend its elements against the outer KO running canvas (also frozen),
3347-
// so just record the flag here and read ctx.canvas at composite time.
3345+
// Non-isolated non-KO subgroup inside a KO parent, with inner compositing
3346+
// of its own: at endGroup we'll blend its elements against the outer KO
3347+
// running canvas (also frozen), so just record the flag here and read
3348+
// ctx.canvas at composite time.
33483349
const hasInnerBackdrop =
33493350
!group.isolated &&
33503351
!group.knockout &&
33513352
!group.smask &&
3353+
group.needsIsolation &&
33523354
this.#knockoutGroupLevel > 0;
33533355

33543356
// Pool the per-element shape mask for the lifetime of this KO group.

test/pdfs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,3 +920,4 @@
920920
!smask_luminosity_oob_transfer.pdf
921921
!operator_list_cycle.pdf
922922
!knockout_groups_test.pdf
923+
!issue18032.pdf

test/pdfs/issue18032.pdf

101 KB
Binary file not shown.

test/test_manifest.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14252,5 +14252,13 @@
1425214252
"rounds": 1,
1425314253
"type": "eq",
1425414254
"about": "Knockout groups composite-modes survey."
14255+
},
14256+
{
14257+
"id": "issue18032",
14258+
"file": "pdfs/issue18032.pdf",
14259+
"md5": "656234fde97953c4e3fc7698831590a9",
14260+
"rounds": 1,
14261+
"type": "eq",
14262+
"about": "Non-isolated knockout group with a nested non-isolated subgroup over existing text."
1425514263
}
1425614264
]

0 commit comments

Comments
 (0)