[Bug 16183] New: Make parsing of non-positive perspectives consistent

https://www.w3.org/Bugs/Public/show_bug.cgi?id=16183

           Summary: Make parsing of non-positive perspectives consistent
           Product: CSS
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Transforms
        AssignedTo: smfr@me.com
        ReportedBy: ayg@aryeh.name
         QAContact: public-css-bugzilla@w3.org
                CC: ayg@aryeh.name, cmarrin@apple.com, eoconnor@apple.com,
                    smfr@me.com, dino@apple.com, dschulze@adobe.com


The spec now says for the 'perspective' property

"""
If the value is ‘none’, less than or equal to 0 no perspective transform is
applied.
"""
http://dev.w3.org/csswg/css3-transforms/#perspective-property

This means that nonpositive values are parsed as "none".  On the other hand,
for perspective() it says

"The value for depth must be greater than zero, otherwise the function is
invalid."
http://dev.w3.org/csswg/css3-transforms/#three-d-transform-functions

This means that nonpositive values are parse errors.  The behavior should be
consistent.


Test-case for 'perspective':

data:text/html,<!doctype html>
<body style="perspective:200px;perspective:0">
<script>
document.body.textContent =
getComputedStyle(document.body).perspective
</script>

Also test replacing "0" with "-10px".  Results:

* In IE10 Developer Preview, "0" parses the same as "none", but "-10px" doesn't
parse.
* In Chrome 18 dev, "0" parses the same as "none", but "-10px" doesn't parse.
* In mozilla-central (Firefox 13.0a1), "0" and "-10px" don't parse.

Testing with

data:text/html,<!doctype html>
<body style="transform:scale(2);transform:perspective(0)">
<script>
document.body.textContent =
getComputedStyle(document.body).transform
</script>

* In IE10 Developer Preview, "perspective(0)" is parsed as the identity matrix,
while "perspective(-10px)" is a parse error.
* In Chrome 18 dev, "perspective(0)" is parsed as the identity matrix, while
"perspective(-10px)" is a parse error.
* In Firefox 13.0a1, "perspective(0)" and "perspective(-10px)" both don't
parse.

Thus we have two behaviors: in IE/Chrome, negative values don't parse for
either the property or the function, but 0 parses as "none".  In Gecko, no
nonpositive value parses.  The spec should match one or the other.

IMO, Gecko's behavior makes more sense.  A perspective of zero logically should
result in everything disappearing; 'none' is equivalent to a perspective of
infinity.  Moreover, there are already other, clearer ways of achieving the
same effect: instead of "perspective: 0" one can write "perspective: none", and
instead of "perspective(0)" one can omit the function from the transform list
entirely.

However, Gecko is in the minority, and before Firefox 13 it behaved differently
anyway (https://bugzilla.mozilla.org/show_bug.cgi?id=725036).  Does anyone
think we should change the spec to match IE/Chrome?  If people feel strongly,
I'll do that and patch Firefox and my tests so they match.  Otherwise, I'll
change the spec so it matches Gecko, which also already matches the tests.  (I
was just told I got my CVS access.)

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Thursday, 1 March 2012 18:27:58 UTC