Skip to content

SVG: clip away an element whose clipPath is empty - #2205

Open
RavSinghChandan wants to merge 1 commit into
py-pdf:masterfrom
RavSinghChandan:svg-empty-clip-path
Open

RavSinghChandan wants to merge 1 commit into
py-pdf:masterfrom
RavSinghChandan:svg-empty-clip-path

Conversation

@RavSinghChandan

Copy link
Copy Markdown

An element whose clip-path references a <clipPath> that yields no shape (no children, or only a <g> or <switch>, which can't be part of a clipping path) fails with KeyError: '#clip1', as in several files of the resvg test suite. So does a clip-path that references an id that isn't a <clipPath>.

An empty clipping path now clips the whole element away, as the SVG specification says. A reference to something that isn't a <clipPath> is ignored with a warning, and the element is drawn without clipping, as in browsers. Nothing changes for clip paths that do have a shape, or in what gets registered.

test_svg_empty_clip_path and test_svg_clip_path_reference_to_nothing cover these; they fail without the change.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant