-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'd' presentation attribute: use path() function #374
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -177,7 +177,7 @@ <h3 id="TheDProperty">Specifying path data: the <span class='property'>'d'</span | |||||||||||||||
</tr> | ||||||||||||||||
<tr> | ||||||||||||||||
<th>Value:</th> | ||||||||||||||||
<td>none | <a><string></a></td> | ||||||||||||||||
<td>none | path(<a><string></a>)</td> | ||||||||||||||||
</tr> | ||||||||||||||||
<tr> | ||||||||||||||||
<th>Initial:</th> | ||||||||||||||||
|
@@ -231,6 +231,10 @@ <h3 id="TheDProperty">Specifying path data: the <span class='property'>'d'</span | |||||||||||||||
If the path data string contains no valid commands, then the behavior | ||||||||||||||||
is the same as the <span class='prop-value'>none</span> value.</p> | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably need to clarify how this fallback works in CSS terms. |
||||||||||||||||
|
||||||||||||||||
<p>When <a>'d'</a> is parsed as an attribute, it is parsed according to the | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you be more specific what this means for the path() function please? I thing what you want to say is that the grammar would not allow path() and falls back to EBNF as specified in this spec. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that it could be more clear. Maybe:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We also need to define the term "path data string" somewhere, since it's used a lot in the prose. |
||||||||||||||||
<a href="#PathDataBNF">svg-path</a> <a href="types.html#syntax">EBNF | ||||||||||||||||
grammar</a>, instead of the CSS grammar given above.</p> | ||||||||||||||||
|
||||||||||||||||
<p> | ||||||||||||||||
For animation, two <a>'d'</a> property values can only be | ||||||||||||||||
interpolated smoothly when the path data strings contain have the | ||||||||||||||||
|
@@ -243,26 +247,51 @@ <h3 id="TheDProperty">Specifying path data: the <span class='property'>'d'</span | |||||||||||||||
<a href="https://drafts.csswg.org/web-animations/#discrete-animation-type-section">discrete</a> | ||||||||||||||||
animation type. | ||||||||||||||||
</p> | ||||||||||||||||
<p> | ||||||||||||||||
Lowercase commands (with relative coordinates) are converted to equivalent uppercase commands | ||||||||||||||||
(with absolute coordinates) before determining if the path data strings have the same structure. | ||||||||||||||||
</p> | ||||||||||||||||
<p> | ||||||||||||||||
If the list of path data commands have the same structure, then each | ||||||||||||||||
parameter to each path data command must be | ||||||||||||||||
<a href="https://drafts.csswg.org/web-animations/#animation-interpolation">interpolated</a> | ||||||||||||||||
separately <a href="https://drafts.csswg.org/web-animations/#real-number-animation-type">as | ||||||||||||||||
real numbers</a>. Flags and booleans must be interpolated as | ||||||||||||||||
fractions between zero and one, with any non-zero value considered | ||||||||||||||||
to be a value of one/true. | ||||||||||||||||
integer values clamped between zero and one. | ||||||||||||||||
</p> | ||||||||||||||||
|
||||||||||||||||
<p class="annotation"> | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We let the annotation in the spec for later reference. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. It would also be helpful to extend the annotation to add a link to the resolution to use the |
||||||||||||||||
Resolved that "d will become a presentation attribute (no name | ||||||||||||||||
change) with path data string as value" at | ||||||||||||||||
<a href="https://www.w3.org/2016/04/21-svg-minutes.html">London | ||||||||||||||||
Editor's Meeting</a>. | ||||||||||||||||
</div> | ||||||||||||||||
|
||||||||||||||||
<div class='ready-for-wider-review'> | ||||||||||||||||
|
||||||||||||||||
<h3 id="TheDAttribute">The <span class="attr-name">'d'</span> attribute</h3> | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this section added? I'd prefer to stick with defining both the property and attribute syntax in one place. |
||||||||||||||||
|
||||||||||||||||
<dl class="attrdef-list"> | ||||||||||||||||
<dt> | ||||||||||||||||
<table class="attrdef def"> | ||||||||||||||||
<tr> | ||||||||||||||||
<th>Name</th> | ||||||||||||||||
<th>Value</th> | ||||||||||||||||
<th>Initial value</th> | ||||||||||||||||
<th>Animatable</th> | ||||||||||||||||
</tr> | ||||||||||||||||
<tr> | ||||||||||||||||
<td><dfn id="TermD" data-dfn-type="element-attr" data-dfn-for="path" data-export="">d</dfn></td> | ||||||||||||||||
<td>"<span class="attr-value">path data</span>"</td> | ||||||||||||||||
<td>As if not specified.</td> | ||||||||||||||||
<td>yes</td> | ||||||||||||||||
</tr> | ||||||||||||||||
</table> | ||||||||||||||||
</dt> | ||||||||||||||||
</dl> | ||||||||||||||||
|
||||||||||||||||
<p> | ||||||||||||||||
The contents of the attribute must match the svg-path EBNF grammar defined below, and errors within the string are handled according to the rules in the Path Data Error Handling section. If the path data string contains no valid commands, then the behavior is the same as if the attribute was not specified. | ||||||||||||||||
</p> | ||||||||||||||||
|
||||||||||||||||
</div> | ||||||||||||||||
<h3 id="PathData">Path data</h3> | ||||||||||||||||
|
||||||||||||||||
<p>The following sections list the commands that canbe used | ||||||||||||||||
<p>The following sections list the commands that can be used | ||||||||||||||||
in path data strings. Those that | ||||||||||||||||
draw straight line segments include the <a href="paths.html#PathDataLinetoCommands">lineto commands</a> | ||||||||||||||||
(<strong>L</strong>, <strong>l</strong>, | ||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -96,6 +96,16 @@ <h1>Property Index</h1> | |||||||
<td>yes</td> | ||||||||
<td>as specified</td> | ||||||||
</tr> | ||||||||
<tr> | ||||||||
<th><a>'d'</a></th> | ||||||||
<td>none | path(<a><string></a>)</td> | ||||||||
<td>none</td> | ||||||||
<td><a>'path'</a> elements</td> | ||||||||
<td>no</td> | ||||||||
<td>N/A</td> | ||||||||
<td><a href="https://www.w3.org/TR/2008/REC-CSS2-20080411/media.html#visual-media-group">visual</a></td> | ||||||||
<td>yes</td> | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We've updated the Property Index to specify the type of animation, not just yes/no. There's also a "computed value" column. Which makes me realize that we never resolved #321 on what that should be (do you normalize before computed/used value?). For now:
Suggested change
Ideally, "as path data string" would be linked to the definition of how animation works. |
||||||||
</tr> | ||||||||
<tr> | ||||||||
<th><a>'direction'</a></th> | ||||||||
<td>ltr | rtl </td> | ||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,7 +143,11 @@ <h2 id="syntax">Attribute syntax</h2> | |
unitless length and angles to be used in presentation attribute while | ||
disallowing them in corresponding property values.</p> | ||
|
||
<p class="note">Note that all <a>presentation attributes</a>, since they are | ||
<p>The <a>'d'</a> presentation attribute is an exception, it is parsed | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For CSS Transforms we are a little bit more verbose and explain why there are differences as well. See https://drafts.csswg.org/css-transforms/#svg-syntax I think we should be a little bit more verbose here too. Did we agree on freezing the IMO we should allow all values the property has + the string value itself for backwards compatibility reasons. But I am not sure if:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Guess I commented here already. Still applies IMO. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would confuse parsing too much to to allow the That said, I don't see any reason to freeze the attribute at SVG 1.1 when it comes to path data commands. Instead, treat the attribute value as a string injected into a |
||
according to the <a href="paths.html#PathDataBNF">svg-path</a> | ||
<a href="types.html#syntax">EBNF grammar</a>.</p> | ||
|
||
<p class="note">Note that all other <a>presentation attributes</a>, since they are | ||
defined by reference to their corresponding CSS properties, are defined using | ||
the CSS Value Definition Syntax.</p> | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we want to link
path()
(and maybe string as well).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might be a chicken-vs-egg issue with linking to another definition. The CSS reference definition for the path function is in the motion path module, which is still WD status, and which still references SVG 1.1 as the reference definition for the path syntax.