Re: [css-transforms] Value for perspective() function

On Sun, Apr 3, 2016 at 6:12 PM, Xidorn Quan <quanxunzhen@gmail.com> wrote:
> Hi,
>
> The spec says, for value inside perspective() function:
>> The value for depth must be greater than zero, otherwise the function is
>> invalid. [1]
>
> However, there there is a statement in the spec saying that perspective(0)
> is an netural function [2]. Either this one or the description above should
> be changed somehow.
>
> Currently, Gecko treats perspective(0) as invalid per spec, and thus drops
> the transform decl, while others treat that as perspective(infinity) (or
> probably just ignore it), which becomes a webcompat issue [3], and there is
> discussion for the Compatibility Standard [4].
>
> It seems to me treating perspective(0) as perspective(infinity) doesn't make
> sense anyway. The spec should probably either change to making it completely
> invalid, or treating it as an infinitesimal small non-zero value, which
> might benefit animation.
>
>
> [1] https://drafts.csswg.org/css-transforms/#funcdef-perspective
> [2] https://drafts.csswg.org/css-transforms/#neutral-element
> [3] https://bugzilla.mozilla.org/show_bug.cgi?id=1009150
> [4] https://github.com/whatwg/compat/issues/48

Yeah, there are multiple problems here:

1. 0 is the EXACT OPPOSITE of a neutral value; the effect of
perspective() is *magnified* as the argument approaches 0.  So that
definition is just nonsense.  The actual neutral value is "infinity",
but that's not animatable. :/
2. Making 0 invalid for floating-point values violates our rules for
limited ranges, as it makes valid values an open range; it means that
whether a *perfectly valid* value might become invalid due to browser
rounding differently than expected. The spec should instead define a
minimum perspective and clamp values to that.  Negative values can
remain invalid.

~TJ

Received on Monday, 4 April 2016 23:57:25 UTC