Bug 244254 - ConicGradient angle should start at the x-axis, not at the top
Summary: ConicGradient angle should start at the x-axis, not at the top
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: BrowserCompat, GoodFirstBug, InRadar
Depends on:
Blocks:
 
Reported: 2022-08-23 08:13 PDT by Fernando Serboncini
Modified: 2022-09-01 06:34 PDT (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fernando Serboncini 2022-08-23 08:13:51 PDT
Here's the latest discussion about it on WhatWG: https://github.com/whatwg/html/pull/8213

Here's the relevant spec: https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-createconicgradient

And the broken WPT: https://wpt.fyi/results/html/canvas/element/fill-and-stroke-styles?label=master&label=experimental&aligned&view=subtest&q=canvas%20conic

This means that the angle on ConicGradient needs to be +PI/4 to match the rest of the Canvas API.
Comment 1 Radar WebKit Bug Importer 2022-08-23 10:55:36 PDT
<rdar://problem/99041207>
Comment 2 Karl Dubost 2022-08-24 00:50:59 PDT
according to the PR
https://github.com/whatwg/html/pull/8213

> The current implementations on Safari and Firefox align the angle with CSS. Chrome's implementation and the current spec doesn't. An example of the problem is described here with this code.

So Safari and Firefox behaves correctly
and Chrome is being changed. 
https://bugs.chromium.org/p/chromium/issues/detail?id=1355539

Is there something to fix on WebKit?
Comment 3 Karl Dubost 2022-08-24 01:15:25 PDT
Never mind.
A but has been opened on Firefox and WebKit to encourage them to change. 
https://github.com/whatwg/html/pull/8213#issuecomment-1223436129
Comment 4 Myles C. Maxfield 2022-08-27 20:27:04 PDT
Will this be a breaking change?
Comment 5 Vitor Roriz 2022-08-29 14:56:08 PDT
Pull request: https://github.com/WebKit/WebKit/pull/3784
Comment 6 Vitor Roriz 2022-08-29 15:00:20 PDT
> This means that the angle on ConicGradient needs to be +PI/4 to match the rest of the Canvas API.

I believe this is a typo and it should be 90 deg (+pi/2), right?
Comment 7 Fernando Serboncini 2022-08-29 15:02:24 PDT
yes, yes, sorry for that. You are correct, pi/2.
Comment 8 Vitor Roriz 2022-08-29 15:19:51 PDT
I can't yet update our expected files for the related WPT tests (https://wpt.fyi/results/html/canvas/element/fill-and-stroke-styles?label=master&label=experimental&aligned&view=subtest&q=canvas%20conic) because they are using pixel assertion without any tolerance. A tolerance of 1 would be enough, since we diverge in some assertions in +-1 for some channels.

However, the divergence is not related to this bug so we need to create a new one investigate and update the tests, and/or create an issue in WPT for allowing tolerance.
Comment 9 Fernando Serboncini 2022-08-31 08:04:55 PDT
Hey,
I've just updated the WPT tests to include some tolerance: https://github.com/web-platform-tests/wpt/pull/35716

please let me know if this works for you.
Comment 10 Vitor Roriz 2022-09-01 05:24:28 PDT
That's great, I've imported them now and add to the PR. Thank you!
Comment 11 EWS 2022-09-01 06:34:01 PDT
Committed 254038@main (cf0a117f4760): <https://commits.webkit.org/254038@main>

Reviewed commits have been landed. Closing PR #3784 and removing active labels.