Bug 223005

Summary: [BigSur arm64] 4 canvas-color-fonts tests consistently failing
Product: WebKit Reporter: Ryan Haddad <ryanhaddad>
Component: CanvasAssignee: Cameron McCormack (:heycam) <heycam>
Status: RESOLVED FIXED    
Severity: Normal CC: dino, heycam, mmaxfield, sabouhallawa, simon.fraser, webkit-bot-watchers-bugzilla, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Comment 1 Radar WebKit Bug Importer 2021-03-09 15:57:33 PST
<rdar://problem/75239330>
Comment 2 Ryan Haddad 2021-03-09 16:57:40 PST
Marked tests as failing in https://trac.webkit.org/changeset/274188/webkit
Comment 3 Cameron McCormack (:heycam) 2021-06-27 16:31:54 PDT
Created attachment 432357 [details]
Patch
Comment 4 Cameron McCormack (:heycam) 2021-06-27 18:51:20 PDT
Created attachment 432362 [details]
Patch
Comment 5 Simon Fraser (smfr) 2021-06-28 09:13:11 PDT
Comment on attachment 432362 [details]
Patch

How did they pass before?
Comment 6 Cameron McCormack (:heycam) 2021-06-28 14:50:18 PDT
(In reply to Simon Fraser (smfr) from comment #5)
> How did they pass before?

Because there are bugs stroking text with anti-aliasing turned off when accelerated canvas drawing is enabled on macOS.  There are two bugs I've noticed -- one is that on ARM anti-aliasing is unexpectedly used, which is the reason these tests were marked as failing on ARM originally.  The other is that on Intel, requests to stroke at 1px end up being stroked at 2px.  I'll file some bugs here to track.

(These tests don't run on platforms that don't support color fonts.)
Comment 7 Cameron McCormack (:heycam) 2021-06-28 15:28:00 PDT
(In reply to Cameron McCormack (:heycam) from comment #6)
> Because there are bugs stroking text with anti-aliasing turned off when
> accelerated canvas drawing is enabled on macOS.  There are two bugs I've
> noticed -- one is that on ARM anti-aliasing is unexpectedly used, which is
> the reason these tests were marked as failing on ARM originally.

Filed bug 227465 for that.

> The other is that on Intel, requests to stroke at 1px end up being stroked
> at 2px.

This I'm not sure whether it's a bug.  I think we end up with a 2px thick stroke because the 1px stroke straddles pixel boundaries, and the non-anti-aliased stroke covers both pixels.  Maybe that's the correct thing to do.  Though it is a difference from the non-accelerated canvas rendering behavior.
Comment 8 Cameron McCormack (:heycam) 2021-06-28 15:35:41 PDT
(In reply to Cameron McCormack (:heycam) from comment #7)
> This I'm not sure whether it's a bug.  I think we end up with a 2px thick
> stroke because the 1px stroke straddles pixel boundaries, and the
> non-anti-aliased stroke covers both pixels.

And by "think" I mean I tried changing the test to render the text at a 0.5px offset and the result was a 1px thick stroke.
Comment 9 EWS 2021-06-28 18:10:42 PDT
Committed r279356 (239224@main): <https://commits.webkit.org/239224@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 432362 [details].