Closed Bug 1749377 Opened 2 years ago Closed 2 years ago

Windows opened from dark PBM windows should inherit dark theme

Categories

(Firefox :: Theme, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
98 Branch
Tracking Status
firefox98 --- fixed

People

(Reporter: pbz, Assigned: pbz)

References

Details

(Whiteboard: [fxatps-privacy-segmentation])

Attachments

(3 files, 1 obsolete file)

For privacy segmentation we apply dark themes to private browsing mode windows.
Windows which have a contextual relationship to the private browsing windows should inherit their dark theme. This includes:

  • page info window
  • prompts (via nsIPromptService)

Windows which are launched from the PBM window, but are generally global, such as the library (history, bookmarks, etc), should not inherit the style.

Assignee: nobody → pbz
Status: NEW → ASSIGNED

I've done some experiments with the BrowsingContext flag prefersColorSchemeOverride. While not originally implemented for the purpose of this bug, it can be used to override the color scheme per browsing context and therefore per window.

In pageInfo.js I can check whether the parent window is in PBM and apply a dark color scheme.
This works well on Windows. On Linux it only works partially: a small portion of widgets remain dark, resulting in low contrast. On macOS it doesn't work properly: The window background remains light, only the text color is updated, which makes the text very hard to read.

We could use a similar approach for prompts, the commonDialog.xhtml document. Again, it doesn't work properly on macOS. Also, I found that setting prefersColorSchemeOverride for embedded prompts/browsers leads to a crash:

Hit MOZ_CRASH(CanSet failed for field(s): PrefersColorSchemeOverride) at /home/pbz/moz/build/debug/dist/include/mozilla/dom/SyncedContextInlines.h:102

Which means the approach currently only works for window prompts.

Depends on D136933

Attachment #9260685 - Attachment is obsolete: true
Attachment #9260687 - Attachment description: Bug 1749377 - Tests for dark pageInfo and prompts. r=Gijs! → Bug 1749377 - Tests for dark pageInfo and prompts. r=dao!
Pushed by pzuhlcke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/83581637ae08
Use prefersColorSchemeOverride to inherit dark PBM theme for prompts and pageInfo window. r=desktop-theme-reviewers,dao
https://hg.mozilla.org/integration/autoland/rev/46cbaff8614d
Set color scheme on window widget to fix PBM dark theme issues on macOS. r=emilio
https://hg.mozilla.org/integration/autoland/rev/e3e0c8d40916
Tests for dark pageInfo and prompts. r=dao
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 98 Branch
Regressions: 1752752
Regressions: 1752815
See Also: → 1844346
Blocks: 1846500
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: