Seokho Song
Seokho Song
1 min read

Categories

Tags

LANGUAGES


I released CSS Trigonometric Functions

Screenshot 2022-12-20 at 9 08 24 AM

Feature Entry: https://chromestatus.com/feature/5165381072191488

I released the project “CSSTrigonometricFunctions” which is implementing the trigonometric functions to CSS on Chromium.

I have released the second feature that has a feature flag to chromium working as a hobby at the extra times kind of after/before work and weekends.

CSS Trigonometric Functions project is to implement the following functions:

MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Functions#trigonometric_functions

These functions are defined in w3c / css-values-4 specification.

The CSS trigonometric function is an implementation of css-values-4 spec. In 2018, The first draft of css-values-4 was released by w3c, and in 2020 they introduced the trigonometric functions chapter ”11.4. Trigonometric Functions: sin(), cos(), tan(), asin(), acos(), atan(), and atan2()”.

At the beginning of this year, I planned to implement this feature. But there are some issues like the codebase conflicts with refactoring so I could start in July. This feature took formal chromium feature implementation steps including intent to prototype, intent to ship, and 3 approved by other committers. I merged the CL about enabling by default the feature flag CSSTrigonometricFunctions after 3 approval. In chrome 111, this feature will be included.

You can use it on Chrome 111 (Beta: Feb 9 - Feb 16, Stable: Mar 1)

The main changes were the creation of the function that evaluates and process the trigonometric functions. Per one CL(like PR) handled one trigonometric function with implementing WPT test code.

Resolving relative length on atan2() has tricky problems (especially, evaluating relative length in parsing time). So, Using its double value for now.

This issue occurred in other mainstream browsers gecko, webkit. W3C/CSSWG is discussing this issue.

Related issues: