Closed Bug 1642343 Opened 4 years ago Closed 4 years ago

outline-style auto on mac draws white row of pixels.

Categories

(Core :: Widget: Cocoa, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla79
Tracking Status
firefox78 --- verified
firefox79 --- verified

People

(Reporter: djc, Assigned: emilio)

References

(Blocks 1 open bug, )

Details

(Keywords: nightly-community)

Attachments

(4 files)

Attached image Nightly 2020-06-01.png

As I understand it, Gecko is in the process of showing focus rings in more places. However, I noticed at least one example where the focus ring that recently started getting shown on crates.io (around the search input box) looks quite ugly, which makes even drawing the focus ring look like a regression compared to not doing so.

In comparison, the Safari focus ring is more subdued and follows the border-radius.

Attached image Safari.png
Flags: needinfo?(emilio)

So following border-radius is basically bug 315209. Interestingly Safari only does this for outline: auto, not for outline: 1px solid for example.

However there's another issue here. That white inner border is really ugly, and that seems like an issue in the Mac implementation of outline: auto.

Instead of duping this and filing a new bug for the snapping issue, let's just morph this into a bug for that Cocoa issue.

Another potential thing to do to mitigate this is to mace the focus model on mac match other desktop platforms. That should also be an easy change if needed, but that probably needs its own pref.

Component: CSS Parsing and Computation → Widget: Cocoa
Summary: Focus ring should match border-radius → outline-style auto on mac draws white row of pixels.

These diff hunks probably fix the issue: https://gist.github.com/mstange/9e7b750b175d2703d14dc39500318dac#file-2-make_ns_theme_focus__for_outline_style_auto__look_good_on_macos_-diff-L77-L284

(The "BezierPathWithRoundedRect" function seems unnecessary because [NSBezierPath bezierPathWithRoundedRect:xRadius:yRadius] exists and is 10.5+ so it's supported everywhere we ship.)

This can be reproduced trivially on a MacBook on the test page with
layout.css.devPixelsPerPx = 1.

I wanted to fix this independently of following the outline radius.

Assignee: nobody → emilio
Status: NEW → ASSIGNED

This was my attempt to rebase Markus' patch. Not clear to me we can get
rid of the extra function because the one mentioned in the last comment
only allows specifying two lengths, not all the eight that CSS allows
you to.

I have no intention to get this one finished at least just yet, because
I ran out of time today and my cocoa-foo is not great.

Can you confirm that the build here fixes the issue for you? I had to tweak DPI settings to repro so I'd rather get your confirmation just in case.

It should appear in about an hour or so from now (probably earlier). There should be a target.dmg in the "Job details" page of the "B" job, but let me know if you don't find it (whenever it's up) and I can try to help.

Thank you!

Flags: needinfo?(emilio) → needinfo?(dirkjan)
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7d92961ab6c4
Fix Mac themed focus outline to not show white edges. r=mstange
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79

Yeah, the white row of pixels is gone with this build. (Otherwise still looks pretty bad, though.)

Flags: needinfo?(dirkjan)

Comment on attachment 9153639 [details]
Bug 1642343 - Fix Mac themed focus outline to not show white edges. r=mstange

Beta/Release Uplift Approval Request

  • User impact if declined: White edges in some outlines on Mac. We've started to show auto-style outlines more often, and it'd be sad to do that without fixing this.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: comment 0
  • List of other uplifts needed: none
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Simple change to how we paint outlines on Mac
  • String changes made/needed: none
Attachment #9153639 - Flags: approval-mozilla-beta?
Flags: qe-verify+

(In reply to Dirkjan Ochtman (:djc) from comment #9)

Yeah, the white row of pixels is gone with this build. (Otherwise still looks pretty bad, though.)

Ok, fair enough. I'll file another one to try to land the other patch to follow the border radius. Though my familiarity with the cocoa APIs to do that is probably not that much compared to Markus' :)

Blocks: 1643007
QA Whiteboard: [qa-triaged]

Comment on attachment 9153639 [details]
Bug 1642343 - Fix Mac themed focus outline to not show white edges. r=mstange

approved for 78.0b3

Attachment #9153639 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Severity: -- → S2
Priority: -- → P1

Reproduced the initial issue using an old Nightly from 2020-06-01, verified that the issue is fixed using the latest Nightly 79.0a1 and Firefox 78.0b4 on macOS 10.15.6 beta.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: