Page MenuHomePhabricator

Perspective property should expect length not number
Open, Needs TriagePublicFeature

Description

Currently the property "perspective" seems to expect a number in CSS-Sanitizer, but it should be a lenght.
See e.g. https://developer.mozilla.org/en-US/docs/Web/CSS/perspective

I guess the problem is around line 1016 in https://gerrit.wikimedia.org/r/plugins/gitiles/css-sanitizer/%2B/master/src/Sanitizer/StylePropertySanitizer.php
where it says:

$props['perspective'] = new Alternative( [ new KeywordMatcher( 'none' ), $n ] );

In the comment there it refers to a W3-standard, but maybe this is mistaken with the function "transform perspective()" which obviously is something different.

I came on this because in MediaWiki Extension TemplateStyles the following CSS statement gives an error when trying to save:

perspective: 1000px;

Event Timeline

Tgr subscribed.

https://www.w3.org/TR/2009/WD-css3-3d-transforms-20090320/#perspective-property clearly defines it as a number. The rules could use an update, but we should probably do that in one go, not property by property.

I think the W3 working draft you are referring to is quite outdated (2009) and in this case for the perspective property a number is not even understood by current browser versions.

Please see https://www.w3.org/TR/css-transforms-2/#perspective-property

As a minor note, perspective isn't mentioned at all in the version of Transforms 1 that https://gerrit.wikimedia.org/r/c/css-sanitizer/+/562681 implemented.

Izno changed the subtype of this task from "Bug Report" to "Feature Request".Jan 14 2023, 1:53 AM