Skip to content
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

Resolve whether to change UserSpaceOnUse spec #538

Open
progers opened this issue Nov 21, 2023 · 2 comments
Open

Resolve whether to change UserSpaceOnUse spec #538

progers opened this issue Nov 21, 2023 · 2 comments

Comments

@progers
Copy link

progers commented Nov 21, 2023

The spec for UserSpaceOnUse (link) states that clip-path contents use a coordinate system based on the referencing element, not the referenced clip-path:

userSpaceOnUse: The contents of the clipPath represent values in the current user coordinate system in place at the time when the clipPath element is referenced (i.e., the user coordinate system for the element referencing the clipPath element via the clip-path property).

A simple example is the following testcase:

<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500">
  <svg id="inner" x="0" y="0" width="200" height="200">
    <clipPath id="myclip" clipPathUnits="userSpaceOnUse">
      <rect x="0" y="0" width="50%" height="50%" />
    </clipPath>
  </svg>
  <rect width="500" height="500" fill="green" clip-path="url(#myclip)" />
</svg>

Batik follows the spec and the clip is sized to 250x250 (50% of the viewport)
Chromium, Webkit, Gecko, and Inkscape disagree with the spec and the clip is sized to 100x100 (50% of #inner).

One path forward is to measure if the current spec is web-compatible. This could be done by looking at httparchive data for relative units in clipPath, or by collecting metrics from a browser for how often this occurs in the wild.

Additional links: chromium's tracking bug, gecko's tracking bug (see also this discussion). Aspects of this issue were raised in #249. This recently came up in interop-2023 and we excluded the two tests of this behavior (web-platform-tests/interop#608).

@thantintsan
Copy link

Please Give MaxWin

@yisibl
Copy link

yisibl commented Dec 18, 2023

I believe the resvg-js rendering is correct.

image

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

No branches or pull requests

3 participants