Bug 70026 - Make CSS webkit-transform parser accept unit-less value
Summary: Make CSS webkit-transform parser accept unit-less value
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 70025
  Show dependency treegraph
 
Reported: 2011-10-13 07:40 PDT by Raul Hudea
Modified: 2012-02-20 19:33 PST (History)
8 users (show)

See Also:


Attachments
Initial patch to gather some feedback (23.31 KB, patch)
2011-12-08 12:56 PST, Raul Hudea
no flags Details | Formatted Diff | Diff
Allow unitless values, comma separated functions and space separated arguments in CSS transform parser (107.14 KB, patch)
2012-01-11 08:40 PST, Raul Hudea
simon.fraser: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Raul Hudea 2011-10-13 07:40:52 PDT
SVG transform accepts unit-less values, so the current parseTransform needs to handle this case
Comment 1 Raul Hudea 2011-12-08 12:56:35 PST
Created attachment 118455 [details]
Initial patch to gather some feedback

This initial patch allows the CSS parser to handle SVG transform syntax, which is different from the CSS ones. Here are some differences:
- SVG uses unit-less values defaulting to certain units: translate(10, 10)
- arguments can be separated by space: translate(10 10)
- functions can be separated by comma:  rotate(10), translate(10, 10)
- function name can be separated by white-spaces from the open parenthesis: translate (10 10)
- rotate can have 3 arguments

Also, CSS implementation uses doubles to keep the values (SVG uses floats), leading to one SVG test failing due to rounding: (difference for calculating the bounding box for scaling at 0.01 a 100px rect)
Comment 2 Dirk Schulze 2012-01-05 09:45:52 PST
Comment on attachment 118455 [details]
Initial patch to gather some feedback

I already talked with Raul about this approach. Just commenting to this bug for the history. 

I think it would be great to align up the SVG Transforms parser with the CSS Parser. That will make it possible to handle the SVG "transform" attribute like a CSS property later. That means we would remove the SVG Transforms parser and the control of SVG Transforms would go to CSS like it is done for other styling properties in SVG today. Of course more it needs to be done on the SVGDOM later, but this is a promising first step.

I suggest to create a new patch just with the CSS Parser changes for comma less arguments on functions. In a separate patch and bug report we should think about adding two new optional arguments to the CSS rotate function: rotate(<angle>[, <length>, <length>]) to match the specification of SVG Transforms.

We don't have to modify SVGTransforms at the moment. It would be better to concentrate on the CSS parser and add a lot of new tests.
Comment 3 Raul Hudea 2012-01-11 08:40:01 PST
Created attachment 122034 [details]
Allow unitless values, comma separated functions and space separated arguments in CSS transform parser
Comment 4 Simon Fraser (smfr) 2012-01-11 08:51:42 PST
Comment on attachment 122034 [details]
Allow unitless values, comma separated functions and space separated arguments in CSS transform parser

I don't get this. We can't allow unitless values in transforms in an HTML context, only when they are being used in SVG.
Comment 5 Dirk Schulze 2012-01-11 09:00:06 PST
(In reply to comment #4)
> (From update of attachment 122034 [details])
> I don't get this. We can't allow unitless values in transforms in an HTML context, only when they are being used in SVG.

As far as I know unit less values were a consensus of the editors of CSS Transforms? If we differ on unit parsing between SVG and HTML content we might confuse web developers. Also it would need to partly split the parser for HTML and SVG.

I opened a bug report on W3C. Maybe we can discuss how we should proceed there: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15507
Comment 6 Simon Fraser (smfr) 2012-01-11 09:09:57 PST
(In reply to comment #5)
> (In reply to comment #4)
> > (From update of attachment 122034 [details] [details])
> > I don't get this. We can't allow unitless values in transforms in an HTML context, only when they are being used in SVG.
> 
> As far as I know unit less values were a consensus of the editors of CSS Transforms?

That is not my understanding.

> If we differ on unit parsing between SVG and HTML content we might confuse web developers. Also it would need to partly split the parser for HTML and SVG.
> 
> I opened a bug report on W3C. Maybe we can discuss how we should proceed there: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15507

Thanks.
Comment 7 Simon Fraser (smfr) 2012-01-11 09:11:08 PST
(In reply to comment #5)

> I opened a bug report on W3C. Maybe we can discuss how we should proceed there: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15507

That bug is about comma separation, not lack of units.
Comment 8 Dirk Schulze 2012-01-11 09:27:35 PST
(In reply to comment #7)
> (In reply to comment #5)
> 
> > I opened a bug report on W3C. Maybe we can discuss how we should proceed there: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15507
> 
> That bug is about comma separation, not lack of units.

Oh sorry, my fault. We didn't have a unit less specific bug report. I opened a new bug report: https://www.w3.org/Bugs/Public/show_bug.cgi?id=15525
Comment 9 Dirk Schulze 2012-02-20 19:33:46 PST
The CSS WG and SVG WG decided to modify the syntax of SVG to support CSS syntax. This patch is doing the other way around.

Therefore I close this bug.