Bug 1084598 - [OS X 10.10 and later] fix focus styling for url bar and search box, r=mstange,gijs

MozReview-Commit-ID: 3aEs95lcpZb

--HG--
extra : amend_source : 4f08292a48e1f47a8fa0e1a54d00d97c0a4e18e5
This commit is contained in:
Brandon Cheng 2016-06-14 19:24:00 +01:00
parent fbd4e8ea76
commit ff19bfa581
3 changed files with 18 additions and 1 deletions

View File

@ -1510,6 +1510,13 @@ toolbar .toolbarbutton-1 > .toolbarbutton-menubutton-button {
box-shadow: @focusRingShadow@;
}
@media (-moz-mac-yosemite-theme) {
#urlbar[focused="true"],
.searchbar-textbox[focused="true"] {
box-shadow: @yosemiteFocusRingShadow@;
}
}
#urlbar-container {
-moz-box-align: center;
}

View File

@ -2,6 +2,7 @@
%define loweredShadow 0 1px rgba(255, 255, 255, .4)
%define focusRingShadow 0 0 1px -moz-mac-focusring inset, 0 0 4px 1px -moz-mac-focusring, 0 0 1.5px 1px -moz-mac-focusring
%define yosemiteFocusRingShadow 0 0 0 0.5px -moz-mac-focusring inset, 0 0 0 2px -moz-mac-focusring;
%define roundButtonBorder 1px solid rgba(0,0,0,.35)
%define roundButtonBackground linear-gradient(#f6f6f6, #e9e9e9)

View File

@ -51,6 +51,15 @@ static nscolor GetColorFromNSColor(NSColor* aColor)
(unsigned int)([deviceColor blueComponent] * 255.0));
}
static nscolor GetColorFromNSColorWithAlpha(NSColor* aColor, float alpha)
{
NSColor* deviceColor = [aColor colorUsingColorSpaceName:NSDeviceRGBColorSpace];
return NS_RGBA((unsigned int)([deviceColor redComponent] * 255.0),
(unsigned int)([deviceColor greenComponent] * 255.0),
(unsigned int)([deviceColor blueComponent] * 255.0),
(unsigned int)(alpha * 255.0));
}
nsresult
nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
{
@ -253,7 +262,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
}
break;
case eColorID__moz_mac_focusring:
aColor = GetColorFromNSColor([NSColor keyboardFocusIndicatorColor]);
aColor = GetColorFromNSColorWithAlpha([NSColor keyboardFocusIndicatorColor], 0.48);
break;
case eColorID__moz_mac_menushadow:
aColor = NS_RGB(0xA3,0xA3,0xA3);