From 691e7d64a1a4525d97df5a1fd93da200bdd6f2c7 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Tue, 5 Nov 2019 18:47:17 +0000 Subject: [PATCH] Bug 1593339 - Remove now-unused vibrancy fill color methods. r=spohl Differential Revision: https://phabricator.services.mozilla.com/D51457 --HG-- extra : moz-landing-system : lando --- widget/cocoa/VibrancyManager.h | 8 -------- widget/cocoa/VibrancyManager.mm | 26 -------------------------- widget/cocoa/nsChildView.h | 6 ------ widget/cocoa/nsChildView.mm | 17 ----------------- 4 files changed, 57 deletions(-) diff --git a/widget/cocoa/VibrancyManager.h b/widget/cocoa/VibrancyManager.h index 19868e2d108d..08b9f7911332 100644 --- a/widget/cocoa/VibrancyManager.h +++ b/widget/cocoa/VibrancyManager.h @@ -75,14 +75,6 @@ class VibrancyManager { LayoutDeviceIntRegion GetUnionOfVibrantRegions() const; - /** - * Return the fill color that should be drawn on top of the cleared window - * parts. Usually this would be drawn by -[NSVisualEffectView drawRect:]. - * The returned color is opaque if the system-wide "Reduce transparency" - * preference is set. - */ - NSColor* VibrancyFillColorForType(VibrancyType aType); - /** * Check whether the operating system supports vibrancy at all. * You may only create a VibrancyManager instance if this returns true. diff --git a/widget/cocoa/VibrancyManager.mm b/widget/cocoa/VibrancyManager.mm index 9a6fbaae3aaf..7ebcf9492bf7 100644 --- a/widget/cocoa/VibrancyManager.mm +++ b/widget/cocoa/VibrancyManager.mm @@ -31,32 +31,6 @@ LayoutDeviceIntRegion VibrancyManager::GetUnionOfVibrantRegions() const { return result; } -@interface NSView (CurrentFillColor) -- (NSColor*)_currentFillColor; -@end - -static NSColor* AdjustedColor(NSColor* aFillColor, VibrancyType aType) { - if (aType == VibrancyType::MENU && [aFillColor alphaComponent] == 1.0) { - // The opaque fill color that's used for the menu background when "Reduce - // vibrancy" is checked in the system accessibility prefs is too dark. - // This is probably because we're not using the right material for menus, - // see VibrancyManager::CreateEffectView. - return [NSColor colorWithDeviceWhite:0.96 alpha:1.0]; - } - return aFillColor; -} - -NSColor* VibrancyManager::VibrancyFillColorForType(VibrancyType aType) { - NSView* view = mVibrantRegions.LookupOrAdd(uint32_t(aType))->GetAnyView(); - - if (view && [view respondsToSelector:@selector(_currentFillColor)]) { - // -[NSVisualEffectView _currentFillColor] is the color that the view - // draws in its drawRect implementation. - return AdjustedColor([view _currentFillColor], aType); - } - return [NSColor whiteColor]; -} - static NSView* HitTestNil(id self, SEL _cmd, NSPoint aPoint) { // This view must be transparent to mouse events. return nil; diff --git a/widget/cocoa/nsChildView.h b/widget/cocoa/nsChildView.h index b029f1287c7a..1a8c7644ce43 100644 --- a/widget/cocoa/nsChildView.h +++ b/widget/cocoa/nsChildView.h @@ -280,8 +280,6 @@ class WidgetRenderingContext; - (void)viewWillStartLiveResize; - (void)viewDidEndLiveResize; -- (NSColor*)vibrancyFillColorForThemeGeometryType:(nsITheme::ThemeGeometryType)aThemeGeometryType; - /* * Gestures support * @@ -526,10 +524,6 @@ class nsChildView final : public nsBaseWidget { mozilla::widget::TextInputHandler* GetTextInputHandler() { return mTextInputHandler; } - NSColor* VibrancyFillColorForThemeGeometryType(nsITheme::ThemeGeometryType aThemeGeometryType); - NSColor* VibrancyFontSmoothingBackgroundColorForThemeGeometryType( - nsITheme::ThemeGeometryType aThemeGeometryType); - // unit conversion convenience functions int32_t CocoaPointsToDevPixels(CGFloat aPts) const { return nsCocoaUtils::CocoaPointsToDevPixels(aPts, BackingScaleFactor()); diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 1dfd8eaef0f6..f1383272a828 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -2468,16 +2468,6 @@ void nsChildView::UpdateVibrancy(const nsTArray& aThemeGeometries } } -NSColor* nsChildView::VibrancyFillColorForThemeGeometryType( - nsITheme::ThemeGeometryType aThemeGeometryType) { - if (VibrancyManager::SystemSupportsVibrancy()) { - Maybe vibrancyType = ThemeGeometryTypeToVibrancyType(aThemeGeometryType); - MOZ_RELEASE_ASSERT(vibrancyType, "should only encounter vibrant theme geometry types here"); - return EnsureVibrancyManager().VibrancyFillColorForType(*vibrancyType); - } - return [NSColor whiteColor]; -} - mozilla::VibrancyManager& nsChildView::EnsureVibrancyManager() { MOZ_ASSERT(mView, "Only call this once we have a view!"); if (!mVibrancyManager) { @@ -3445,13 +3435,6 @@ NSEvent* gLastDragMouseDownEvent = nil; // [strong] } } -- (NSColor*)vibrancyFillColorForThemeGeometryType:(nsITheme::ThemeGeometryType)aThemeGeometryType { - if (!mGeckoChild) { - return [NSColor whiteColor]; - } - return mGeckoChild->VibrancyFillColorForThemeGeometryType(aThemeGeometryType); -} - - (LayoutDeviceIntRegion)nativeDirtyRegionWithBoundingRect:(NSRect)aRect { MOZ_RELEASE_ASSERT(!StaticPrefs::gfx_core_animation_enabled_AtStartup());