mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1633860: Place window control buttons on the right side on macOS when using an RTL system locale, regardless of the Firefox locale. r=mstange,emilio,harry
Differential Revision: https://phabricator.services.mozilla.com/D116921
This commit is contained in:
parent
a3dbfef293
commit
87f63ab1b8
@ -389,18 +389,19 @@ toolbarpaletteitem {
|
||||
}
|
||||
|
||||
%ifdef XP_MACOSX
|
||||
/**
|
||||
* On macOS, the window caption buttons are on the left side of the window titlebar,
|
||||
* even when using the RTL UI direction. These next rules enforce that ordering.
|
||||
*/
|
||||
#titlebar-secondary-buttonbox:-moz-locale-dir(ltr) {
|
||||
-moz-box-ordinal-group: 1000;
|
||||
|
||||
@media not (-moz-mac-rtl) {
|
||||
.titlebar-buttonbox-container:-moz-locale-dir(ltr) {
|
||||
-moz-box-ordinal-group: 0;
|
||||
}
|
||||
}
|
||||
|
||||
#titlebar-secondary-buttonbox:-moz-locale-dir(rtl),
|
||||
.titlebar-buttonbox-container:-moz-locale-dir(ltr) {
|
||||
-moz-box-ordinal-group: 0;
|
||||
@media (-moz-mac-rtl) {
|
||||
.titlebar-buttonbox-container:-moz-locale-dir(rtl) {
|
||||
-moz-box-ordinal-group: 0;
|
||||
}
|
||||
}
|
||||
|
||||
%endif
|
||||
|
||||
:root[inDOMFullscreen] #navigator-toolbox,
|
||||
|
@ -85,23 +85,12 @@
|
||||
|
||||
<hbox class="titlebar-spacer" type="post-tabs"/>
|
||||
|
||||
#ifndef XP_MACOSX
|
||||
<button class="accessibility-indicator" data-l10n-id="navbar-accessibility-indicator"
|
||||
aria-live="polite"/>
|
||||
<hbox class="private-browsing-indicator"/>
|
||||
#endif
|
||||
|
||||
#include titlebar-items.inc.xhtml
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
<!-- OS X does not natively support RTL for its titlebar items, so we prevent this secondary
|
||||
buttonbox from reversing order in RTL by forcing an LTR direction. -->
|
||||
<hbox id="titlebar-secondary-buttonbox" dir="ltr">
|
||||
<button class="accessibility-indicator" data-l10n-id="navbar-accessibility-indicator" aria-live="polite"/>
|
||||
<hbox class="private-browsing-indicator"/>
|
||||
<hbox id="titlebar-fullscreen-button"/>
|
||||
</hbox>
|
||||
#endif
|
||||
</toolbar>
|
||||
|
||||
</vbox>
|
||||
|
@ -73,23 +73,30 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Making the toolbox position:relative (browser.inc.css) occludes titlebar indicators
|
||||
* if the toolbox has a background. Fix this by positioning the relevant elements, too: */
|
||||
#titlebar-secondary-buttonbox {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
/* Centrally align indicators and full screen button vertically */
|
||||
-moz-box-align: center;
|
||||
}
|
||||
|
||||
.titlebar-buttonbox-container {
|
||||
-moz-box-align: center;
|
||||
}
|
||||
|
||||
/* These would be margin-inline-start/end if it wasn't for the fact that OS X
|
||||
* doesn't reverse the order of the items in the titlebar in RTL mode. */
|
||||
.titlebar-buttonbox {
|
||||
.titlebar-buttonbox:-moz-locale-dir(ltr) {
|
||||
margin-left: 12px;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.titlebar-buttonbox:-moz-locale-dir(rtl) {
|
||||
margin-left: 12px;
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
@media (-moz-mac-rtl) {
|
||||
.titlebar-buttonbox:-moz-locale-dir(ltr) {
|
||||
margin-left: 12px;
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
.titlebar-buttonbox:-moz-locale-dir(rtl) {
|
||||
margin-left: 0;
|
||||
margin-right: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
/** End titlebar **/
|
||||
|
@ -680,7 +680,7 @@ macro_rules! bool_pref_feature {
|
||||
/// to support new types in these entries and (2) ensuring that either
|
||||
/// nsPresContext::MediaFeatureValuesChanged is called when the value that
|
||||
/// would be returned by the evaluator function could change.
|
||||
pub static MEDIA_FEATURES: [MediaFeatureDescription; 60] = [
|
||||
pub static MEDIA_FEATURES: [MediaFeatureDescription; 61] = [
|
||||
feature!(
|
||||
atom!("width"),
|
||||
AllowsRanges::Yes,
|
||||
@ -913,6 +913,7 @@ pub static MEDIA_FEATURES: [MediaFeatureDescription; 60] = [
|
||||
lnf_int_feature!(atom!("-moz-windows-default-theme"), WindowsDefaultTheme),
|
||||
lnf_int_feature!(atom!("-moz-mac-graphite-theme"), MacGraphiteTheme),
|
||||
lnf_int_feature!(atom!("-moz-mac-big-sur-theme"), MacBigSurTheme),
|
||||
lnf_int_feature!(atom!("-moz-mac-rtl"), MacRTL),
|
||||
lnf_int_feature!(atom!("-moz-windows-accent-color-in-titlebar"), WindowsAccentColorInTitlebar),
|
||||
lnf_int_feature!(atom!("-moz-windows-compositor"), DWMCompositor),
|
||||
lnf_int_feature!(atom!("-moz-windows-classic"), WindowsClassic),
|
||||
|
@ -145,22 +145,20 @@ class LookAndFeel {
|
||||
/*
|
||||
* A Boolean value to determine whether the Mac graphite theme is
|
||||
* being used.
|
||||
*
|
||||
* The value of this metric is not used on other platforms. These platforms
|
||||
* should return NS_ERROR_NOT_IMPLEMENTED when queried for this metric.
|
||||
*/
|
||||
MacGraphiteTheme,
|
||||
|
||||
/*
|
||||
* A Boolean value to determine whether the macOS Big Sur-specific
|
||||
* theming should be used.
|
||||
*
|
||||
* The value of this metric is not used on non-Mac platforms. These
|
||||
* platforms should return NS_ERROR_NOT_IMPLEMENTED when queried for this
|
||||
* metric.
|
||||
*/
|
||||
MacBigSurTheme,
|
||||
|
||||
/*
|
||||
* A Boolean value to determine whether macOS is in RTL mode or not.
|
||||
*/
|
||||
MacRTL,
|
||||
|
||||
/*
|
||||
* AlertNotificationOrigin indicates from which corner of the
|
||||
* screen alerts slide in, and from which direction (horizontal/vertical).
|
||||
|
@ -26,6 +26,7 @@ class nsLookAndFeel final : public nsXPLookAndFeel {
|
||||
|
||||
protected:
|
||||
static bool SystemWantsDarkTheme();
|
||||
static bool IsSystemOrientationRTL();
|
||||
static nscolor ProcessSelectionBackground(nscolor aColor,
|
||||
ColorScheme aScheme);
|
||||
};
|
||||
|
@ -488,6 +488,9 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
|
||||
case IntID::MacBigSurTheme:
|
||||
aResult = nsCocoaFeatures::OnBigSurOrLater();
|
||||
break;
|
||||
case IntID::MacRTL:
|
||||
aResult = IsSystemOrientationRTL();
|
||||
break;
|
||||
case IntID::AlertNotificationOrigin:
|
||||
aResult = NS_ALERT_TOP;
|
||||
break;
|
||||
@ -570,6 +573,17 @@ bool nsLookAndFeel::SystemWantsDarkTheme() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*static*/
|
||||
bool nsLookAndFeel::IsSystemOrientationRTL() {
|
||||
NSWindow* window = [[NSWindow alloc] initWithContentRect:NSZeroRect
|
||||
styleMask:NSWindowStyleMaskBorderless
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:NO];
|
||||
auto direction = window.windowTitlebarLayoutDirection;
|
||||
[window release];
|
||||
return direction == NSUserInterfaceLayoutDirectionRightToLeft;
|
||||
}
|
||||
|
||||
bool nsLookAndFeel::NativeGetFont(FontID aID, nsString& aFontName, gfxFontStyle& aFontStyle) {
|
||||
NS_OBJC_BEGIN_TRY_BLOCK_RETURN;
|
||||
|
||||
|
@ -766,10 +766,6 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
|
||||
aResult = 0;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
case IntID::MacGraphiteTheme:
|
||||
aResult = 0;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
case IntID::AlertNotificationOrigin:
|
||||
aResult = NS_ALERT_TOP;
|
||||
break;
|
||||
|
@ -206,11 +206,6 @@ nsresult HeadlessLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
|
||||
aResult = 0;
|
||||
res = NS_ERROR_FAILURE;
|
||||
break;
|
||||
case IntID::MacGraphiteTheme:
|
||||
case IntID::MacBigSurTheme:
|
||||
aResult = 0;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
case IntID::AlertNotificationOrigin:
|
||||
aResult = NS_ALERT_TOP;
|
||||
break;
|
||||
|
@ -141,6 +141,7 @@ static const char sIntPrefs[][43] = {
|
||||
"ui.windowsGlass",
|
||||
"ui.macGraphiteTheme",
|
||||
"ui.macBigSurTheme",
|
||||
"ui.macRTL",
|
||||
"ui.alertNotificationOrigin",
|
||||
"ui.scrollToClick",
|
||||
"ui.IMERawInputUnderlineStyle",
|
||||
|
@ -453,11 +453,6 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
|
||||
aResult = int32_t(GetOperatingSystemVersion());
|
||||
break;
|
||||
}
|
||||
|
||||
case IntID::MacGraphiteTheme:
|
||||
aResult = 0;
|
||||
res = NS_ERROR_NOT_IMPLEMENTED;
|
||||
break;
|
||||
case IntID::DWMCompositor:
|
||||
aResult = gfxWindowsPlatform::GetPlatform()->DwmCompositionEnabled();
|
||||
break;
|
||||
|
@ -2212,6 +2212,7 @@ STATIC_ATOMS = [
|
||||
Atom("_moz_windows_default_theme", "-moz-windows-default-theme"),
|
||||
Atom("_moz_mac_graphite_theme", "-moz-mac-graphite-theme"),
|
||||
Atom("_moz_mac_big_sur_theme", "-moz-mac-big-sur-theme"),
|
||||
Atom("_moz_mac_rtl", "-moz-mac-rtl"),
|
||||
Atom("_moz_windows_compositor", "-moz-windows-compositor"),
|
||||
Atom("_moz_windows_classic", "-moz-windows-classic"),
|
||||
Atom("_moz_windows_glass", "-moz-windows-glass"),
|
||||
|
Loading…
Reference in New Issue
Block a user