-
Notifications
You must be signed in to change notification settings - Fork 707
[css-shapes][motion][svg] CSS shapes functions with/without fill-rule parameters #3468
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
Comments
Since I'm going to be sending people to this issue to give feedback, let's do it via a GitHub reactions poll: React to this comment with the following symbols to express a vote:
Of course, if you have detailed use cases, other alternatives, or any other constructive comments, please feel free to leave them below! |
Agenda+ to decide on a final answer. It looks like people are okay with the proposal to:
|
Thanks for adding this to the agenda, @tabatkins! Based on the current schedule, I won't be on the call but I think the summary above still covers everything. Once we pick the final syntax, other things to consider:
(For now, I'm assuming that |
The CSS Working Group just discussed
The full IRC log of that discussion<fantasai> Topic: Motion - Final approach for shapes<myles> ScribeNick: myles <astearns> github: https://github.com//issues/3468 <myles> AmeliaBR: for the various properties that use shape(), some only care about the outline of the shape. Others care about the actual fill area of the shape <myles> AmeliaBR: So for motion-path, you only care about the outline, but for clip-path, you care about which parts are inside and outside. This is an issue when you have polygons or paths with cris-crossing lines and inside/outside isn't so clear <myles> AmeliaBR: Enter fill-rule. even-odd and nonzero. <myles> AmeliaBR: It was originally defined as polygon(keyword, ...) <myles> AmeliaBR: path() was defined in motion-path, and didn't include the keyword <myles> AmeliaBR: Things get complicated with <path> because this had 2 separate properties for the fill rule. Filling vs what's the effect when it's in a clip-path. <myles> AmeliaBR: How do we deal with this conflict between having a keyword as part of the shape function vs having a separate property which doesn't make sense for <clipPath> <myles> AmeliaBR: I came up with a couple options. The one that seemed to have people most support is that the keyword within the shape function includes "auto" as the default, and the default would look up the other SVG properties. But if you set the value otherwise, it would override the old SVG properties and we maybe eventually deprecate the SVG properties. <myles> AmeliaBR: If you specify a fill-rule keyword in motion-path, it's ignored, but that's not a problem. The only place where it's a problem with <shape> where it gets filled. We're specifying where if you set a fill rule in the function, it overrules the fill-rule property. <myles> AmeliaBR: The default behavior is defined in all other cases to match the current behavior. <myles> heycam: I like that. I'm not sure we need an explicit "auto" as opposed to just its absence. <myles> TabAtkins: We do, for ... some case. There is a case related to <path> <myles> TabAtkins: If path() takes a keyword, where the winding rule is determined by context, you need to be able to say "go grab from the other property explicitly" <fantasai> +1 to heycam <myles> heycam: This is a component of one value, and it's optional, can we just use its optionality? <myles> AmeliaBR: So the auto behavior is the "no keyword specified" behavior <myles> TabAtkins: That would work. It just runs into my dislike of having omitted values being unwritable <myles> heycam: There are a lot of properties that have optional keywords <astearns> q? <myles> fantasai: <lists them> <myles> TabAtkins: I get touchy <myles> TabAtkins: I won't fight it <TabAtkins> s/touchy/tetchy/ <fantasai> s/I get/Most of them are booleans, but when more than one value <myles> AmeliaBR: The benefit of heycam's approach is that shipping for shapes in clip-path and shape-outside, we don't need to change anything, because the change would only come in paths where the author behavior is different from the current default behavior <myles> heycam: Are their other elements other than <path> where we might want to have a default value that's not "go and look at the fill-rule property"? <myles> AmeliaBR: All the other cases the default value will be to just use one of the existing keywords. <myles> TabAtkins: even-odd is the default <myles> heycam: There's no value in adding an explicit auto keyword to say "look at the fill-rule property" for these other cases? <myles> TabAtkins: Those other cases don't have a property. <myles> AmeliaBR: It wouldn't make sense to have a div with both a clip-path and a shape-outside and also set a fill-rule in another property. That would be confusing <myles> TabAtkins: There's only the two things that have the information defined by another property, and there isn't a use case to have arbitrary things rely on those two, it's just due to SVG's existing behavior to rely on those two <myles> TabAtkins: and that's it. <myles> astearns: The proposed resolution is to make this an optional keyword with just the two values, and default to even-odd or "lookup depending on context" <myles> AmeliaBR: Withing the context of d= then not specifying the keyword would the the SVG legacy beahvior. Specifying the keyword behavior would mean "ignore the fill-rule and clip-rule properties" <myles> astearns: Any objections? <myles> RESOLVED: make an optional keyword with just the two values, and default to even-odd or "lookup depending on context" |
For outline shapes, fill-rule should be ignored. We add the flag in the parser of BasicShape, so offset-path can use this flag to ignore fill-rule. Note: "ShapeType" means this property uses filled shapes or outline shapes. For outline shapes, we ignore fill-rule. This is from the concept of `<outline-shape>` and `<filled-shape>` in w3c/csswg-drafts#3468 (comment) No behavir change in this patch, just add the ability for offset-path to ignore `<fill-rule>` when combining all basic shapes into offset-path. Differential Revision: https://phabricator.services.mozilla.com/D179625 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1837305 gecko-commit: 6f345b692ecbd7a6de126296efb8811b6bd8597d gecko-reviewers: emilio
For outline shapes, fill-rule should be ignored. We add the flag in the parser of BasicShape, so offset-path can use this flag to ignore fill-rule. Note: "ShapeType" means this property uses filled shapes or outline shapes. For outline shapes, we ignore fill-rule. This is from the concept of `<outline-shape>` and `<filled-shape>` in w3c/csswg-drafts#3468 (comment) No behavir change in this patch, just add the ability for offset-path to ignore `<fill-rule>` when combining all basic shapes into offset-path. Differential Revision: https://phabricator.services.mozilla.com/D179625
For outline shapes, fill-rule should be ignored. We add the flag in the parser of BasicShape, so offset-path can use this flag to ignore fill-rule. Note: "ShapeType" means this property uses filled shapes or outline shapes. For outline shapes, we ignore fill-rule. This is from the concept of `<outline-shape>` and `<filled-shape>` in w3c/csswg-drafts#3468 (comment) No behavir change in this patch, just add the ability for offset-path to ignore `<fill-rule>` when combining all basic shapes into offset-path. Differential Revision: https://phabricator.services.mozilla.com/D179625 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1837305 gecko-commit: 6f345b692ecbd7a6de126296efb8811b6bd8597d gecko-reviewers: emilio
For outline shapes, fill-rule should be ignored. We add the flag in the parser of BasicShape, so offset-path can use this flag to ignore fill-rule. Note: "ShapeType" means this property uses filled shapes or outline shapes. For outline shapes, we ignore fill-rule. This is from the concept of `<outline-shape>` and `<filled-shape>` in w3c/csswg-drafts#3468 (comment) No behavir change in this patch, just add the ability for offset-path to ignore `<fill-rule>` when combining all basic shapes into offset-path. Differential Revision: https://phabricator.services.mozilla.com/D179625 UltraBlame original commit: 6f345b692ecbd7a6de126296efb8811b6bd8597d
For outline shapes, fill-rule should be ignored. We add the flag in the parser of BasicShape, so offset-path can use this flag to ignore fill-rule. Note: "ShapeType" means this property uses filled shapes or outline shapes. For outline shapes, we ignore fill-rule. This is from the concept of `<outline-shape>` and `<filled-shape>` in w3c/csswg-drafts#3468 (comment) No behavir change in this patch, just add the ability for offset-path to ignore `<fill-rule>` when combining all basic shapes into offset-path. Differential Revision: https://phabricator.services.mozilla.com/D179625 UltraBlame original commit: 6f345b692ecbd7a6de126296efb8811b6bd8597d
For outline shapes, fill-rule should be ignored. We add the flag in the parser of BasicShape, so offset-path can use this flag to ignore fill-rule. Note: "ShapeType" means this property uses filled shapes or outline shapes. For outline shapes, we ignore fill-rule. This is from the concept of `<outline-shape>` and `<filled-shape>` in w3c/csswg-drafts#3468 (comment) No behavir change in this patch, just add the ability for offset-path to ignore `<fill-rule>` when combining all basic shapes into offset-path. Differential Revision: https://phabricator.services.mozilla.com/D179625 UltraBlame original commit: 6f345b692ecbd7a6de126296efb8811b6bd8597d
In order to close this issue, it seems that defining how to handle People may be confused without a clarification in the related specs for these contexts (see w3c/fxtf-drafts#512 and #7390), now that If I am not mistaken, it boils down to defining that:
|
For outline shapes, fill-rule should be ignored. We add the flag in the parser of BasicShape, so offset-path can use this flag to ignore fill-rule. Note: "ShapeType" means this property uses filled shapes or outline shapes. For outline shapes, we ignore fill-rule. This is from the concept of `<outline-shape>` and `<filled-shape>` in w3c/csswg-drafts#3468 (comment) No behavir change in this patch, just add the ability for offset-path to ignore `<fill-rule>` when combining all basic shapes into offset-path. Differential Revision: https://phabricator.services.mozilla.com/D179625
Added the omitted default handling in 5ebf7df |
(As Chris Coyier has regularly noted on CSS-Tricks, our current specs and implementation of CSS Shapes functions are a bit of a mess, with certain shapes functions working in some properties but not others. I started writing an explanation of why it's a mess, and ended up with good summaries of two possible solutions. Copying that comment here, in the hopes of finally coming to a decision & getting everything spec'd and shipped!)
The tricky part is fill-rule. The
polygon()
function includes fill-rule keywords as an optional first parameter:https://codepen.io/AmeliaBR/pen/GgWBOy
But a
<path>
element uses the keywords set by thefill-rule
ORclip-rule
properties, depending on the shape's context. So having a keyword inside thed
property would create a conflict.The
path()
function as currently spec'd foroffset-path
doesn't include a keyword parameter, because motion only uses the outline, not the fill.We have agreed to use that syntax for
d
(<path>
shape) as a property.But for
clip-path
(and future stuff likeshape-inside
to define the text wrapping area as a shape), we need to know which fill rule to use.One idea I mused about (but never wrote down) is to define two different CSS data types, one of which is a super class of the other:
<outline-shape>
doesn't have fill-rule keywords<filled-shape>
=<outline-shape>
(with default fill-rule) |polygon()
andpath()
with keywordsSo, with this option, the
d
property would take an<outline-shape>
function, no keywords allowed, and would still use thefill-rule
/clip-rule
properties with no conflict.Another option is to define an
auto
value for the keyword inside the functions, and make that the default. Inclip-path
, anauto
value would behave just like the current default (nonzero
), But ind
, it would behave as "check thefill-rule
orclip-rule
property according to context and use that". If you did specify a different keyword in a function insided
, it would override the other properties:A side benefit, in my opinion, is that this means we could long-term plan to deprecate usage of the
fill-rule
/clip-rule
properties, which are already super annoying in the way they depend on context. If you want context-specific keyword values in the CSS function notation, you could use inherited CSS variable values.But the most important benefit of either of these approaches is that they would allow all the shape functions (possibly minus fill-rule keywords) to be used in all the shape-related properties!!!
The text was updated successfully, but these errors were encountered: