Closed Bug 1702602 Opened 3 years ago Closed 3 years ago

Clarify handling of dynamic changes to accessibilityDisplayShouldReduceMotion and accessibilityDisplayShouldIncreaseContrast

Categories

(Core :: Widget: Cocoa, task)

All
macOS
task

Tracking

()

RESOLVED FIXED
89 Branch
Tracking Status
firefox89 --- fixed

People

(Reporter: mstange, Assigned: emilio)

Details

Attachments

(1 file)

nsLookAndFeel.mm currently contains the following comment:

      // Without native event loops,
      // NSWorkspace.accessibilityDisplayShouldReduceMotion returns stale
      // information, so we get the information only on the parent processes
      // or when it's the initial query on child processes.  Otherwise we will
      // get the info via LookAndFeel::SetIntCache on child processes.

(And the same comment for accessibilityDisplayShouldIncreaseContrast.)

Bug 1701830 recently removed LookAndFeel::SetIntCache, so these comments need to be adjusted.

The situation is now as follows:

  • The code that contains these comments is now only run in the parent process. Content processes go through RemoteLookAndFeel::NativeGetInt instead, which will return a value that was observed in the parent process and forwarded to the content process.
  • If something calls ThemeChanged in the parent process, nsPresContext::ThemeChangedInternal() will call LookAndFeel::Refresh() in the parent process and then broadcast the updated metrics to the content processes.

So, as long as something calls ThemeChanged if these accessibility values update, dynamic changes should work perfectly. Are we not sure that this is the case? If that's the reason for the caching, maybe the comments should be rephrased as:

// We're not sure whether we're reliably triggering nsLookAndFeel re-initialization when this value changes dynamically.
// So we cache this value to avoid changing this value unexpectedly, which would cause
// it to be come inconsistent between parent process and content processes.

There was another reason for caching this, which is that before bug 1699088 NativeGetInt would get cached over and over. But all this can be simplified now.

Assignee: nobody → emilio

This code is parent-process only now, and gets cached properly by
bug 1699088.

Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ab79266c54e8
Remove unneeded caching in cocoa look and feel. r=mstange
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: