This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 15681 - Computed values for perspective and perspective-origin don't match implementations
Summary: Computed values for perspective and perspective-origin don't match implementa...
Status: RESOLVED FIXED
Alias: None
Product: CSS
Classification: Unclassified
Component: Transforms (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Dean Jackson
QA Contact: This bug has no owner yet - up for the taking
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-23 20:47 UTC by Aryeh Gregor
Modified: 2012-03-12 20:42 UTC (History)
6 users (show)

See Also:


Attachments

Description Aryeh Gregor 2012-01-23 20:47:52 UTC
For perspective, the spec says

"Computed value:	 Same as specified value."
http://dev.w3.org/csswg/css3-3d-transforms/#perspective-property

This should instead be something like 'Absolute length or "none"'.  The current spec text implies that things like "1em" aren't resolved as computed values, which doesn't match Firefox 12.0a1.  Test-case:

data:text/html,<!doctype html>
<div style="-moz-perspective:10000em">
<div style="-moz-perspective:inherit;
font-size:0.001em">
<div style="height:100px;width:100px;background:red;
-moz-transform:rotateX(-45deg)">

This looks different if you replace "inherit" by "10000em".  This is because the computed value of perspective is actually an absolute length, so if you do "inherit" it inherits the pixel size and the font-size does nothing, while if you re-specify 10000em it uses the em on the current element with a much smaller font-size.

I was unable to test rendering in IE10 or WebKit.  However, in both Firefox 12.0a1 and Chrome 17 dev, getComputedStyle().(Moz|webkit)Perspective is also not as specified -- it's resolved to a pixel value or "none".  So this spec change will fix resolved values too.


For perspective-origin, the spec says the same:

"Computed value:	 Same as specified value."
http://dev.w3.org/csswg/css3-3d-transforms/#perspective-origin-property

I believe it should instead say "For <length> the absolute value, otherwise a percentage", like transform-origin.  Also like transform-origin, I believe the resolved value should be defined as an absolute value only (see bug 15433).  Here I wasn't able to get a visual test-case for any browser, but this demonstrates that the resolved values in Chrome 17 dev are always pixels, and in Firefox 12.0a1 are pixels or percentages, unlike what the current spec implies:

data:text/html,<!doctype html>
<body style="perspective-origin:10% 20em">
<script>
document.documentElement.textContent =
getComputedStyle(document.body).perspectiveOrigin
</script>
Comment 1 Aryeh Gregor 2012-03-01 20:45:58 UTC
I'll make these changes as time permits, if no one disagrees.
Comment 2 Aryeh Gregor 2012-03-12 19:32:31 UTC
(In reply to comment #0)
> Also like transform-origin, I believe the
> resolved value should be defined as an absolute value only (see bug 15433). 

I fixed this part: http://dvcs.w3.org/hg/csswg/rev/9338e35c5058
Comment 3 Aryeh Gregor 2012-03-12 20:42:40 UTC
Fixed: http://dvcs.w3.org/hg/csswg/rev/8f24ae8e8e3f