[raster] Respect visibility when collecting clipPath shapes

This commit is contained in:
Behdad Esfahbod committed 2026-02-26 00:35:19 -03:00
1 parent e89ebd73b3
commit d57bd72030
1 file changed
+23
+23
View File
@@ -74,6 +74,29 @@ hb_raster_svg_process_clip_path_def (hb_svg_defs_t *defs,
if (ct == SVG_TOKEN_CLOSE_TAG) { cdepth--; continue; }
if (ct == SVG_TOKEN_OPEN_TAG || ct == SVG_TOKEN_SELF_CLOSE_TAG)
{
hb_svg_style_props_t visibility_style_props;
svg_parse_style_props (parser.find_attr ("style"), &visibility_style_props);
hb_svg_str_t display_str = svg_pick_attr_or_style (parser, visibility_style_props.display, "display");
hb_svg_str_t visibility_str = svg_pick_attr_or_style (parser, visibility_style_props.visibility, "visibility");
bool is_hidden = svg_str_eq_ascii_ci (display_str.trim (), "none") ||
svg_str_eq_ascii_ci (visibility_str.trim (), "hidden") ||
svg_str_eq_ascii_ci (visibility_str.trim (), "collapse");
if (is_hidden)
{
if (ct == SVG_TOKEN_OPEN_TAG)
{
int skip_depth = 1;
while (skip_depth > 0)
{
hb_svg_token_type_t st = parser.next ();
if (st == SVG_TOKEN_EOF) break;
if (st == SVG_TOKEN_CLOSE_TAG) skip_depth--;
else if (st == SVG_TOKEN_OPEN_TAG) skip_depth++;
}
}
continue;
}
hb_svg_transform_t effective = (unsigned) cdepth < SVG_MAX_CLIP_DEPTH
? inherited[cdepth]
: hb_svg_transform_t ();