Skip to content

Commit

Permalink
Bug 1700022 - Only cache [NSColor controlBackgroundColor] once. r=mac…
Browse files Browse the repository at this point in the history
…-reviewers,bradwerth

Depends on D109255

Differential Revision: https://phabricator.services.mozilla.com/D109256
  • Loading branch information
mstange committed Mar 23, 2021
1 parent 03b56a8 commit 1960557
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
3 changes: 1 addition & 2 deletions widget/cocoa/nsLookAndFeel.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ class nsLookAndFeel final : public nsXPLookAndFeel {
nscolor mColorGrid;
nscolor mColorActiveBorder;
nscolor mColorGrayText;
nscolor mColorInactiveBorder;
nscolor mColorInactiveCaption;
nscolor mColorControlBackground;
nscolor mColorScrollbar;
nscolor mColorThreeDHighlight;
nscolor mColorDialog;
Expand Down
15 changes: 4 additions & 11 deletions widget/cocoa/nsLookAndFeel.mm
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ - (NSAppearanceName)bestMatchFromAppearancesWithNames:(NSArray<NSAppearanceName>
mColorGrid(0),
mColorActiveBorder(0),
mColorGrayText(0),
mColorInactiveBorder(0),
mColorInactiveCaption(0),
mColorControlBackground(0),
mColorScrollbar(0),
mColorThreeDHighlight(0),
mColorDialog(0),
Expand Down Expand Up @@ -297,10 +296,8 @@ static nscolor GetColorFromNSColorWithAlpha(NSColor* aColor, float alpha) {
aColor = mColorGrayText;
break;
case ColorID::Inactiveborder:
aColor = mColorInactiveBorder;
break;
case ColorID::Inactivecaption:
aColor = mColorInactiveCaption;
aColor = mColorControlBackground;
break;
case ColorID::Inactivecaptiontext:
aColor = NS_RGB(0x45, 0x45, 0x45);
Expand Down Expand Up @@ -697,7 +694,6 @@ static nscolor GetColorFromNSColorWithAlpha(NSColor* aColor, float alpha) {
ColorID::Activeborder,
ColorID::Graytext,
ColorID::Inactiveborder,
ColorID::Inactivecaption,
ColorID::Scrollbar,
ColorID::Threedhighlight,
ColorID::Fieldtext,
Expand Down Expand Up @@ -785,9 +781,7 @@ static nscolor GetColorFromNSColorWithAlpha(NSColor* aColor, float alpha) {
case ColorID::Graytext:
return mColorGrayText;
case ColorID::Inactiveborder:
return mColorInactiveBorder;
case ColorID::Inactivecaption:
return mColorInactiveCaption;
return mColorControlBackground;
case ColorID::Scrollbar:
return mColorScrollbar;
case ColorID::Threedhighlight:
Expand Down Expand Up @@ -883,8 +877,7 @@ static nscolor GetColorFromNSColorWithAlpha(NSColor* aColor, float alpha) {
mColorActiveBorder = GetColorFromNSColor([NSColor keyboardFocusIndicatorColor]);
NSColor* disabledColor = [NSColor disabledControlTextColor];
mColorGrayText = GetColorFromNSColorWithAlpha(disabledColor, [disabledColor alphaComponent]);
mColorInactiveBorder = GetColorFromNSColor([NSColor controlBackgroundColor]);
mColorInactiveCaption = GetColorFromNSColor([NSColor controlBackgroundColor]);
mColorControlBackground = GetColorFromNSColor([NSColor controlBackgroundColor]);
mColorScrollbar = GetColorFromNSColor([NSColor scrollBarColor]);
mColorThreeDHighlight = GetColorFromNSColor([NSColor highlightColor]);
mColorDialog = GetColorFromNSColor([NSColor controlHighlightColor]);
Expand Down

0 comments on commit 1960557

Please sign in to comment.