forked from mirrors/gecko-dev
Bug 1794626: Create invert_colors telemetry probe and maintain its value via LookAndFeel r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D159292
This commit is contained in:
parent
708cb4f5f5
commit
fd4344de10
3 changed files with 40 additions and 0 deletions
|
|
@ -83,6 +83,24 @@ a11y:
|
|||
release_channel_collection: opt-out
|
||||
keyed: false
|
||||
|
||||
invert_colors:
|
||||
bug_numbers:
|
||||
- 1794626
|
||||
description: >
|
||||
Boolean tracking if the user has an invert colors OS
|
||||
setting enabled.
|
||||
expires: never
|
||||
kind: boolean
|
||||
notification_emails:
|
||||
- accessibility@mozilla.com
|
||||
- mreschenberg@mozilla.com
|
||||
products:
|
||||
- 'firefox'
|
||||
record_in_processes:
|
||||
- 'main'
|
||||
release_channel_collection: opt-out
|
||||
keyed: false
|
||||
|
||||
theme:
|
||||
bug_numbers:
|
||||
- 1022528
|
||||
|
|
|
|||
|
|
@ -24,6 +24,15 @@ class nsLookAndFeel final : public nsXPLookAndFeel {
|
|||
return 0x2022;
|
||||
}
|
||||
|
||||
void RecordLookAndFeelSpecificTelemetry() override {
|
||||
RecordAccessibilityTelemetry();
|
||||
}
|
||||
|
||||
// Having a separate, static method allows us to rely on the same
|
||||
// chunk of telemetry logging code at initialization and when we
|
||||
// recieve an event that changes the value of our telemetry probe.
|
||||
static void RecordAccessibilityTelemetry();
|
||||
|
||||
protected:
|
||||
static bool SystemWantsDarkTheme();
|
||||
static bool IsSystemOrientationRTL();
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include "mozilla/FontPropertyTypes.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/StaticPrefs_widget.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/widget/WidgetMessageUtils.h"
|
||||
#include "SDKDeclarations.h"
|
||||
|
||||
|
|
@ -576,6 +577,14 @@ bool nsLookAndFeel::NativeGetFont(FontID aID, nsString& aFontName, gfxFontStyle&
|
|||
NS_OBJC_END_TRY_BLOCK_RETURN(false);
|
||||
}
|
||||
|
||||
void nsLookAndFeel::RecordAccessibilityTelemetry() {
|
||||
if ([[NSWorkspace sharedWorkspace]
|
||||
respondsToSelector:@selector(accessibilityDisplayShouldInvertColors)]) {
|
||||
bool val = [[NSWorkspace sharedWorkspace] accessibilityDisplayShouldInvertColors];
|
||||
Telemetry::ScalarSet(Telemetry::ScalarID::A11Y_INVERT_COLORS, val);
|
||||
}
|
||||
}
|
||||
|
||||
@implementation MOZLookAndFeelDynamicChangeObserver
|
||||
|
||||
+ (void)startObserving {
|
||||
|
|
@ -663,6 +672,10 @@ bool nsLookAndFeel::NativeGetFont(FontID aID, nsString& aFontName, gfxFontStyle&
|
|||
}
|
||||
|
||||
- (void)mediaQueriesChanged {
|
||||
// Changing`Invert Colors` sends AccessibilityDisplayOptionsDidChangeNotifications.
|
||||
// We monitor that setting via telemetry, so call into that
|
||||
// recording method here.
|
||||
nsLookAndFeel::RecordAccessibilityTelemetry();
|
||||
LookAndFeel::NotifyChangedAllWindows(widget::ThemeChangeKind::MediaQueriesOnly);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue