Open tabatkins opened 1 year ago
After some archaeology, the "computes to the value from offset-position" was meant to give transforms a kind of background-position-like percentage behavior - offset-position: 100% 0%; offset-anchor: auto;
would end up putting the element's starting position in the top-right corner, similar to how background-position: 100% 0%
does for a background tile.
However, that's (a) already achievable with just slightly more manual work, by repeating the % yourself in both properties, and (b) as noted, completely nonsensical when offset-position is not written in percentages.
So yeah, my proposal stands; I think it's the only reasonable and consistent way to make this all work.
Agenda+ to accept my proposal (that offset-anchor: auto
reuses the 'transform-origin' point). The spec already contains this text, since what was there previously was nonsensical.
The CSS Working Group just discussed [motion-1] offset-anchor:auto is nonsensical
, and agreed to the following:
RESOLVED: offset-anchor:auto uses transform-origin point
The definition of
offset-anchor: auto
says:This is word salad. If I attempt to interpret it as directly as I can, it gives wildly nonsensical results - it implies that
offset-position: 100px 80px; offset-anchor: auto;
will specify the anchor as being 100px to the right and 80px down from the element's top-left corner (while the offset-position is 100px/80px from the containing block's top-left corner). The 'transform-origin' part makes sense (at least in theory, see below), but then the next sentence (about anoffset-path: none
element!) is simply nonsense.Like 'offset-position' before my recent rewrite in 2823e66, I suspect this section's text is entirely a leftover of when the offset properties were defined as a type of absolute positioning, rather than a type of transform, and if you didn't say anything specific about the path it defaulted to using 'offset-position' as an alternative to 'top'/'left'.
Also, 'transform-origin' is defined relative to the 'transform-box'. Motion doesn't have the same thing; if you just say "computes to the value of transform-origin" but transform-box is a non-initial value, you'll end up with the anchor point not matching the transform origin.
Suggested fix:
offset-anchor: auto
just sets the anchor point to be the same point as the transform origin. (This'll have to be specified in slightly more detail, since transform-origin doesn't technically define a point; instead it defines a pair or trio of lengths that feed into the transform matrix as a translate before and after the rest of the transforms. But this should be pretty easy to do.)