Closed Bug 1672091 Opened 5 years ago Closed 5 years ago

Arrow panels don't have a shadow until they change size in macOS Big Sur

Categories

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

Firefox 84
Desktop
macOS
defect

Tracking

()

VERIFIED FIXED
85 Branch
Tracking Status
firefox-esr78 --- wontfix
firefox83 --- wontfix
firefox84 --- verified
firefox85 --- verified

People

(Reporter: lolrepeatlol, Assigned: mstange)

References

(Blocks 1 open bug)

Details

Attachments

(3 files, 1 obsolete file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0

Steps to reproduce:

I clicked on a pop out.

Actual results:

The shadow did not appear.

Expected results:

The shadow should have appeared on first click. Instead, it only appeared when I clicked on something inside the pop-out that changed its size.

Tested on both Nightly 84 (2020-10-19) and Beta 82 RC.

Disclaimer: This is on a Ryzen Hackintosh which does have occasional graphics issues with its patches. (I apologize if this does not happen on normal Macs.)

Specs if it helps:

  • Ryzen 7 1700
  • MSI B350 PC Mate
  • 16GB RAM
  • Gigabyte RX 5700 XT
  • OpenCore 0.6.2, macOS Big Sur Beta 10 (build 20A5395g, enrolled in Apple Public Beta Software Program), latest version of experimental AMD patches
OS: Unspecified → macOS
Hardware: Unspecified → Desktop

I'm going to move this to Widget: Cocoa since this has been untriaged for a few days and I'm 95% sure this is what the bug would belong to.

Component: Untriaged → Widget: Cocoa
Product: Firefox → Core
Severity: -- → S3
Priority: -- → P3

Able to reproduce on a MacBook Pro running macOS 11.0 Beta (20A5395g).

Status: UNCONFIRMED → NEW
Ever confirmed: true

This seems to only happen for popups that have a fade-in animation when they appear. So their first paint happens when the NSWindow's alphaValue is zero.
https://searchfox.org/mozilla-central/rev/dbced93f1c57942501c23d4633d01ce59d9087a1/widget/cocoa/nsCocoaWindow.mm#2343

Assignee: nobody → mstange.moz
Status: NEW → ASSIGNED
Attached file standalone testcase (obsolete) —
Attached file standalone testcase
Attachment #9183825 - Attachment is obsolete: true

I have filed FB8828157 for this.

NSWindow shadow computation incorrectly double-applies the window's alphaValue
AppKit
Incorrect/Unexpected Behavior

Steps to reproduce:

  1. Create an NSWindow that has a shadow and display the window.
  2. Set the window’s opacity to zero at runtime using -[NSWindow setAlphaValue:0].
  3. Set the window’s opacity to one again, using -[NSWindow setAlphaValue:1].

Expected results:
The window should retain its shadow. Invalidating the window shadow while the window has an alpha value less than 1.0 should compute the same shadow shape as when the window is fully opaque.

Actual results:
Starting with Big Sur, the window’s shadow disappears as soon as the window’s alpha value reaches zero, even if the alpha is increased again afterwards. Calling -[NSWindow invalidateShadow] updates the shadow, but does not create the desired look when called if the window’s alphaValue is different from 1.0.

Further details:
In Firefox, we use -[NSWindow setAlphaValue:] to implement custom fade-in animations for our custom panels. This change in Big Sur has broken those animations, and the windows end up with no shadows or with only half-transparent shadows.

We can add calls to invalidateShadow, but this does not achieve the desired shadow look.
The undesirable look manifests as follows:
In the past, no shadow was visible behind opaque areas of the window, regardless of window alpha. But in Big Sur, opaque areas of a window do have a shadow visible behind them if the window’s alpha value is partially-transparent, e.g. 0.5. The opaque areas no longer “knock out” the shadow. This undesired shadow creates a darkening effect and looks especially unsightly during fade animations.

I am attaching a test application to this report. It is a single file, “alpha-shadow.m”, which can be compiled and run using “clang alpha-shadow.m -framework Cocoa -o alpha-shadow && ./alpha-shadow”.

Blocks: 1648487
Summary: Pop-outs don't have a shadow until they change size in macOS Big Sur → Doorhangers don't have a shadow until they change size in macOS Big Sur

The fade-out animation is kept.

To work around the bug, the first paint of the panel window needs to be done at
full window opacity. Reducing the window opacity after the shadow has been
computed works correctly.

Summary: Doorhangers don't have a shadow until they change size in macOS Big Sur → Arrow panels don't have a shadow until they change size in macOS Big Sur
Pushed by mstange@themasta.com: https://hg.mozilla.org/integration/autoland/rev/a6726f60328a Disable the fade-in animation on macOS Big Sur, to work around a macOS bug (FB8828157) that causes the panel shadow to be missing. r=dao

There would have been two potential workarounds: Disabling the opening animation (which is what I ended up doing) or invalidating the window shadow whenever the window opacity changes. I decided against the latter for the following reasons:

  • It would have made the animation more sluggish, because shadow computation is expensive
  • The shadow would have looked wrong during the transition (too dark)
  • It would have caused the fade-out animation to look worse (also too dark)

Disabling the opening animation allows us to keep the fade-out animation as-is and doesn't add overhead. We can re-enable the animation on Big Sur when Apple ships a fix.

Depends on: 1676434

Comment on attachment 9189433 [details]
Bug 1672091 - Disable the fade-in animation on macOS Big Sur, to work around a macOS bug (FB8828157) that causes the panel shadow to be missing. r=dao

Beta/Release Uplift Approval Request

  • User impact if declined: Odd-looking arrow panels on macOS Big sur
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: see comment 0
  • List of other uplifts needed: Bug 1676434
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): small CSS fix
  • String changes made/needed:
Attachment #9189433 - Flags: approval-mozilla-beta?
Flags: qe-verify+
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 85 Branch
QA Whiteboard: [qa-triaged]

Reproduced the issue on Firefox 85.0a1 (20201123214551)
Verified the fix on 85.0a1 (20201124212234)

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-triaged]
Flags: qe-verify+

Comment on attachment 9189433 [details]
Bug 1672091 - Disable the fade-in animation on macOS Big Sur, to work around a macOS bug (FB8828157) that causes the panel shadow to be missing. r=dao

approved for 84.0b5

Attachment #9189433 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Verified fixed on Firefox 84.0b5 (20201126140702)

Regressions: 1686735
See Also: → 1880833
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: