Skip to content

[css-shapes-1] The interpolation for at <position> when it is omitted #9068

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

Open
BorisChiou opened this issue Jul 14, 2023 · 1 comment
Open
Labels
css-shapes-1 Current Work

Comments

@BorisChiou
Copy link
Contributor

This is the follow-up issue per my comment in #8695 (comment). Per #8695, we omit the at <position> when it was omitted by the author, for serialization. So how about the interpolation? I think there are two different scenarios:

  1. offset-path: the default at <position> depends on offset-position, so if one of the animation value doesn't specify at <position>, e.g. ellipse(10% 10%) -> ellipse(40% 50% at 25% 25%), I expect they can not be interpolated.
  2. clip-path, shape-outside, and others: per spec, this defaults to center if omitted. So the used value is center. However, if we would like to do interpolation for the same case, i.e. ellipse(10% 10%) -> ellipse(40% 50% at 25% 25%), should we add the default value for interpolation? In the case, the start value becomes ellipse(10% 10% at 50% 50%), and we still can do interpolation between them. These properties have been shipped, and so we don't have to worry about breaking the existing websites because they are still interpolatable. However, the conversion may change the serialization of the start value. This means, at 0%, getComputedStyle(div).clipPath returns ellipse(10% 10% at 50% 50%), instead of ellipse(10% 10%), during the animation. Perhaps this is fine and I'm OK with this.

The 1st scenario is straightforward. The omitted at <position> cannot be interpolated with the specified at <position>. So the test case looks like this:

test_no_interpolation({
  property: 'offset-path',
  from: 'ellipse(10% 10%)',
  to: 'ellipse(40% 50% at 25% 25%)',
});

About the 2nd scenario, I expect we still want to convert the omit at <position> to the default center for properties which use the standard default center if author omits it, for interpolation. So I expect the test case looks like this:

test_interpolation({
  property: 'clip-path',
  from: 'ellipse(10% 10%)',
  to: 'ellipse(40% 40% at 20% 20%)',
}, [
  {at: 0, expect: 'ellipse(10% 10% at 50% 50%)'},
  {at: 0.5, expect: 'ellipse(25% 20% at 35% 35%)'},
  {at: 1, expect: 'ellipse(40% 40% at 20% 20%)'},
]);

// We add default center, 50% 50%, even if both "from" value and "to" value don't specify at <position>. Or should we omit all of them?
test_interpolation({
  property: 'clip-path',
  from: 'ellipse(10% 10%)',
  to: 'ellipse(40% 40%)',
}, [
  {at: 0, expect: 'ellipse(10% 10% at 50% 50%)'},
  {at: 0.5, expect: 'ellipse(25% 25% at 50% 50%)'},
  {at: 1, expect: 'ellipse(40% 40% at 50% 50%)'},
]);

Do these test cases make sense?

@BorisChiou BorisChiou added the css-shapes-1 Current Work label Jul 14, 2023
@nt1m
Copy link
Member

nt1m commented Sep 23, 2023

We should either make it non-interpolable, or always include the position. I chose to do the latter for WebKit, but either is fine.

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Sep 27, 2023
…not specified. r=devtools-reviewers,emilio

`at <position>` is optional value and we should omit it if author doesn't
specify it, for all basic-shape functions, and ray().

Note that there is a related interpolation issue [1] if one of the end values
doesn't specify `at <position>`. We didn't address this issue in this patch.

[1] w3c/csswg-drafts#9068

Also, this updates the devtool code to give it the default value, "50% 50%",
for circle() and ellipse() if `at <position>` is not specified.

Differential Revision: https://phabricator.services.mozilla.com/D181918
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Sep 29, 2023
…not specified. r=devtools-reviewers,emilio

`at <position>` is optional value and we should omit it if author doesn't
specify it, for all basic-shape functions, and ray().

Note that there is a related interpolation issue [1] if one of the end values
doesn't specify `at <position>`. We didn't address this issue in this patch.

[1] w3c/csswg-drafts#9068

Also, this updates the devtool code to give it the default value, "50% 50%",
for circle() and ellipse() if `at <position>` is not specified.

Differential Revision: https://phabricator.services.mozilla.com/D181918

UltraBlame original commit: 150d4fac35369ce8b1f5ae336a5a5474993d640d
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Sep 29, 2023
…not specified. r=devtools-reviewers,emilio

`at <position>` is optional value and we should omit it if author doesn't
specify it, for all basic-shape functions, and ray().

Note that there is a related interpolation issue [1] if one of the end values
doesn't specify `at <position>`. We didn't address this issue in this patch.

[1] w3c/csswg-drafts#9068

Also, this updates the devtool code to give it the default value, "50% 50%",
for circle() and ellipse() if `at <position>` is not specified.

Differential Revision: https://phabricator.services.mozilla.com/D181918

UltraBlame original commit: 150d4fac35369ce8b1f5ae336a5a5474993d640d
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Sep 30, 2023
…not specified. r=devtools-reviewers,emilio

`at <position>` is optional value and we should omit it if author doesn't
specify it, for all basic-shape functions, and ray().

Note that there is a related interpolation issue [1] if one of the end values
doesn't specify `at <position>`. We didn't address this issue in this patch.

[1] w3c/csswg-drafts#9068

Also, this updates the devtool code to give it the default value, "50% 50%",
for circle() and ellipse() if `at <position>` is not specified.

Differential Revision: https://phabricator.services.mozilla.com/D181918

UltraBlame original commit: 150d4fac35369ce8b1f5ae336a5a5474993d640d
github-actions bot pushed a commit to Loirooriol/stylo that referenced this issue Mar 17, 2024
…not specified. r=devtools-reviewers,emilio

`at <position>` is optional value and we should omit it if author doesn't
specify it, for all basic-shape functions, and ray().

Note that there is a related interpolation issue [1] if one of the end values
doesn't specify `at <position>`. We didn't address this issue in this patch.

[1] w3c/csswg-drafts#9068

Also, this updates the devtool code to give it the default value, "50% 50%",
for circle() and ellipse() if `at <position>` is not specified.

Differential Revision: https://phabricator.services.mozilla.com/D181918
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-shapes-1 Current Work
Projects
None yet
Development

No branches or pull requests

2 participants