Closed Bug 1570721 Opened 5 years ago Closed 5 years ago

Add an API to emulate dark mode from devtools.

Categories

(Core :: Layout, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(6 files)

Much like print simulation. I hacked up this today.

Just so that we can keep track of these together.

Depends on D40246

Not happy with all these void pointer stuff, but I think this is slightly nicer
to read.

Also not happy with what clang-format has done to my code ;)

I've removed the comment about zoom because it's not clear to me it is still
relevant, but I've preserved the order because, should we have similar stuff
going on, it seems slightly better, and I'm moderately sure the rest of the
callers don't really care.

I think closures coerced to function pointers are nicer (I considered putting
this on a template or using std::function, maybe, this was less code specially
given some callers of EnumerateExternalResources may or may not be hot...),
but if you want me to keep stuff out of line, or move the whole thing to
std::function<> or templates let me know.

Depends on D40248

It's the only implementation, and this will simplify future patches.

Comment on attachment 9082326 [details]
Bug 1570721 - Add a content viewer API to emulate color scheme. r=heycam

Revision D40250 was moved to bug 1404140. Setting attachment 9082326 [details] to obsolete.

Attachment #9082326 - Attachment is obsolete: true
Attachment #9082326 - Attachment description: Bug 1570721 - Add a content viewer API to emulate color scheme. r=bzbarsky → Bug 1570721 - Add a content viewer API to emulate color scheme. r=heycam
Attachment #9082326 - Attachment is obsolete: false
Pushed by emilio@crisal.io:
https://hg.mozilla.org/integration/autoland/rev/e1f2b7b5737e
Make nsDocumentViewer::CallChildren callbacks get an nsDocumentViewer rather than an nsIContentViewer. r=bzbarsky
https://hg.mozilla.org/integration/autoland/rev/e8db112e6926
Simplify emulated medium setup in nsPresContext. r=heycam
https://hg.mozilla.org/integration/autoland/rev/996c3bcf7001
Move the overrides to a separate struct in nsPresContext. r=heycam
https://hg.mozilla.org/integration/autoland/rev/a7de1904364f
Add an API to nsPresContext to override the `prefers-color-scheme` value. r=heycam
https://hg.mozilla.org/integration/autoland/rev/50177de640c7
Remove a bit of duplication in nsDocumentViewer.cpp. r=bzbarsky
https://hg.mozilla.org/integration/autoland/rev/09270340b2ca
Add a content viewer API to emulate color scheme. r=heycam
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: