Skip to content

[css-transforms-1] User coordinate space statement breaks SVG #893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
smfr opened this issue Jan 12, 2017 · 5 comments
Closed

[css-transforms-1] User coordinate space statement breaks SVG #893

smfr opened this issue Jan 12, 2017 · 5 comments
Assignees
Labels

Comments

@smfr
Copy link
Contributor

smfr commented Jan 12, 2017

http://www.w3.org/mid/CAFDDJ7yhF7Qn28wVMqb7ra6N9Q=j74OTqHWpjLeYrH=LQwmd4A@mail.gmail.com

In the CSS transforms module, the section "User Coordinate space" has the
following statement:

In particular the patternUnits

http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#PatternElementPatternUnitsAttribute
, gradientUnits
http://www.w3.org/TR/2011/REC-SVG11-20110816/pservers.html#LinearGradientElementGradientUnitsAttribute
and maskUnits
http://www.w3.org/TR/2011/REC-SVG11-20110816/masking.html#MaskElementMaskUnitsAttribute attributes
don’t affect the user coordinate system used for transformations [SVG11]
http://dev.w3.org/csswg/css-transforms-1/#biblio-svg11.

Links:

Although the draft spec references SVG 1.1, this would be a breaking
change
from current SVG behavior. The SVG definition used for
gradientTransform and patternTransform is as follows:

This additional transformation matrix is post-multiplied to (i.e.,

inserted to the right of) any previously defined transformations, including
the implicit transformation necessary to convert from object bounding box
units http://www.w3.org/TR/SVG11/coords.html#ObjectBoundingBox to user
space.

Links:

http://www.w3.org/TR/SVG11/pservers.html#LinearGradientElementGradientTransformAttribute

http://www.w3.org/TR/SVG11/pservers.html#PatternElementPatternTransformAttribute

Unless there is an overwhelming reason to change this, I would recommend
that the CSS transforms text be updated to state the transformation applies
in the user coordinate system in effect for the element's contents,*
including* any implicit transformations created by patternUnits,
gradientUnits, or maskUnits.

@smfr smfr added the css-transforms-1 Current Work label Jan 12, 2017
@smfr smfr changed the title User coordinate space statement breaks SVG [css-transforms-1] User coordinate space statement breaks SVG Jan 13, 2017
@smfr smfr added the SVG label Mar 22, 2017
@smfr
Copy link
Contributor Author

smfr commented Nov 6, 2017

@AmeliaBR, I wonder if you might have mis-read this paragraph in the spec:

In particular the patternUnits, gradientUnits and maskUnits attributes don’t affect the user coordinate system used for transformations [SVG11].
Note that it's talking about patternUnits, not patternTransform. I'm not sure what that paragraph is trying to say, however (maybe that patternUnits affects the rendering of the pattern, but not other things rendered in the local coordinate space of the referencing element?)

@smfr
Copy link
Contributor Author

smfr commented Nov 9, 2017

@dirkschulze to figure something out

@AmeliaBR
Copy link
Contributor

AmeliaBR commented Nov 9, 2017

On re-examination, I suspect the paragraph was trying to distinguish between patternUnits vs patternContentUnits, and maskUnits vs maskContentUnits. But then I'm not sure what gradientUnits is doing there.

For masks, it might make sense to only transform the mask contents, not the extent rectangle.

But for patterns, you want to transform both the pattern tiles and the pattern contents. That is what implementations currently do, and a pattern transform would be fairly useless otherwise. However, implementations are not interoperable in some of the other details of patternTransform, like defining where the origin is and how the transformations interact with a viewBox.

@dirkschulze
Copy link
Contributor

Ok, looked at this again. Lets limit the issue in question to the <pattern> element.

The <pattern> element has the attributes patternUnits, patternContentUnits and patternTransform. All 3 attributes influence the coordinate system for drawings.

  • patternContentUnits modifies the coordinate space for the content of <pattern> (content of the tile)
  • patternUnits specifies a coordinate space for the pattern tile itself. Namely the width and height attributes.
  • patternTransform specifies the coordinate space for the pattern itself. Percentage values get resolved according to the reference box of the referencing element in the local coordinate space of the referencing element (a <rect> element for instance).

As a result, according to the current specification text, patternUnits do not contribute to the transformation of the patternTransform.

@AmeliaBR Do you think this is a breaking change? Do you have an example?

@dirkschulze
Copy link
Contributor

I think my previous statement is incorrect in a way and so is the following spec text:

In particular the patternUnits, gradientUnits and maskUnits attributes don’t affect the user coordinate system used for transformations [SVG11].

patternUnits, gradientUnits and maskUnits clearly state that the transform gets applied after the coordinate transformation by those attributes. So, the transforms apply in the pattern space, gradient space or mask space. Only for <clipPath>, the coordinate space is the user coordinate space of the target.

I’ll change the spec text to reflect that and simply link to the *units attributes that would define the mapping of pattern space an co.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants
@smfr @dirkschulze @AmeliaBR and others