Add clip-path with basic shapes - #208
Merged
TylerBrinks merged 1 commit intoJul 23, 2026
Merged
Conversation
clip-path (CSS Masking 1 5.1) had no support. Add a ClipPathValueConverter accepting "none" or a <basic-shape> - polygon(), inset(), circle() or ellipse() (CSS Shapes 1 3) - with its argument grammar validated (fill-rule and vertex pairs for polygon; 1-4 offsets and an optional "round" radius for inset; an optional shape-radius and "at <position>" for circle/ellipse), and preserving the authored text. Negative radii, wrong radius counts, incomplete vertices and unknown values are rejected. Registered as an animatable ClipPathProperty. The <geometry-box> and url() reference-box forms are out of scope.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature
Adds
clip-path(CSS Masking 1 §5.1) with the<basic-shape>functions (CSS Shapes 1 §3):Implementation
ClipPathValueConverteracceptsnoneor one ofpolygon()/inset()/circle()/ellipse(), validating each function's argument grammar and preserving the authored text:<fill-rule>(nonzero/evenodd), then a comma list of<length-percentage> <length-percentage>vertices<length-percentage>offsets, optionalround <border-radius><shape-radius>(a non-negative length-percentage,closest-side, orfarthest-side), optionalat <position>Negative radii, the wrong number of radii, incomplete vertices, a bare
round, and unknown values are all rejected.The
<geometry-box>andurl()reference-box forms are out of scope.Tests
29 cases in
PropertyTests/ClipPathProperty.cs: 16 legal shapes, 11 malformed (banana,circle(-5px),ellipse(50%), three-radius ellipse,inset(),inset(10px round), five-offset inset, incomplete polygon vertex, empty polygon,circle(at), two-radius circle), and a text-preservation check.The legal and illegal cases fail on
master(the property is unknown). The full suite (1263 existing tests) stays green, and all seven target frameworks build with no new warnings.