Bug 1673055 - Remove always-true backgroundIsVibrant field. r=haik
authorMarkus Stange <mstange.moz@gmail.com>
Mon, 26 Oct 2020 23:17:19 +0000
changeset 554698 8d7ff75d700a8e3d81afe4a68c66fbcd4be9171a
parent 554697 16f70160113595805b0adac104d8f566b326cdbf
child 554699 fc9d24f6ffbdfdeb213e97e9fa3d276b21dbf687
push id37898
push userabutkovits@mozilla.com
push dateWed, 28 Oct 2020 09:24:21 +0000
treeherdermozilla-central@83bf4fd3b1fb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershaik
bugs1673055
milestone84.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1673055 - Remove always-true backgroundIsVibrant field. r=haik Differential Revision: https://phabricator.services.mozilla.com/D94631
widget/cocoa/nsNativeThemeCocoa.h
widget/cocoa/nsNativeThemeCocoa.mm
--- a/widget/cocoa/nsNativeThemeCocoa.h
+++ b/widget/cocoa/nsNativeThemeCocoa.h
@@ -100,17 +100,16 @@ class nsNativeThemeCocoa : private nsNat
     MenuIcon icon = MenuIcon::eCheckmark;
     bool disabled = false;
     bool insideActiveMenuItem = false;
     bool centerHorizontally = false;
     bool rtl = false;
   };
 
   struct MenuItemParams {
-    bool backgroundIsVibrant = false;
     bool checked = false;
     bool disabled = false;
     bool selected = false;
     bool rtl = false;
   };
 
   struct CheckboxOrRadioParams {
     ControlParams controlParams;
--- a/widget/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/cocoa/nsNativeThemeCocoa.mm
@@ -1151,48 +1151,30 @@ void nsNativeThemeCocoa::DrawMenuIcon(CG
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 nsNativeThemeCocoa::MenuItemParams nsNativeThemeCocoa::ComputeMenuItemParams(
     nsIFrame* aFrame, EventStates aEventState, bool aIsChecked) {
   bool isDisabled = IsDisabled(aFrame, aEventState);
 
   MenuItemParams params;
-  params.backgroundIsVibrant = true;
   params.checked = aIsChecked;
   params.disabled = isDisabled;
   params.selected = !isDisabled && CheckBooleanAttr(aFrame, nsGkAtoms::menuactive);
   params.rtl = IsFrameRTL(aFrame);
   return params;
 }
 
 static void SetCGContextFillColor(CGContextRef cgContext, const sRGBColor& aColor) {
   DeviceColor color = ToDeviceColor(aColor);
   CGContextSetRGBFillColor(cgContext, color.r, color.g, color.b, color.a);
 }
 
 void nsNativeThemeCocoa::DrawMenuItem(CGContextRef cgContext, const CGRect& inBoxRect,
                                       const MenuItemParams& aParams) {
-  // If the background is contributed by vibrancy (which is part of the window background), we don't
-  // need to draw any background here.
-  if (!aParams.backgroundIsVibrant) {
-    HIThemeMenuItemDrawInfo drawInfo;
-    memset(&drawInfo, 0, sizeof(drawInfo));
-    drawInfo.version = 0;
-    drawInfo.itemType = kThemeMenuItemPlain;
-    drawInfo.state =
-        (aParams.disabled ? static_cast<ThemeMenuState>(kThemeMenuDisabled)
-                          : aParams.selected ? static_cast<ThemeMenuState>(kThemeMenuSelected)
-                                             : static_cast<ThemeMenuState>(kThemeMenuActive));
-
-    HIRect ignored;
-    HIThemeDrawMenuItem(&inBoxRect, &inBoxRect, &drawInfo, cgContext, HITHEME_ORIENTATION,
-                        &ignored);
-  }
-
   if (aParams.checked) {
     MenuIconParams params;
     params.disabled = aParams.disabled;
     params.insideActiveMenuItem = aParams.selected;
     params.rtl = aParams.rtl;
     params.icon = MenuIcon::eCheckmark;
     DrawMenuIcon(cgContext, inBoxRect, params);
   }