Added support for mask-type style in mask attribute.#476
Conversation
|
Great! |
|
@codex full review, also validate its part of SVG static subset we support |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f5fc95866f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (Element != null | ||
| && Element.TryGetAttribute("mask-type", out var maskTypeStr)) | ||
| { | ||
| maskType = maskTypeStr == "alpha" ? MaskType.Alpha : MaskType.Luminance; |
There was a problem hiding this comment.
Parse
mask-type value case-insensitively
The new mask-type parsing treats only the exact lowercase string "alpha" as alpha mode, but CSS keyword values are case-insensitive. Valid inputs like mask-type: Alpha (or other casing variants) will incorrectly fall back to luminance masking, producing different rendering than specified for alpha masks.
Useful? React with 👍 / 👎.
| { | ||
| var maskType = MaskType.Luminance; | ||
| if (Element != null | ||
| && Element.TryGetAttribute("mask-type", out var maskTypeStr)) |
There was a problem hiding this comment.
Read
mask-type from stylesheet-applied styles
Using TryGetAttribute("mask-type", ...) here misses most stylesheet-driven values because the underlying SVG style store returns only inline/presentation style keys for unknown properties. As a result, mask-type set via <style> selectors (for example class/element selectors) is ignored and masks are rendered as luminance instead of alpha.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Parsing of mask-type, which was set via selectors is a heavy performance task, which requires using reflection in that case. In my opinion it is redundant to cover that case.
|
@Lev02 Please fix branch conflicts |
# Conflicts: # src/Svg.Model/Drawables/DrawableBase.cs # src/Svg.Model/Drawables/Elements/MaskDrawable.cs
done |
|
Hey, when can we expect this in master? |
SVG spec: https://www.w3.org/TR/css-masking-1/#the-mask-type