Skip to content

Conversation

@wisniewskij
Copy link
Contributor

@wisniewskij wisniewskij commented Nov 24, 2025

Summary

Adds Path SVG property

Copy link
Member

@MatiPl01 MatiPl01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some minor comments for now. Good job on this task overall!

Comment on lines 172 to 173
template class CSSValueVariant<SVGPath>;
template class CSSValueVariant<SVGPath, CSSKeyword>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to heave just a single one here. template class CSSValueVariant<SVGPath> should be sufficient, since the string d property value, as far as I know, must always be a valid path (not something like 'none', etc.).

The CSSKeyword is reserved for values such as 'none', 'auto', etc., which are sometimes allowed together with numeric values, for example see this one:

{"width", value<CSSLength, CSSKeyword>("auto", {RelativeTo::Parent, "width"})

CSSLength - allows numbers or number string with % unit (e.g. 10, 25%, etc.)
CSSKeyword - for the 'auto' string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, deleted that

Comment on lines 68 to 69
template class SimpleValueInterpolator<SVGPath>;
template class SimpleValueInterpolator<SVGPath, CSSKeyword>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
template class SimpleValueInterpolator<SVGPath>;
template class SimpleValueInterpolator<SVGPath, CSSKeyword>;
template class SimpleValueInterpolator<SVGPath>;

same

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleted

Comment on lines 13 to 14
template <typename T>
explicit SVGPath(T &&value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
template <typename T>
explicit SVGPath(T &&value);

I think that template params aren't needed, at least not in this case, when we know all possible types (the path is always a string, at least for now in the initial implementation).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a true template type; it only accepts a string&& or a const string&. This specific signature allows the caller to either copy or move a string into the structure. This technique is often used as a shortcut in such case (perfect forwarding)

Copy link
Member

@MatiPl01 MatiPl01 Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, fine. I can see this for the first time but I haven't seen much C++ code in other projects before, so I don't know if this is a common practice 😄. I still find this a little bit confusing as there is no constraint on the T value type, so it is not that obvious what is the main purpose of this template constructor.

Can we maybe stick to the simpler approach used in other structs?

Comment on lines 34 to 35
template <typename T>
SVGPath::SVGPath(T &&value) : command(std::forward<T>(value)) {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
template <typename T>
SVGPath::SVGPath(T &&value) : command(std::forward<T>(value)) {}

This shouldn't be needed as well.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants