ocsigen / ocsigen/tyxml

Mix between different versions of `skew` in the SVG specification

Open
#329 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
OCaml
Stars
179
Forks
63
Avg merge
5h
Merged PRs (30d)
22

Description

As stated in #328, there seems to be an issue around skew, skewX, and skewY.

I don't know enough the SVG specification, but there seems to be two different incompatible specifications of skew (and its variants skewX and skewY):
https://drafts.csswg.org/css-transforms/#svg-skewX
https://drafts.csswg.org/css-transforms/#funcdef-transform-skewx

In one case, skew only expects a number (meaning an angle in degrees). In the other case, skew expects an angle which is composed of a number and a unit (rad , turn, grad, deg), sometimes with an additional 0 value, sometimes not.

The question is what should we do about `SkewX? Should it accepts an angle, or a float?
https://github.com/ocsigen/tyxml/blob/master/lib/svg_types.mli#L302

The issue is that currently TyXML refuses a correct syntax transform="skewX(42)" while printing an invalid transform="skewX(42deg)" in some contexts.

I can see several ways to resolve this. One could be to use angle internally, but accept both variants (with or without unit), and print-out the right version (potentially converting into degrees when the variant with unit is not accepted).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/svg_types.mli around line 302 and compare the two linked CSS Transforms definitions for skewX, skewY, and skew. Reproduce the reported handling of transform="skewX(42)" and transform="skewX(42deg)"; done requires resolving the accepted representation and emitted syntax consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
web-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.