-
Notifications
You must be signed in to change notification settings - Fork 715
[css-anchor-position][css-position] Fixing the animation problem #9598
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
Talking this over with @fantasai, she pointed out that this will create very weird and confusing ergonomics for developers using positioning. So we suggest to rejigger it a bit. Issues with above proposal:
So instead of messing with
So, authors can write: .foo {
position: absolute;
position-animation: combo;
transition: position-animation 1s;
}
.foo.start {
top: 0;
bottom: anchor(top);
align-self: bottom;
}
.foo.end {
top: anchor(bottom);
bottom: 0;
align-self: end;
} ...and when they swap the classes from Using this, we can animate all of the following cases:
~fantasai and Tab P.S. If this property is |
None of the issues listed with the first approach strike me as huge problems, whereas the "position package" proposal introduces a likely problematic layout dependency (the "magic"), and intermediate values that can't be represented. I'm not sure that's a net win as far as "issues" go, and I'm also not sure if this can be reasonably implemented, but it's an interesting direction to explore regardless. Especially if it could solve the anchor change case. I'm confused by the model as stated, however. We seem to want to do layout of the box ignoring the "position package" (to determine what goes into the package), but then also it's really the position package that has the final say for the size/position?
I see the "provisionally", but I'd avoid anything related to "animation" in the property name. The animated aspect of this should come from the act of animating/transitioning the thing, not as an intrinsic part of the property.
I don't think we actually need to have two values. Any interpolated state (that's not at the endpoints) can automatically behave as "combo".
It feels so wrong. :-) Would this be the first thing we can't even represent with Typed OM? |
I think they are pretty reasonable usability issues. Nothing technically wrong with what's in the first post, but it's not a great layering.
The second proposal is exactly identical in terms of power and layout dependency as the first. It allows literally no new abilities, save that it can interact directly with top/left/etc rather than requiring them to be packed into an inset-area value. Literally, this was intended to be absolutely nothing but a movement of syntax; rather than blessing inset-area as "the way to get good position animation" and relying on inset:auto to not override that (which then requires us to recreate top/left/etc in inset-area, so we can actually do the things those properties are good at), we just move the "good position animation" thing to a third property, so we can continue to use top/left/etc as normal and still have it interact with inset-area as necessary. If you're reading anything else into this, that's just a failure on our part to communicate it well.
No, we have to have |
Ah, OK. That's not how I read it. But I think I get it now, thanks. Instead of the author explicitly creating the "position package" via inset-area (v2), it's sort of automatically created from the existing inset properties and other stuff known at computed-value time. However, it does go slightly beyond moving the syntax around if it solves the named anchor change issue. :-)
Right, |
Maybe I should have been able to infer from the discussion above, but what happens if you animate an inset property at the same time as animating the position package?: Just does not interpolate |
Well, sure, but as we discussed internally, the named anchor change issue should end up being fixed anyway, with proper definition and reference to the machinery driving cq transitions.
I'm open to whatever behavior in that case. We could snapshot, or live-update, whatever's more reasonable for impls. There's no user argument for one behavior or another. |
As a curious sidenote: when I was playing with “polyfilling” the The way I solved it in my case was by having two elements, and having transitions for a) inset properties (which were never Here is this experiment: https://codepen.io/kizu/pen/zYMmVJd (this comment is mostly as “as an author I did encounter this issue, would be happy with any solution, and for some cases we might have some workarounds already, though not ideal ones”). |
As part of the proposal in [1], inset-area affects inset properties at used value time. Testing with typed-om since inset properties use resolved values for getComputedStyle. [1] w3c/csswg-drafts#9598 (comment) Bug: 1477314 Change-Id: I2db25b3546c6553b36f8b9cfd88aa4d906e7ea28
As part of the proposal in [1], inset-area affects inset properties at used value time. Testing with typed-om since inset properties use resolved values for getComputedStyle. [1] w3c/csswg-drafts#9598 (comment) Bug: 1477314 Change-Id: I2db25b3546c6553b36f8b9cfd88aa4d906e7ea28 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5063151 Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Commit-Queue: Rune Lillesveen <futhark@chromium.org> Cr-Commit-Position: refs/heads/main@{#1230573}
As part of the proposal in [1], inset-area affects inset properties at used value time. Testing with typed-om since inset properties use resolved values for getComputedStyle. [1] w3c/csswg-drafts#9598 (comment) Bug: 1477314 Change-Id: I2db25b3546c6553b36f8b9cfd88aa4d906e7ea28 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5063151 Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Commit-Queue: Rune Lillesveen <futhark@chromium.org> Cr-Commit-Position: refs/heads/main@{#1230573}
As part of the proposal in [1], inset-area affects inset properties at used value time. Testing with typed-om since inset properties use resolved values for getComputedStyle. [1] w3c/csswg-drafts#9598 (comment) Bug: 1477314 Change-Id: I2db25b3546c6553b36f8b9cfd88aa4d906e7ea28 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5063151 Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Commit-Queue: Rune Lillesveen <futhark@chromium.org> Cr-Commit-Position: refs/heads/main@{#1230573}
Okay, further discussion with Anders and Rune led to some more evolution in this idea. They pointed out that the “ But, now that we're entertaining the “just make a magic way to animate good” solution, we don't actually need So @fantasai and I have an expanded Round 3 of the proposal:
|
…ues, a=testonly Automatic update from web-platform-tests [inset-area] Test for computed inset values As part of the proposal in [1], inset-area affects inset properties at used value time. Testing with typed-om since inset properties use resolved values for getComputedStyle. [1] w3c/csswg-drafts#9598 (comment) Bug: 1477314 Change-Id: I2db25b3546c6553b36f8b9cfd88aa4d906e7ea28 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5063151 Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Commit-Queue: Rune Lillesveen <futhark@chromium.org> Cr-Commit-Position: refs/heads/main@{#1230573} -- wpt-commits: 8fe24833480b88775d0f9b4f908c63c185162fb2 wpt-pr: 43375
…ues, a=testonly Automatic update from web-platform-tests [inset-area] Test for computed inset values As part of the proposal in [1], inset-area affects inset properties at used value time. Testing with typed-om since inset properties use resolved values for getComputedStyle. [1] w3c/csswg-drafts#9598 (comment) Bug: 1477314 Change-Id: I2db25b3546c6553b36f8b9cfd88aa4d906e7ea28 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5063151 Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Commit-Queue: Rune Lillesveen <futhark@chromium.org> Cr-Commit-Position: refs/heads/main@{#1230573} -- wpt-commits: 8fe24833480b88775d0f9b4f908c63c185162fb2 wpt-pr: 43375
Is that really better than authors having to set insets to 0 explicitly? Isn't it more common to have a specified size, or intrinisic sizing for the anchored element where you would want the insets to be Example: #anchored {
inset-area: top / left;
bottom: 10px;
right: 10px;
/* resetting left/right necessary if insets are set to 0 by inset-area */
left: auto;
right: auto;
} Actually, " |
Well, without that, you have double-auto inset behavior, which currently implies invoking static positioning (instead of actually positioning relative to the anchor, which you're clearly indicating you want). Are you imagining some additional behavior to make double-auto insets work differently in the presence of inset-area?
Note that that's already done in the proposal in item (3), by having inset-area change the behavior of |
I thought the double- I didn't understand how you could possibly get the intrinsic sizing behavior if you forced
No.
|
Unless we define something else, the double-auto inset beahvior is the "position yourself to the static pos" behavior, which doesn't pay attention to inset-area (or anything else directly position-related). Could you elaborate on what you are expecting the behavior to be?
The legacy behavior where absposes stretch to fill their inset-modified containing block is trigger by The proposal here changes |
Nothing more to elaborate on. It was me believing that it wouldn't be possible to have a fixed offset against the anchor corner while still have intrinsic sizing of the anchored element possible if the |
…ues, a=testonly Automatic update from web-platform-tests [inset-area] Test for computed inset values As part of the proposal in [1], inset-area affects inset properties at used value time. Testing with typed-om since inset properties use resolved values for getComputedStyle. [1] w3c/csswg-drafts#9598 (comment) Bug: 1477314 Change-Id: I2db25b3546c6553b36f8b9cfd88aa4d906e7ea28 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5063151 Reviewed-by: Anders Hartvoll Ruud <andruudchromium.org> Commit-Queue: Rune Lillesveen <futharkchromium.org> Cr-Commit-Position: refs/heads/main{#1230573} -- wpt-commits: 8fe24833480b88775d0f9b4f908c63c185162fb2 wpt-pr: 43375 UltraBlame original commit: 6a88796424e055d7b7064bc9b11edcfc0ce321f2
…ues, a=testonly Automatic update from web-platform-tests [inset-area] Test for computed inset values As part of the proposal in [1], inset-area affects inset properties at used value time. Testing with typed-om since inset properties use resolved values for getComputedStyle. [1] w3c/csswg-drafts#9598 (comment) Bug: 1477314 Change-Id: I2db25b3546c6553b36f8b9cfd88aa4d906e7ea28 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5063151 Reviewed-by: Anders Hartvoll Ruud <andruudchromium.org> Commit-Queue: Rune Lillesveen <futharkchromium.org> Cr-Commit-Position: refs/heads/main{#1230573} -- wpt-commits: 8fe24833480b88775d0f9b4f908c63c185162fb2 wpt-pr: 43375 UltraBlame original commit: 6a88796424e055d7b7064bc9b11edcfc0ce321f2
…ues, a=testonly Automatic update from web-platform-tests [inset-area] Test for computed inset values As part of the proposal in [1], inset-area affects inset properties at used value time. Testing with typed-om since inset properties use resolved values for getComputedStyle. [1] w3c/csswg-drafts#9598 (comment) Bug: 1477314 Change-Id: I2db25b3546c6553b36f8b9cfd88aa4d906e7ea28 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5063151 Reviewed-by: Anders Hartvoll Ruud <andruudchromium.org> Commit-Queue: Rune Lillesveen <futharkchromium.org> Cr-Commit-Position: refs/heads/main{#1230573} -- wpt-commits: 8fe24833480b88775d0f9b4f908c63c185162fb2 wpt-pr: 43375 UltraBlame original commit: 6a88796424e055d7b7064bc9b11edcfc0ce321f2
The new proposal is here: w3c/csswg-drafts#9598 (comment) inset-area now affects the containing block size and 'auto' insets become 0 for inset-area. Bug: 1477314 Change-Id: Ia2f0d5a1f866cd659f9e3f87ec2f639141df6a94
The new proposal is here: w3c/csswg-drafts#9598 (comment) inset-area now affects the containing block size and 'auto' insets become 0 for inset-area. Bug: 1477314 Change-Id: Ia2f0d5a1f866cd659f9e3f87ec2f639141df6a94
The new proposal is here: w3c/csswg-drafts#9598 (comment) inset-area now affects the containing block size and 'auto' insets become 0 for inset-area. Bug: 1477314 Change-Id: Ia2f0d5a1f866cd659f9e3f87ec2f639141df6a94
Also see #9945 |
The CSS Working Group just discussed The full IRC log of that discussion<fantasai> Tab is going to intro the issue for people to think about<fantasai> -> https://github.com//issues/9598#issuecomment-1836854109 <fantasai> -> https://github.com//issues/9598#issuecomment-1817244328 <fantasai> TabAtkins: Suppose a very simple example: animating from `inset-area: top` to `inset-area: bottom`. <fantasai> TabAtkins: These containing blocks aren't numbers, they're names. So can't transition them. <fantasai> TabAtkins: It also defaults the alignment to different values <fantasai> TabAtkins: can't transition from align-self end (first case) to align-self: start (second case) <fantasai> TabAtkins: Can't animate between those <fantasai> TabAtkins: If your positions can be described by top/left/bottom/right (and the same combination of such properties) in both first and last frames, you can animate smoothly <fantasai> TabAtkins: but otherwise can't <fantasai> TabAtkins: We're proposing to solve this by introducing a new property <fantasai> TabAtkins: position-animation: normal | magic <dbaron> TabAtkins: "magic" is not the final name <fantasai> TabAtkins: magic computes to a rectangle. This rectangle is never exposed to authors, always serializes as "magic" <fantasai> TabAtkins: but it has x/y offsets and width/height <fantasai> TabAtkins: when position-animation is magic on both sides of a transition, this overrides all the rest of the abspos positioning properties (insets, alignment, etc) <fantasai> TabAtkins: we can smoothly interpolate the rect, so you get proper animation <fantasai> TabAtkins: We don't expose the rect to authors because this would bypass the rest of the cascade -- it needs to win over all the other properties to work <florian> q? <florian> q+ <fantasai> TabAtkins: modulo style interleaving issue, which need to discuss, we think this would solve all the animation issues for positioning <khush> q+ <dbaron> position-animation: properties | coordinates <fantasai> TabAtkins: it also fixes, e.g. if you change which element resolves against your --foo anchor name <emilio> q+ <fantasai> fantasai: So you'd write `transition: position-animation 2s` <fantasai> TabAtkins: assuming you set `magic` for both starting and ending points <fantasai> TabAtkins: our implementers think something similar to this is going to work |
Reminder to @frivoal @khushalsagar and @emilio to post the responses we did not have time for in the meeting here |
Its unclear how we deal with the fact that the anchor's position can change in the middle of the animation. Its possible you're interpolating from top to left, there is an active scroll, and while we're in the middle of the top->left interpolation the position fallback algorithm changes the end state to bottom. |
I think the general handling that's in CSS transitions for style changes that happen in the middle of a transition and change the end state ought to handle that sort of case reasonably. Transitions has a bunch of special cases for the timing of such a change if the new endpoint is the old start point, that is, when the original change is being reversed -- but otherwise you should just end up with a regular new transition from the current point in the old transition to the new destination. As long as the I admit it's not quite smooth in that the old transition stops suddenly while the new one starts smoothly as though the old position were static, but I haven't heard complaints about that behavior for other types of animations. |
I agree that as long as the end state of the property being interpolated by the CSS transition is updated when the anchor position changes, it should work. But the model @fantasai was describing had some sort of "reflect"/"override" modes, where in reflect mode the browser is computing the anchor position (using all the fallbacks) as usual. And when the CSS transition is triggered, we switch to an "override" mode where the interpolated position applies until the end of the transition. We don't recompute the anchor position. With this model the anchor position won't retarget until the end of the transition which would be incorrect. |
Yes, but as we've discussed before internally Tab, I don't like the very animation-specific feel of this, nor the magic behavior of Boring Position PackageThe position/size of the element can be affected by many things:
But ultimately, it must result in a rect [X,Y,W,H] in some reference frame. Perhaps we can give the author the power to optionally override this [X,Y,W,H] with a new property, tentatively called
Unanswered question: What is [X,Y] relative to? (We have to answer this question also for the non-boring position package). The above would not affect what we need to implement, nor the problems we need to solve vs. the non-boring position package, but I think this results in a less magical API. Usage:
|
@andruud The reason I pushed to have the rects serialize out as a magic keyword and not be parseable in CSS syntax is that this property effectively overrides every declaration that affects positioning and layout in CSS regardless of its cascade level. I don't think we should be giving authors access to such a property, even if we need it internally to make the animations work. It should never be used in CSS. |
I commented on this in the F2F, but I think this is a lot of complexity and magic, to the point where it might be worth punting to L2 along with |
A compromise is to support position interpolation but not size interpolation. This can be implemented very efficiently by having the I'm not a fan of the "intermediary sizes are just interpolations of two rectangles" thing, it's not efficient and I don't think it makes sense in the vast majority of the cases where it will happen. |
The new proposal is here: w3c/csswg-drafts#9598 (comment) inset-area now affects the containing block size and 'auto' insets become 0 for inset-area. Bug: 1477314 Change-Id: Ia2f0d5a1f866cd659f9e3f87ec2f639141df6a94 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5163733 Commit-Queue: Rune Lillesveen <futhark@chromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Cr-Commit-Position: refs/heads/main@{#1247073}
@fantasai Right, I was a bit surprised by this, as it contradicted what Tab and I discussed a few days before. But I do see the problem. |
The CSS Working Group just discussed
The full IRC log of that discussion<keithamus> TabAtkins: this is two distinct issues. I had an issue in the works to post, but didn't get it finished before the end of the day.<keithamus> TabAtkins: Presently, when we define container queries we implied how anything effected by the query worked but it's not specified. <keithamus> TabAtkins: At the least chrome and webkit act similarly - so there's a throughline. <keithamus> TabAtkins: The existence of container queries is that computed values depend on layout <keithamus> TabAtkins: They must be computed. If a container query matches, changes the value, and the child has a transition on the property it needs to fire the transition <keithamus> TabAtkins: This is a computed value change. We can't know this until layout is already happening and has reached the container. <keithamus> TabAtkins: So we need to somehow figure out what the values were and patch them in. <keithamus> TabAtkins: This needs to be specified. <keithamus> TabAtkins: The rough description is what i just described; part way through layout when we interleave style and layout, and some point (which we'll specify) you realise the computed values need to change as the result of layout, we compute them, teat them as computed values - figure out trasnitions, inheritance, etc - then continue along as if they <keithamus> were alwyas those values <keithamus> TabAtkins: this is also how we make anchoring work well <keithamus> TabAtkins: With the interleaving - does that sound reasonable to eveyrone? Chrome already does this. WebKit is similar but its not as scoped, they do more work but the end result is the same <keithamus> TabAtkins: I do not know what Firefox does. How it handles these. <keithamus> emilio: we do something very similar to WebKit here. <keithamus> TabAtkins: impl details determine exactly what happens, but does this description work? <emilio> q <emilio> q+ <astearns> ack emilio <keithamus> emilio: for webkit and gecko (may have some issues with transitions). Is sort of what you describe but it's not... you update the page layout, then recompute the styles for things that change. I'm not sure specifying it that way... like the interleaving blink has... <keithamus> emilio: if you do the extra work of if something changes then recompute it... I mean it generally sounds the right direction but I'd like to have a read of it before. <keithamus> TabAtkins: yes I'm interested in if this is the right direction <keithamus> emilio: the difference between blink and webkit/gecko, AFAIK, style the page as if no container queries match, then do layout, then for things where container queries change, recompute style, then loop until you get to a stable state. Blink does something more subtle. <iank_> q+ <keithamus> futhark: in optimal cases we can pause layout and style the subtree, then continue. In several cases we do also need to do multiple passes. Layout depends on auto widths for eg we may not correctly detect this then have something more similar to gecko/webkit <keithamus> iank_: not exactly the same... <astearns> ack iank_ <keithamus> iank_: webkit/gecko are failing tests for behavioural difference. Some subtle differences, because they're revisiting prior states. <keithamus> astearns: are tests written down based on spec or impl? <keithamus> iank_: written in spec. <TabAtkins> (there is no spec to be followed right now) <keithamus> astearns: observability... is this a design decision for how we visit this? Recomputation being observable? <emilio> q+ <keithamus> chrishtr: right. Not observable. <keithamus> chrishtr: difference in blink and other two engines, it's a bit more optimised to avoid recomputing. <keithamus> iank_: it's quite a bit faster for degenerate cases, and bugs in other engines. Theoretically could be fixed. <keithamus> chrishtr: just a matter of quality of impl difference? <astearns> ack emilio <keithamus> emilio: main difference is how to prevent cycles, things depending on siblings, ancestors, scrollbars, and so on <keithamus> iank_: not cyclical but previous states. <keithamus> astearns: Do we want a resolution? Computed values getting recomputed? <keithamus> PROPOSED RESOLUTION: Specify how styles that are conditionally dependant on layout get recomputed <keithamus> RESOLVED: Specify how styles that are conditionally dependant on layout get recomputed <keithamus> Zakim, next item <Zakim> I see nothing on the agenda <keithamus> TabAtkins: next up. Anchor and anchor size functions should be dependent on this concept. <keithamus> TabAtkins: right now... the anchor function needs to turn into a length, we're not sure exactly when, but at some point it needs to turn into a length to position your element. You need to layout your anchor first then figure out what the length is. It should be transitionable. <keithamus> TabAtkins: if your anchor moves, you should be able to smoothly transition things. If the element you're referring to, e.g. changing anchor name values, you should smoothly transition to them. <keithamus> TabAtkins: So this is dependent on that too. <keithamus> TabAtkins: Larger bit on animation too, but the interleaving is important <keithamus> emilio: other than animation why do we need it to turn into a length? <keithamus> TabAtkins: it is for animation <keithamus> TabAtkins: for all other purposes it's fine <keithamus> emilio: it feels unfortunate that for all other cases it needs to do the extra work to compute <keithamus> emilio: making it a computed value requires some amount of extra work. Unfortunate to require this. If we need it to be computed, then it makes sense, but ordering & dependencies get very tricky. <keithamus> TabAtkins: It's a more complex relationship than container queries. At the moment it means we don't do as-smart trimming for interleaving because the relationship is more complex. <keithamus> astearns: if we want these things to animate then we have to do something? These things animate descretely... we don't want that. Stuffing these changes into computed values, beause that's how animations work, but I suppose we could say computed values that depend on layout use used values instead? That seems worse <keithamus> TabAtkins: I don't know if that seems worse. We're doing all this for the purpose of animations. If there's a simpler solution I'm happy to explore it. <chrishtr> q+ <keithamus> iank_: can't use used values... they're at the wrong phase for animations. To do that would be a big and complicated lift. <keithamus> astearns: we're kind of doing that, not used but recomputed which are closer to computed. <keithamus> iank_: I don't think it's comparable. <astearns> ack chrishtr <keithamus> chrishtr: second what iank_ says. emilio is right in difficulty of interleaving but the coherence and overall complexity is less than creating a new way of doing animations. This is just scoped to doing the interelaving, already had to be done for container queries, animations just fall out of that. Confirmed in prototype in blink. Clean solution. <keithamus> q? <astearns> ack dbaron <keithamus> dbaron: the other scary thing is used values - we don't fully formally defined them vs earlier stages <keithamus> PROPOSED RESOLUTION: We will use the same sort of recomputed values for animations on anchor & anchor-size functions <keithamus> emilio: do we need to define what they resolve to when the anchor is not there? <keithamus> TabAtkins: already in the spec. It's the fallback value, which is zero if not specified. <keithamus> emilio: if your anchor has been laid out... I guess I'm wary of the outcomes that happen when you incrementally do this. An anchor function... <keithamus> emilio: I think container queries have the same issues but this can be sorted in the spec. <keithamus> emilio: when you have a style change and the anchor has been laid out before. That can be dealt with the same way as container queries. Probably fine. <keithamus> TabAtkins: Curious about exactly the case. We can discuss in the issue if you'd like <keithamus> astearns: is there a need to specify how animation from anchor size from initial to actual recomputed value? Or does that fall out <keithamus> TabAtkins: initial value? <keithamus> astearns: if anchor isnt there it falls back to initial value. Something changes such that there is an anchor - is it possible to animate from that to a place in layout? <keithamus> TabAtkins: that behavior should fall out <keithamus> RESOLVED: We will use the same sort of recomputed values for animations on anchor & anchor-size functions <chrishtr> +1 to deferring to level 2 <keithamus> TabAtkins: one final bit. Do we want to defer fancy animation stuff? emilio proposed that there are enough holes in the idea of position animation animating the rectangle idea I discussed in the f2f. We want to spend more time thinking about it? I'm okay with this based on above resolutions. Most cases will animate reasonably. <keithamus> TabAtkins: Edge cases should be safe to upgrade to via some kind of opt in. <keithamus> TabAtkins: I propose we kick animation idea to level 2 and work on it later. <astearns> ack fantasai <fantasai> https://github.com//issues/9598#issuecomment-1836854109 <keithamus> fantasai: I dont mind if we want to push animatability questions to level 2, but there was a number of follow up changes we were planning to make to inset area, alignment, and other things listed, I don't want to defer. As long as making those changes depend on animation, I'd like us to figure out animation <keithamus> TabAtkins: what might we change on inset area? <keithamus> fantasai: containing block vs only causing auto values to compute <keithamus> TabAtkins: already in the spec <keithamus> fantasai: when? That was in this issue? <keithamus> TabAtkins: it's been in for a while <keithamus> TabAtkins: previously we had inset area work by adjusting auto values of inset properties, causing inset properties to match up. This would allow you to animate between inset areas, to some extent. The Apple proposal instead proposed the inset area changed the containing block, which I pushed back on as it was less animatable. <keithamus> TabAtkins: it's a better behaviour to do the container block change and solve animations some other way. If we're deferring the animations stuff to level 2 it means we're potentially regressing inset area animations. I'm okay with that... if we set inset area back to how... resolves, we don't have a good path to a better future world. <keithamus> TabAtkins: I'm okay with it being less animatable now since we have an idea of how we're going to fix in the future. <keithamus> PROPOSED RESOLUTION: Accept that inset area changes the containing block <keithamus> RESOLVED: Accept that inset area changes the containing block <flackr> q+ <keithamus> fantasai: that was my main concern, if we need more time and nothing is blocking then that's fine <astearns> ack flackr <keithamus> flackr: we won't be able to automatically enable these animations right? <keithamus> TabAtkins: current proposal is a position-animation property to trigger the good behaviour. <keithamus> TabAtkins: cannot do it by default as it'd be incompatible with todays behaviour <keithamus> flackr: can change it so certain position types are animatable and others aren't? <keithamus> TabAtkins: yes, this is an argument to defer it so it isn't just focused on anchor <keithamus> flackr: I just want to make sure the upgrade path isn't too difficult <keithamus> astearns: what will be animatable in level 1 vs 2? <keithamus> TabAtkins: level 1- properties animating as normal to the extent of positioning insets, e.g. top and left. but if you switch from top to using bottom that won't smoothly interpolate. <keithamus> TabAtkins: or if you change inset area, or self alignment from align self to justify self. Properties will animate it won;t be descrete, but it wont be smooth <keithamus> flackr: usually authors will rely on transitions so there'd be no animation, change from auto to non auto would be descrete <keithamus> astearns: any concerns with level 1? <keithamus> PROPOSED RESOLUTION: Defer magic position animations until level 2 <keithamus> RESOLVED: Defer magic position animations until level 2 <keithamus> astearns: Next Clarifying inset area syntax. |
This CL removes the option of evaluating anchor() and anchor-size() functions at used-value time, per recent CSSWG resolution [1]. This eliminates the need for an AnchorEvaluator to resolve a Length, which means don't need to send that around to the extent we did before. It's still needed in some cases, because AnchorEvaluatorImpl is used for some secondary purposes in absolute_utils.cc. We still use CalculationExpressionAnchorQueryNode to represent the anchor query during Length::AnchorEvaluator::Evaluate for now. A follow-up CL will address this. Except for the removal of the feature flag, there should be no behavior change. Bug: 41483417 [1] w3c/csswg-drafts#9598 Change-Id: I068a57fcb6b5c90e133a36e095e8bbf25861714d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5355673 Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#1270318}
Edit: This comment's proposal is out of data, our current proposal is over here.
Issue: Because the inset properties are four separate properties, you can't animate them "together" - instead you can animate each of the four independently, and hope that what you're expressing is reasonable for that to work. That's not always true!
For example, going from
bottom: anchor(top);
totop: anchor(bottom);
(with the opposite inset beingauto
) will not animate properly - it'll be trying to interpolatetop
fromauto
toanchor(bottom)
(which won't work), and similar forbottom
. You can explicitly write atop/bottom: 0;
in each case, which will technically animate, but not in a useful way; now, to get things to line up correctly, you'll need to specifyalign-self
too:...and
align-self
doesn't have animation rules to smoothly animate fromstart
toend
(yet, #9556). (And even if we did, it wouldn't work quite correctly - analign-self: start 50%;
will center in an IMCB with a top of(0% + anchor(bottom))/2
and a bottom of(0% + anchor(top))/2
, and that is very likely not halfway between its starting and ending position. In general, this sort of "interpolate a position within an interpolating range" doesn't produce a linear interpolation of the position in an absolute context; it produces a quadratic spline path instead.)So that's the issue. How do we solve it? Here's my suggestion:
inset-area
. In addition to the existing grid-based syntax, add a[ <side-keyword> <length-percentage> ]{1,4}
production, which similarly defines a rectangle and causesauto
insets (andnormal
self-alignment) to resolve accordingly. Soinset-area: top anchor(bottom);
, for example.auto
insets (andnormal
self-alignments) at computed-value time, they resolve at used-value time. This removes the ability to animate the inset properties directly from the inset-area value.inset-area
directly animateable. Addinset-area-mix(...)
, which represents the interpolated result between twoinset-area
values. This represents whatever insets and alignments would be required to make the position of the element interpolate smoothly between the two endpoints (rather than being a naive interpolation of edges and alignment). So long as all your actual inset properties and self-alignment properties are set toauto
/normal
, it'll Just Work.I still need to give a little more thought to how the new side-based production handles alignment. In the grid syntax I can pretend that the default anchor is inside the containing block, so all the grid lines are correctly ordered and I can infer some positioning, but that's more difficult when the edges can indeed be misordered due to positioning. I'm pretty sure there's a good solution here, I just haven't fully worked thru it yet.
The text was updated successfully, but these errors were encountered: