summaryrefslogtreecommitdiffstats
path: root/widget/cocoa
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--widget/cocoa/AppearanceOverride.h19
-rw-r--r--widget/cocoa/AppearanceOverride.mm90
-rw-r--r--widget/cocoa/VibrancyManager.h46
-rw-r--r--widget/cocoa/VibrancyManager.mm74
-rw-r--r--widget/cocoa/ViewRegion.h1
-rw-r--r--widget/cocoa/moz.build1
-rw-r--r--widget/cocoa/nsChildView.mm44
-rw-r--r--widget/cocoa/nsClipboard.mm13
-rw-r--r--widget/cocoa/nsCocoaWindow.mm80
-rw-r--r--widget/cocoa/nsLookAndFeel.mm27
-rw-r--r--widget/cocoa/nsNativeThemeCocoa.h90
-rw-r--r--widget/cocoa/nsNativeThemeCocoa.mm178
12 files changed, 168 insertions, 495 deletions
diff --git a/widget/cocoa/AppearanceOverride.h b/widget/cocoa/AppearanceOverride.h
deleted file mode 100644
index c4ae629320..0000000000
--- a/widget/cocoa/AppearanceOverride.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef AppearanceOverride_h
-#define AppearanceOverride_h
-
-#import <Cocoa/Cocoa.h>
-
-// Implements support for the browser.theme.toolbar-theme pref.
-// Use MOZGlobalAppearance.sharedInstance.effectiveAppearance
-// in all places where you would like the global override to be respected. The
-// effectiveAppearance property can be key-value observed.
-@interface MOZGlobalAppearance : NSObject <NSAppearanceCustomization>
-@property(class, readonly) MOZGlobalAppearance* sharedInstance;
-@end
-
-#endif
diff --git a/widget/cocoa/AppearanceOverride.mm b/widget/cocoa/AppearanceOverride.mm
deleted file mode 100644
index c3938d6b93..0000000000
--- a/widget/cocoa/AppearanceOverride.mm
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#import <Cocoa/Cocoa.h>
-
-#include "AppearanceOverride.h"
-
-#include "mozilla/Preferences.h"
-#include "mozilla/StaticPrefs_browser.h"
-#include "mozilla/StaticPrefs_widget.h"
-
-#include "nsXULAppAPI.h"
-
-static void ToolbarThemePrefChanged(const char* aPref, void* aUserInfo);
-
-@interface MOZGlobalAppearance ()
-@property NSInteger toolbarTheme;
-@end
-
-@implementation MOZGlobalAppearance
-
-+ (MOZGlobalAppearance*)sharedInstance {
- static MOZGlobalAppearance* sInstance = nil;
- if (!sInstance) {
- sInstance = [[MOZGlobalAppearance alloc] init];
- if (XRE_IsParentProcess()) {
- mozilla::Preferences::RegisterCallbackAndCall(
- &ToolbarThemePrefChanged,
- nsDependentCString(
- mozilla::StaticPrefs::GetPrefName_browser_theme_toolbar_theme()));
- }
- }
- return sInstance;
-}
-
-+ (NSSet*)keyPathsForValuesAffectingAppearance {
- return [NSSet setWithObjects:@"toolbarTheme", nil];
-}
-
-- (NSAppearance*)appearance {
- switch (self.toolbarTheme) { // Value for browser.theme.toolbar-theme pref
- case 0: // Dark
- return [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
- case 1: // Light
- return [NSAppearance appearanceNamed:NSAppearanceNameAqua];
- case 2: // System
- default:
- return nil; // nil means "no override".
- }
-}
-
-- (void)setAppearance:(NSAppearance*)aAppearance {
- // ignored
-}
-
-- (NSApplication*)_app {
- return NSApp;
-}
-
-+ (NSSet*)keyPathsForValuesAffectingEffectiveAppearance {
- // Automatically notify any key-value observers of our effectiveAppearance
- // property whenever the pref or the NSApp's effectiveAppearance change.
- return
- [NSSet setWithObjects:@"toolbarTheme", @"_app.effectiveAppearance", nil];
-}
-
-- (NSAppearance*)effectiveAppearance {
- switch (self.toolbarTheme) { // Value for browser.theme.toolbar-theme pref
- case 0: // Dark
- return [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
- case 1: // Light
- return [NSAppearance appearanceNamed:NSAppearanceNameAqua];
- case 2: // System
- default:
- // Use the NSApp effectiveAppearance. This is the system appearance.
- return NSApp.effectiveAppearance;
- }
-}
-
-@end
-
-static void ToolbarThemePrefChanged(const char* aPref, void* aUserInfo) {
- MOZ_RELEASE_ASSERT(XRE_IsParentProcess());
- MOZ_RELEASE_ASSERT(NS_IsMainThread());
-
- MOZGlobalAppearance.sharedInstance.toolbarTheme =
- mozilla::StaticPrefs::browser_theme_toolbar_theme();
-}
diff --git a/widget/cocoa/VibrancyManager.h b/widget/cocoa/VibrancyManager.h
index c70ec60a3b..43adace794 100644
--- a/widget/cocoa/VibrancyManager.h
+++ b/widget/cocoa/VibrancyManager.h
@@ -7,24 +7,24 @@
#ifndef VibrancyManager_h
#define VibrancyManager_h
-#include "mozilla/Assertions.h"
-#include "nsClassHashtable.h"
-#include "nsRegion.h"
-#include "nsTArray.h"
-#include "ViewRegion.h"
+#include "mozilla/EnumeratedArray.h"
+#include "Units.h"
-#import <Foundation/NSGeometry.h>
-
-@class NSColor;
@class NSView;
class nsChildView;
namespace mozilla {
+class ViewRegion;
+
enum class VibrancyType {
- TOOLTIP,
- MENU,
- TITLEBAR,
+ // Add new values here, or update MaxEnumValue below if you add them after.
+ Titlebar,
+};
+
+template <>
+struct MaxContiguousEnumValue<VibrancyType> {
+ static constexpr auto value = VibrancyType::Titlebar;
};
/**
@@ -51,9 +51,9 @@ class VibrancyManager {
* NSVisualEffectViews which will be created for vibrant regions.
*/
VibrancyManager(const nsChildView& aCoordinateConverter,
- NSView* aContainerView)
- : mCoordinateConverter(aCoordinateConverter),
- mContainerView(aContainerView) {}
+ NSView* aContainerView);
+
+ ~VibrancyManager();
/**
* Update the placement of the NSVisualEffectViews inside the container
@@ -66,26 +66,10 @@ class VibrancyManager {
bool UpdateVibrantRegion(VibrancyType aType,
const LayoutDeviceIntRegion& aRegion);
- bool HasVibrantRegions() { return !mVibrantRegions.IsEmpty(); }
-
- LayoutDeviceIntRegion GetUnionOfVibrantRegions() const;
-
- /**
- * Create an NSVisualEffectView for the specified vibrancy type. The return
- * value is not autoreleased. We return an object of type NSView* because we
- * compile with an SDK that does not contain a definition for
- * NSVisualEffectView.
- * @param aIsContainer Whether this NSView will have child views. This value
- * affects hit testing: Container views will pass through
- * hit testing requests to their children, and leaf views
- * will be transparent to hit testing.
- */
- static NSView* CreateEffectView(VibrancyType aType, BOOL aIsContainer = NO);
-
protected:
const nsChildView& mCoordinateConverter;
NSView* mContainerView;
- nsClassHashtable<nsUint32HashKey, ViewRegion> mVibrantRegions;
+ EnumeratedArray<VibrancyType, UniquePtr<ViewRegion>> mVibrantRegions;
};
} // namespace mozilla
diff --git a/widget/cocoa/VibrancyManager.mm b/widget/cocoa/VibrancyManager.mm
index 6062acb931..a2bef29a19 100644
--- a/widget/cocoa/VibrancyManager.mm
+++ b/widget/cocoa/VibrancyManager.mm
@@ -5,6 +5,9 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "VibrancyManager.h"
+#include "ViewRegion.h"
+#include "nsRegion.h"
+#include "ViewRegion.h"
#import <objc/message.h>
@@ -20,18 +23,10 @@ using namespace mozilla;
vibrancyType:(VibrancyType)aVibrancyType;
@end
-@interface MOZVibrantLeafView : MOZVibrantView
-@end
-
static NSVisualEffectState VisualEffectStateForVibrancyType(
VibrancyType aType) {
switch (aType) {
- case VibrancyType::TOOLTIP:
- case VibrancyType::MENU:
- // Tooltip and menu windows are never "key", so we need to tell the
- // vibrancy effect to look active regardless of window state.
- return NSVisualEffectStateActive;
- case VibrancyType::TITLEBAR:
+ case VibrancyType::Titlebar:
break;
}
return NSVisualEffectStateFollowsWindowActiveState;
@@ -40,11 +35,7 @@ static NSVisualEffectState VisualEffectStateForVibrancyType(
static NSVisualEffectMaterial VisualEffectMaterialForVibrancyType(
VibrancyType aType) {
switch (aType) {
- case VibrancyType::TOOLTIP:
- return (NSVisualEffectMaterial)NSVisualEffectMaterialToolTip;
- case VibrancyType::MENU:
- return NSVisualEffectMaterialMenu;
- case VibrancyType::TITLEBAR:
+ case VibrancyType::Titlebar:
return NSVisualEffectMaterialTitlebar;
}
}
@@ -52,10 +43,7 @@ static NSVisualEffectMaterial VisualEffectMaterialForVibrancyType(
static NSVisualEffectBlendingMode VisualEffectBlendingModeForVibrancyType(
VibrancyType aType) {
switch (aType) {
- case VibrancyType::TOOLTIP:
- case VibrancyType::MENU:
- return NSVisualEffectBlendingModeBehindWindow;
- case VibrancyType::TITLEBAR:
+ case VibrancyType::Titlebar:
return StaticPrefs::widget_macos_titlebar_blend_mode_behind_window()
? NSVisualEffectBlendingModeBehindWindow
: NSVisualEffectBlendingModeWithinWindow;
@@ -63,7 +51,6 @@ static NSVisualEffectBlendingMode VisualEffectBlendingModeForVibrancyType(
}
@implementation MOZVibrantView
-
- (instancetype)initWithFrame:(NSRect)aRect vibrancyType:(VibrancyType)aType {
self = [super initWithFrame:aRect];
mType = aType;
@@ -76,50 +63,31 @@ static NSVisualEffectBlendingMode VisualEffectBlendingModeForVibrancyType(
return self;
}
-// Don't override allowsVibrancy here, because this view may have subviews, and
-// returning YES from allowsVibrancy forces on foreground vibrancy for all
-// descendant views, which can have unintended effects.
-
-@end
-
-@implementation MOZVibrantLeafView
-
- (NSView*)hitTest:(NSPoint)aPoint {
// This view must be transparent to mouse events.
return nil;
}
+@end
-// MOZVibrantLeafView does not have subviews, so we can return YES here without
-// having unintended effects on other contents of the window.
-- (BOOL)allowsVibrancy {
- return NO;
-}
+VibrancyManager::VibrancyManager(const nsChildView& aCoordinateConverter,
+ NSView* aContainerView)
+ : mCoordinateConverter(aCoordinateConverter),
+ mContainerView(aContainerView) {}
-@end
+VibrancyManager::~VibrancyManager() = default;
bool VibrancyManager::UpdateVibrantRegion(
VibrancyType aType, const LayoutDeviceIntRegion& aRegion) {
+ auto& slot = mVibrantRegions[aType];
if (aRegion.IsEmpty()) {
- return mVibrantRegions.Remove(uint32_t(aType));
+ bool hadRegion = !!slot;
+ slot = nullptr;
+ return hadRegion;
}
- auto& vr = *mVibrantRegions.GetOrInsertNew(uint32_t(aType));
- return vr.UpdateRegion(aRegion, mCoordinateConverter, mContainerView, ^() {
- return CreateEffectView(aType);
- });
-}
-
-LayoutDeviceIntRegion VibrancyManager::GetUnionOfVibrantRegions() const {
- LayoutDeviceIntRegion result;
- for (const auto& region : mVibrantRegions.Values()) {
- result.OrWith(region->Region());
+ if (!slot) {
+ slot = MakeUnique<ViewRegion>();
}
- return result;
-}
-
-/* static */ NSView* VibrancyManager::CreateEffectView(VibrancyType aType,
- BOOL aIsContainer) {
- return aIsContainer ? [[MOZVibrantView alloc] initWithFrame:NSZeroRect
- vibrancyType:aType]
- : [[MOZVibrantLeafView alloc] initWithFrame:NSZeroRect
- vibrancyType:aType];
+ return slot->UpdateRegion(aRegion, mCoordinateConverter, mContainerView, ^() {
+ return [[MOZVibrantView alloc] initWithFrame:NSZeroRect vibrancyType:aType];
+ });
}
diff --git a/widget/cocoa/ViewRegion.h b/widget/cocoa/ViewRegion.h
index b2ed0c8835..d44bde5f71 100644
--- a/widget/cocoa/ViewRegion.h
+++ b/widget/cocoa/ViewRegion.h
@@ -8,6 +8,7 @@
#define ViewRegion_h
#include "Units.h"
+#include "nsRegion.h"
#include "nsTArray.h"
class nsChildView;
diff --git a/widget/cocoa/moz.build b/widget/cocoa/moz.build
index d0939d34c7..125a7f2fc0 100644
--- a/widget/cocoa/moz.build
+++ b/widget/cocoa/moz.build
@@ -23,7 +23,6 @@ EXPORTS += [
]
UNIFIED_SOURCES += [
- "AppearanceOverride.mm",
"GfxInfo.mm",
"MOZIconHelper.mm",
"MOZMenuOpeningCoordinator.mm",
diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm
index d3241a983f..b57df15825 100644
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -1726,32 +1726,52 @@ static Maybe<VibrancyType> ThemeGeometryTypeToVibrancyType(
nsITheme::ThemeGeometryType aThemeGeometryType) {
switch (aThemeGeometryType) {
case eThemeGeometryTypeTitlebar:
- return Some(VibrancyType::TITLEBAR);
+ return Some(VibrancyType::Titlebar);
default:
return Nothing();
}
}
-static LayoutDeviceIntRegion GatherVibrantRegion(
- const nsTArray<nsIWidget::ThemeGeometry>& aThemeGeometries,
- VibrancyType aVibrancyType) {
- LayoutDeviceIntRegion region;
+static EnumeratedArray<VibrancyType, LayoutDeviceIntRegion>
+GatherVibrantRegions(Span<const nsIWidget::ThemeGeometry> aThemeGeometries) {
+ EnumeratedArray<VibrancyType, LayoutDeviceIntRegion> regions;
for (const auto& geometry : aThemeGeometries) {
- if (ThemeGeometryTypeToVibrancyType(geometry.mType) ==
- Some(aVibrancyType)) {
- region.OrWith(geometry.mRect);
+ auto vibrancyType = ThemeGeometryTypeToVibrancyType(geometry.mType);
+ if (!vibrancyType) {
+ continue;
}
+ regions[*vibrancyType].OrWith(geometry.mRect);
+ }
+ return regions;
+}
+
+// Subtracts parts from regions in such a way that they don't have any overlap.
+// Each region in the argument list will have the union of all the regions
+// *following* it subtracted from itself. In other words, the arguments are
+// treated as low priority to high priority.
+static void MakeRegionsNonOverlapping(Span<LayoutDeviceIntRegion> aRegions) {
+ LayoutDeviceIntRegion unionOfAll;
+ for (auto& region : aRegions) {
+ region.SubOut(unionOfAll);
+ unionOfAll.OrWith(region);
}
- return region;
}
void nsChildView::UpdateVibrancy(
const nsTArray<ThemeGeometry>& aThemeGeometries) {
- LayoutDeviceIntRegion titlebarRegion =
- GatherVibrantRegion(aThemeGeometries, VibrancyType::TITLEBAR);
+ auto regions = GatherVibrantRegions(aThemeGeometries);
+ MakeRegionsNonOverlapping(regions);
auto& vm = EnsureVibrancyManager();
- bool changed = vm.UpdateVibrantRegion(VibrancyType::TITLEBAR, titlebarRegion);
+ bool changed = false;
+
+ // EnumeratedArray doesn't have an iterator that also yields the enum type,
+ // but we rely on VibrancyType being contiguous and starting at 0, so we can
+ // do that manually.
+ size_t i = 0;
+ for (const auto& region : regions) {
+ changed |= vm.UpdateVibrantRegion(VibrancyType(i++), region);
+ }
if (changed) {
SuspendAsyncCATransactions();
diff --git a/widget/cocoa/nsClipboard.mm b/widget/cocoa/nsClipboard.mm
index ba747e5b27..1c4788460c 100644
--- a/widget/cocoa/nsClipboard.mm
+++ b/widget/cocoa/nsClipboard.mm
@@ -499,13 +499,12 @@ nsClipboard::HasNativeClipboardDataMatchingFlavors(
// XXX we only check the first pasteboard item as we only get data from
// first item in TransferableFromPasteboard for now.
if (NSPasteboardItem* item = [items objectAtIndex:0]) {
- if (NSString *availableType = [item
- availableTypeFromArray:
- [NSArray
- arrayWithObjects:[UTIHelper
- stringFromPboardType:
- (NSString*)kUTTypeFileURL],
- nil]]) {
+ if ([item availableTypeFromArray:
+ [NSArray
+ arrayWithObjects:[UTIHelper
+ stringFromPboardType:
+ (NSString*)kUTTypeFileURL],
+ nil]]) {
MOZ_CLIPBOARD_LOG(" has %s\n", mimeType.get());
return true;
}
diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm
index 8e54d9e7fd..5032f35fa1 100644
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -6,7 +6,6 @@
#include "nsCocoaWindow.h"
-#include "AppearanceOverride.h"
#include "NativeKeyBindings.h"
#include "ScreenHelperCocoa.h"
#include "TextInputHandler.h"
@@ -158,6 +157,13 @@ void nsCocoaWindow::DestroyNativeWindow() {
// we clear our delegate.
EndOurNativeTransition();
+ // We are about to destroy mWindow. Before we do that, make sure that we
+ // hide the window using the Show() method, because it has several side
+ // effects that our parent and listeners might be expecting. If we don't
+ // do this now, then these side effects will never execute, though the
+ // window will definitely no longer be shown.
+ Show(false);
+
[mWindow releaseJSObjects];
// We want to unhook the delegate here because we don't want events
// sent to it after this object has been destroyed.
@@ -525,10 +531,6 @@ nsresult nsCocoaWindow::CreateNativeWindow(const NSRect& aRect,
[WindowDataMap.sharedWindowDataMap ensureDataForWindow:mWindow];
mWindowMadeHere = true;
- // Make the window respect the global appearance, which follows the
- // browser.theme.toolbar-theme pref.
- mWindow.appearanceSource = MOZGlobalAppearance.sharedInstance;
-
return NS_OK;
NS_OBJC_END_TRY_BLOCK_RETURN(NS_ERROR_FAILURE);
@@ -1969,7 +1971,6 @@ void nsCocoaWindow::BackingScaleFactorChanged() {
if (PresShell* presShell = mWidgetListener->GetPresShell()) {
presShell->BackingScaleFactorChanged();
}
- mWidgetListener->UIResolutionChanged();
}
int32_t nsCocoaWindow::RoundsWidgetCoordinatesTo() {
@@ -2327,9 +2328,11 @@ void nsCocoaWindow::SetColorScheme(const Maybe<ColorScheme>& aScheme) {
if (!mWindow) {
return;
}
-
- mWindow.appearance = aScheme ? NSAppearanceForColorScheme(*aScheme) : nil;
-
+ NSAppearance* appearance =
+ aScheme ? NSAppearanceForColorScheme(*aScheme) : nil;
+ if (mWindow.appearance != appearance) {
+ mWindow.appearance = appearance;
+ }
NS_OBJC_END_TRY_IGNORE_BLOCK;
}
@@ -3071,10 +3074,6 @@ static NSMutableSet* gSwizzledFrameViewClasses = nil;
- (void)_setNeedsDisplayInRect:(NSRect)aRect;
@end
-@interface NSView (NSVisualEffectViewSetMaskImage)
-- (void)setMaskImage:(NSImage*)image;
-@end
-
@interface BaseWindow (Private)
- (void)removeTrackingArea;
- (void)cursorUpdated:(NSEvent*)aEvent;
@@ -3174,35 +3173,38 @@ static NSImage* GetMenuMaskImage() {
return maskImage;
}
-- (void)swapOutChildViewWrapper:(NSView*)aNewWrapper {
- aNewWrapper.frame = self.contentView.frame;
+// Add an effect view wrapper if needed so that the OS draws the appropriate
+// vibrancy effect and window border.
+- (void)setEffectViewWrapperForStyle:(WindowShadow)aStyle {
+ NSView* wrapper = [&]() -> NSView* {
+ if (aStyle == WindowShadow::Menu || aStyle == WindowShadow::Tooltip) {
+ const bool isMenu = aStyle == WindowShadow::Menu;
+ auto* effectView =
+ [[NSVisualEffectView alloc] initWithFrame:self.contentView.frame];
+ effectView.material =
+ isMenu ? NSVisualEffectMaterialMenu : NSVisualEffectMaterialToolTip;
+ // Tooltip and menu windows are never "key", so we need to tell the
+ // vibrancy effect to look active regardless of window state.
+ effectView.state = NSVisualEffectStateActive;
+ effectView.blendingMode = NSVisualEffectBlendingModeBehindWindow;
+ if (isMenu) {
+ // Turn on rounded corner masking.
+ effectView.maskImage = GetMenuMaskImage();
+ }
+ return effectView;
+ }
+ return [[NSView alloc] initWithFrame:self.contentView.frame];
+ }();
+
+ wrapper.wantsLayer = YES;
+ // Swap out our content view by the new view. Setting .contentView releases
+ // the old view.
NSView* childView = [self.mainChildView retain];
[childView removeFromSuperview];
- [aNewWrapper addSubview:childView];
+ [wrapper addSubview:childView];
[childView release];
- [super setContentView:aNewWrapper];
-}
-
-- (void)setEffectViewWrapperForStyle:(WindowShadow)aStyle {
- if (aStyle == WindowShadow::Menu || aStyle == WindowShadow::Tooltip) {
- // Add an effect view wrapper so that the OS draws the appropriate
- // vibrancy effect and window border.
- BOOL isMenu = aStyle == WindowShadow::Menu;
- NSView* effectView = VibrancyManager::CreateEffectView(
- isMenu ? VibrancyType::MENU : VibrancyType::TOOLTIP, YES);
- if (isMenu) {
- // Turn on rounded corner masking.
- [effectView setMaskImage:GetMenuMaskImage()];
- }
- [self swapOutChildViewWrapper:effectView];
- [effectView release];
- } else {
- // Remove the existing wrapper.
- NSView* wrapper = [[NSView alloc] initWithFrame:NSZeroRect];
- [wrapper setWantsLayer:YES];
- [self swapOutChildViewWrapper:wrapper];
- [wrapper release];
- }
+ super.contentView = wrapper;
+ [wrapper release];
}
- (NSTouchBar*)makeTouchBar {
diff --git a/widget/cocoa/nsLookAndFeel.mm b/widget/cocoa/nsLookAndFeel.mm
index 779984be0c..69bd348da8 100644
--- a/widget/cocoa/nsLookAndFeel.mm
+++ b/widget/cocoa/nsLookAndFeel.mm
@@ -3,7 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#include "AppearanceOverride.h"
#include "mozilla/widget/ThemeChangeKind.h"
#include "nsLookAndFeel.h"
#include "nsCocoaFeatures.h"
@@ -239,9 +238,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
case ColorID::MozButtonhoverface:
case ColorID::MozButtonactiveface:
case ColorID::MozButtondisabledface:
- case ColorID::MozColheader:
- case ColorID::MozColheaderhover:
- case ColorID::MozColheaderactive:
color = GetColorFromNSColor(NSColor.controlColor);
if (!NS_GET_A(color)) {
color = GetColorFromNSColor(NSColor.controlBackgroundColor);
@@ -301,9 +297,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
case ColorID::Menutext:
case ColorID::Infotext:
case ColorID::MozCellhighlighttext:
- case ColorID::MozColheadertext:
- case ColorID::MozColheaderhovertext:
- case ColorID::MozColheaderactivetext:
case ColorID::MozSidebartext:
color = GetColorFromNSColor(NSColor.controlTextColor);
break;
@@ -319,6 +312,17 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
// For inactive list selection
color = GetColorFromNSColor(NSColor.secondarySelectedControlColor);
break;
+ case ColorID::MozColheadertext:
+ case ColorID::MozColheaderhovertext:
+ case ColorID::MozColheaderactivetext:
+ color = GetColorFromNSColor(NSColor.headerTextColor);
+ break;
+ case ColorID::MozColheaderactive:
+ color = GetColorFromNSColor(
+ NSColor.unemphasizedSelectedContentBackgroundColor);
+ break;
+ case ColorID::MozColheader:
+ case ColorID::MozColheaderhover:
case ColorID::MozEventreerow:
// Background color of even list rows.
color =
@@ -460,11 +464,6 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
case IntID::AlertNotificationOrigin:
aResult = NS_ALERT_TOP;
break;
- case IntID::TabFocusModel:
- aResult = [NSApp isFullKeyboardAccessEnabled]
- ? nsIContent::eTabFocus_any
- : nsIContent::eTabFocus_textControlsMask;
- break;
case IntID::ScrollToClick: {
aResult = [[NSUserDefaults standardUserDefaults]
boolForKey:@"AppleScrollerPagingBehavior"];
@@ -630,10 +629,6 @@ void nsLookAndFeel::RecordAccessibilityTelemetry() {
object:nil
suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately];
- [MOZGlobalAppearance.sharedInstance addObserver:self
- forKeyPath:@"effectiveAppearance"
- options:0
- context:nil];
[NSApp addObserver:self
forKeyPath:@"effectiveAppearance"
options:0
diff --git a/widget/cocoa/nsNativeThemeCocoa.h b/widget/cocoa/nsNativeThemeCocoa.h
index ebbf782264..66e5aec1df 100644
--- a/widget/cocoa/nsNativeThemeCocoa.h
+++ b/widget/cocoa/nsNativeThemeCocoa.h
@@ -40,8 +40,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
eSquareBezelPushButton,
eArrowButton,
eHelpButton,
- eTreeTwistyPointingRight,
- eTreeTwistyPointingDown,
eDisclosureButtonClosed,
eDisclosureButtonOpen
};
@@ -131,12 +129,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
bool rtl = false;
};
- struct TreeHeaderCellParams {
- ControlParams controlParams;
- TreeSortDirection sortDirection = eTreeSortDirection_Natural;
- bool lastTreeHeaderCell = false;
- };
-
struct ScaleParams {
int32_t value = 0;
int32_t min = 0;
@@ -165,7 +157,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
eSearchField, // TextFieldParams
eProgressBar, // ProgressParams
eMeter, // MeterParams
- eTreeHeaderCell, // TreeHeaderCellParams
eScale, // ScaleParams
eMultilineTextField, // bool
eListBox,
@@ -221,9 +212,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
static WidgetInfo Meter(const MeterParams& aParams) {
return WidgetInfo(Widget::eMeter, aParams);
}
- static WidgetInfo TreeHeaderCell(const TreeHeaderCellParams& aParams) {
- return WidgetInfo(Widget::eTreeHeaderCell, aParams);
- }
static WidgetInfo Scale(const ScaleParams& aParams) {
return WidgetInfo(Widget::eScale, aParams);
}
@@ -251,7 +239,7 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
mozilla::Variant<mozilla::gfx::sRGBColor, CheckboxOrRadioParams,
ButtonParams, DropdownParams, SpinButtonParams,
SegmentParams, TextFieldParams, ProgressParams,
- MeterParams, TreeHeaderCellParams, ScaleParams, bool>
+ MeterParams, ScaleParams, bool>
mVariant;
enum Widget mWidget;
@@ -262,47 +250,42 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
NS_DECL_ISUPPORTS_INHERITED
// The nsITheme interface.
- NS_IMETHOD DrawWidgetBackground(gfxContext* aContext, nsIFrame* aFrame,
- StyleAppearance aAppearance,
- const nsRect& aRect, const nsRect& aDirtyRect,
+ NS_IMETHOD DrawWidgetBackground(gfxContext* aContext, nsIFrame*,
+ StyleAppearance, const nsRect& aRect,
+ const nsRect& aDirtyRect,
DrawOverflow) override;
bool CreateWebRenderCommandsForWidget(
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const mozilla::layers::StackingContextHelper& aSc,
- mozilla::layers::RenderRootStateManager* aManager, nsIFrame* aFrame,
- StyleAppearance aAppearance, const nsRect& aRect) override;
- [[nodiscard]] LayoutDeviceIntMargin GetWidgetBorder(
- nsDeviceContext* aContext, nsIFrame* aFrame,
- StyleAppearance aAppearance) override;
-
- bool GetWidgetPadding(nsDeviceContext* aContext, nsIFrame* aFrame,
- StyleAppearance aAppearance,
+ mozilla::layers::RenderRootStateManager* aManager, nsIFrame*,
+ StyleAppearance, const nsRect& aRect) override;
+ [[nodiscard]] LayoutDeviceIntMargin GetWidgetBorder(nsDeviceContext* aContext,
+ nsIFrame*,
+ StyleAppearance) override;
+
+ bool GetWidgetPadding(nsDeviceContext* aContext, nsIFrame*, StyleAppearance,
LayoutDeviceIntMargin* aResult) override;
- virtual bool GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame* aFrame,
- StyleAppearance aAppearance,
- nsRect* aOverflowRect) override;
+ bool GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame*, StyleAppearance,
+ nsRect* aOverflowRect) override;
LayoutDeviceIntSize GetMinimumWidgetSize(nsPresContext*, nsIFrame*,
StyleAppearance) override;
- NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, StyleAppearance aAppearance,
- nsAtom* aAttribute, bool* aShouldRepaint,
+ NS_IMETHOD WidgetStateChanged(nsIFrame*, StyleAppearance, nsAtom* aAttribute,
+ bool* aShouldRepaint,
const nsAttrValue* aOldValue) override;
NS_IMETHOD ThemeChanged() override;
- bool ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* aFrame,
- StyleAppearance aAppearance) override;
- bool WidgetIsContainer(StyleAppearance aAppearance) override;
+ bool ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame*,
+ StyleAppearance) override;
+ bool WidgetIsContainer(StyleAppearance) override;
bool ThemeDrawsFocusForWidget(nsIFrame*, StyleAppearance) override;
bool ThemeNeedsComboboxDropmarker() override;
- virtual bool WidgetAppearanceDependsOnWindowFocus(
- StyleAppearance aAppearance) override;
- virtual ThemeGeometryType ThemeGeometryTypeForWidget(
- nsIFrame* aFrame, StyleAppearance aAppearance) override;
- virtual Transparency GetWidgetTransparency(
- nsIFrame* aFrame, StyleAppearance aAppearance) override;
- mozilla::Maybe<WidgetInfo> ComputeWidgetInfo(nsIFrame* aFrame,
- StyleAppearance aAppearance,
+ bool WidgetAppearanceDependsOnWindowFocus(StyleAppearance) override;
+ ThemeGeometryType ThemeGeometryTypeForWidget(nsIFrame*,
+ StyleAppearance) override;
+ Transparency GetWidgetTransparency(nsIFrame*, StyleAppearance) override;
+ mozilla::Maybe<WidgetInfo> ComputeWidgetInfo(nsIFrame*, StyleAppearance,
const nsRect& aRect);
void DrawProgress(CGContextRef context, const HIRect& inBoxRect,
const ProgressParams& aParams);
@@ -310,24 +293,18 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
protected:
virtual ~nsNativeThemeCocoa();
- LayoutDeviceIntMargin DirectionAwareMargin(
- const LayoutDeviceIntMargin& aMargin, nsIFrame* aFrame);
+ LayoutDeviceIntMargin DirectionAwareMargin(const LayoutDeviceIntMargin&,
+ nsIFrame*);
nsIFrame* SeparatorResponsibility(nsIFrame* aBefore, nsIFrame* aAfter);
- ControlParams ComputeControlParams(nsIFrame* aFrame,
- mozilla::dom::ElementState aEventState);
- SegmentParams ComputeSegmentParams(nsIFrame* aFrame,
- mozilla::dom::ElementState aEventState,
- SegmentType aSegmentType);
- TextFieldParams ComputeTextFieldParams(
- nsIFrame* aFrame, mozilla::dom::ElementState aEventState);
- ProgressParams ComputeProgressParams(nsIFrame* aFrame,
- mozilla::dom::ElementState aEventState,
+ ControlParams ComputeControlParams(nsIFrame*, mozilla::dom::ElementState);
+ SegmentParams ComputeSegmentParams(nsIFrame*, mozilla::dom::ElementState,
+ SegmentType);
+ TextFieldParams ComputeTextFieldParams(nsIFrame*, mozilla::dom::ElementState);
+ ProgressParams ComputeProgressParams(nsIFrame*, mozilla::dom::ElementState,
bool aIsHorizontal);
- MeterParams ComputeMeterParams(nsIFrame* aFrame);
- TreeHeaderCellParams ComputeTreeHeaderCellParams(
- nsIFrame* aFrame, mozilla::dom::ElementState aEventState);
+ MeterParams ComputeMeterParams(nsIFrame*);
mozilla::Maybe<ScaleParams> ComputeHTMLScaleParams(
- nsIFrame* aFrame, mozilla::dom::ElementState aEventState);
+ nsIFrame*, mozilla::dom::ElementState);
// HITheme drawing routines
void DrawMeter(CGContextRef context, const HIRect& inBoxRect,
@@ -363,8 +340,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
const ControlParams& aParams);
void DrawButton(CGContextRef context, const HIRect& inBoxRect,
const ButtonParams& aParams);
- void DrawTreeHeaderCell(CGContextRef context, const HIRect& inBoxRect,
- const TreeHeaderCellParams& aParams);
void DrawDropdown(CGContextRef context, const HIRect& inBoxRect,
const DropdownParams& aParams);
HIThemeButtonDrawInfo SpinButtonDrawInfo(ThemeButtonKind aKind,
@@ -396,7 +371,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
NSComboBoxCell* mComboBoxCell;
NSProgressBarCell* mProgressBarCell;
NSLevelIndicatorCell* mMeterBarCell;
- NSTableHeaderCell* mTreeHeaderCell;
MOZCellDrawWindow* mCellDrawWindow = nil;
MOZCellDrawView* mCellDrawView;
};
diff --git a/widget/cocoa/nsNativeThemeCocoa.mm b/widget/cocoa/nsNativeThemeCocoa.mm
index 18913facea..ad16fac04a 100644
--- a/widget/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/cocoa/nsNativeThemeCocoa.mm
@@ -458,8 +458,6 @@ nsNativeThemeCocoa::nsNativeThemeCocoa() : ThemeCocoa(ScrollbarStyle()) {
mMeterBarCell = [[NSLevelIndicatorCell alloc]
initWithLevelIndicatorStyle:NSLevelIndicatorStyleContinuousCapacity];
- mTreeHeaderCell = [[NSTableHeaderCell alloc] init];
-
mCellDrawView = [[MOZCellDrawView alloc] init];
if (XRE_IsParentProcess()) {
@@ -498,7 +496,6 @@ nsNativeThemeCocoa::~nsNativeThemeCocoa() {
[mSearchFieldCell release];
[mDropdownCell release];
[mComboBoxCell release];
- [mTreeHeaderCell release];
[mCellDrawWindow release];
[mCellDrawView release];
@@ -1094,6 +1091,7 @@ static bool ShouldUnconditionallyDrawFocusRingIfFocused(nsIFrame* aFrame) {
// Mac always draws focus rings for textboxes and lists.
switch (aFrame->StyleDisplay()->EffectiveAppearance()) {
case StyleAppearance::NumberInput:
+ case StyleAppearance::PasswordInput:
case StyleAppearance::Textfield:
case StyleAppearance::Textarea:
case StyleAppearance::Searchfield:
@@ -1316,17 +1314,6 @@ static void RenderButton(CGContextRef cgContext, const HIRect& aRenderRect,
NULL);
}
-static ThemeDrawState ToThemeDrawState(
- const nsNativeThemeCocoa::ControlParams& aParams) {
- if (aParams.disabled) {
- return kThemeStateUnavailable;
- }
- if (aParams.pressed) {
- return kThemeStatePressed;
- }
- return kThemeStateActive;
-}
-
void nsNativeThemeCocoa::DrawHIThemeButton(
CGContextRef cgContext, const HIRect& aRect, ThemeButtonKind aKind,
ThemeButtonValue aValue, ThemeDrawState aState,
@@ -1376,16 +1363,6 @@ void nsNativeThemeCocoa::DrawButton(CGContextRef cgContext,
case ButtonType::eHelpButton:
DrawHelpButton(cgContext, inBoxRect, controlParams);
return;
- case ButtonType::eTreeTwistyPointingRight:
- DrawHIThemeButton(cgContext, inBoxRect, kThemeDisclosureButton,
- kThemeDisclosureRight, ToThemeDrawState(controlParams),
- kThemeAdornmentNone, controlParams);
- return;
- case ButtonType::eTreeTwistyPointingDown:
- DrawHIThemeButton(cgContext, inBoxRect, kThemeDisclosureButton,
- kThemeDisclosureDown, ToThemeDrawState(controlParams),
- kThemeAdornmentNone, controlParams);
- return;
case ButtonType::eDisclosureButtonClosed:
DrawDisclosureButton(cgContext, inBoxRect, controlParams,
NSControlStateValueOff);
@@ -1397,87 +1374,6 @@ void nsNativeThemeCocoa::DrawButton(CGContextRef cgContext,
}
}
-nsNativeThemeCocoa::TreeHeaderCellParams
-nsNativeThemeCocoa::ComputeTreeHeaderCellParams(nsIFrame* aFrame,
- ElementState aEventState) {
- TreeHeaderCellParams params;
- params.controlParams = ComputeControlParams(aFrame, aEventState);
- params.sortDirection = GetTreeSortDirection(aFrame);
- params.lastTreeHeaderCell = IsLastTreeHeaderCell(aFrame);
- return params;
-}
-
-@interface NSTableHeaderCell (NSTableHeaderCell_setSortable)
-// This method has been present in the same form since at least macOS 10.4.
-- (void)_setSortable:(BOOL)arg1
- showSortIndicator:(BOOL)arg2
- ascending:(BOOL)arg3
- priority:(NSInteger)arg4
- highlightForSort:(BOOL)arg5;
-@end
-
-void nsNativeThemeCocoa::DrawTreeHeaderCell(
- CGContextRef cgContext, const HIRect& inBoxRect,
- const TreeHeaderCellParams& aParams) {
- NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
-
- // Without clearing the cell's title, it takes on a default value of "Field",
- // which is displayed underneath the title set in the front-end.
- NSCell* cell = (NSCell*)mTreeHeaderCell;
- cell.title = @"";
-
- if ([mTreeHeaderCell
- respondsToSelector:@selector
- (_setSortable:
- showSortIndicator:ascending:priority:highlightForSort:)]) {
- switch (aParams.sortDirection) {
- case eTreeSortDirection_Ascending:
- [mTreeHeaderCell _setSortable:YES
- showSortIndicator:YES
- ascending:YES
- priority:0
- highlightForSort:YES];
- break;
- case eTreeSortDirection_Descending:
- [mTreeHeaderCell _setSortable:YES
- showSortIndicator:YES
- ascending:NO
- priority:0
- highlightForSort:YES];
- break;
- default:
- // eTreeSortDirection_Natural
- [mTreeHeaderCell _setSortable:YES
- showSortIndicator:NO
- ascending:YES
- priority:0
- highlightForSort:NO];
- break;
- }
- }
-
- mTreeHeaderCell.enabled = !aParams.controlParams.disabled;
- mTreeHeaderCell.state =
- (mTreeHeaderCell.enabled && aParams.controlParams.pressed)
- ? NSControlStateValueOn
- : NSControlStateValueOff;
-
- mCellDrawView._drawingEndSeparator = !aParams.lastTreeHeaderCell;
-
- NSGraphicsContext* savedContext = NSGraphicsContext.currentContext;
- NSGraphicsContext.currentContext =
- [NSGraphicsContext graphicsContextWithCGContext:cgContext flipped:YES];
- DrawCellIncludingFocusRing(mTreeHeaderCell, inBoxRect, mCellDrawView);
- NSGraphicsContext.currentContext = savedContext;
-
-#if DRAW_IN_FRAME_DEBUG
- CGContextSetRGBFillColor(cgContext, 0.0, 0.0, 0.5, 0.25);
- CGContextFillRect(cgContext, inBoxRect);
-#endif
-
- NS_OBJC_END_TRY_IGNORE_BLOCK;
-}
-
static const CellRenderSettings dropdownSettings = {
{
NSMakeSize(0, 16), // mini
@@ -2159,8 +2055,6 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
switch (aAppearance) {
case StyleAppearance::Menupopup:
- return Nothing();
-
case StyleAppearance::Tooltip:
return Nothing();
@@ -2323,6 +2217,7 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
case StyleAppearance::Textfield:
case StyleAppearance::NumberInput:
+ case StyleAppearance::PasswordInput:
return Some(
WidgetInfo::TextField(ComputeTextFieldParams(aFrame, elementState)));
@@ -2348,30 +2243,6 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
// Do nothing: progress and meter bars cases will draw chunks.
break;
- case StyleAppearance::Treetwisty:
- return Some(WidgetInfo::Button(
- ButtonParams{ComputeControlParams(aFrame, elementState),
- ButtonType::eTreeTwistyPointingRight}));
-
- case StyleAppearance::Treetwistyopen:
- return Some(WidgetInfo::Button(
- ButtonParams{ComputeControlParams(aFrame, elementState),
- ButtonType::eTreeTwistyPointingDown}));
-
- case StyleAppearance::Treeheadercell:
- return Some(WidgetInfo::TreeHeaderCell(
- ComputeTreeHeaderCellParams(aFrame, elementState)));
-
- case StyleAppearance::Treeitem:
- case StyleAppearance::Treeview:
- return Some(WidgetInfo::ColorFill(sRGBColor(1.0, 1.0, 1.0, 1.0)));
-
- case StyleAppearance::Treeheader:
- // do nothing, taken care of by individual header cells
- case StyleAppearance::Treeline:
- // do nothing, these lines don't exist on macos
- break;
-
case StyleAppearance::Range: {
Maybe<ScaleParams> params = ComputeHTMLScaleParams(aFrame, elementState);
if (params) {
@@ -2581,12 +2452,6 @@ void nsNativeThemeCocoa::RenderWidget(const WidgetInfo& aWidgetInfo,
DrawMeter(cgContext, macRect, params);
break;
}
- case Widget::eTreeHeaderCell: {
- TreeHeaderCellParams params =
- aWidgetInfo.Params<TreeHeaderCellParams>();
- DrawTreeHeaderCell(cgContext, macRect, params);
- break;
- }
case Widget::eScale: {
ScaleParams params = aWidgetInfo.Params<ScaleParams>();
DrawScale(cgContext, macRect, params);
@@ -2668,14 +2533,10 @@ bool nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(
case StyleAppearance::MozMenulistArrowButton:
case StyleAppearance::Textfield:
case StyleAppearance::NumberInput:
+ case StyleAppearance::PasswordInput:
case StyleAppearance::Searchfield:
case StyleAppearance::ProgressBar:
case StyleAppearance::Meter:
- case StyleAppearance::Treeheadercell:
- case StyleAppearance::Treetwisty:
- case StyleAppearance::Treetwistyopen:
- case StyleAppearance::Treeitem:
- case StyleAppearance::Treeview:
case StyleAppearance::Range:
return false;
@@ -2747,6 +2608,7 @@ LayoutDeviceIntMargin nsNativeThemeCocoa::GetWidgetBorder(
break;
case StyleAppearance::NumberInput:
+ case StyleAppearance::PasswordInput:
case StyleAppearance::Textfield: {
SInt32 frameOutset = 0;
::GetThemeMetric(kThemeMetricEditTextFrameOutset, &frameOutset);
@@ -2845,6 +2707,7 @@ bool nsNativeThemeCocoa::GetWidgetOverflow(nsDeviceContext* aContext,
case StyleAppearance::MozMacHelpButton:
case StyleAppearance::Toolbarbutton:
case StyleAppearance::NumberInput:
+ case StyleAppearance::PasswordInput:
case StyleAppearance::Textfield:
case StyleAppearance::Textarea:
case StyleAppearance::Searchfield:
@@ -2957,6 +2820,7 @@ LayoutDeviceIntSize nsNativeThemeCocoa::GetMinimumWidgetSize(
}
case StyleAppearance::NumberInput:
+ case StyleAppearance::PasswordInput:
case StyleAppearance::Textfield:
case StyleAppearance::Textarea:
case StyleAppearance::Searchfield: {
@@ -2985,23 +2849,6 @@ LayoutDeviceIntSize nsNativeThemeCocoa::GetMinimumWidgetSize(
break;
}
- case StyleAppearance::Treetwisty:
- case StyleAppearance::Treetwistyopen: {
- SInt32 twistyHeight = 0, twistyWidth = 0;
- ::GetThemeMetric(kThemeMetricDisclosureButtonWidth, &twistyWidth);
- ::GetThemeMetric(kThemeMetricDisclosureButtonHeight, &twistyHeight);
- result.SizeTo(twistyWidth, twistyHeight);
- break;
- }
-
- case StyleAppearance::Treeheader:
- case StyleAppearance::Treeheadercell: {
- SInt32 headerHeight = 0;
- ::GetThemeMetric(kThemeMetricListHeaderHeight, &headerHeight);
- result.SizeTo(0, headerHeight);
- break;
- }
-
case StyleAppearance::Tab: {
result.SizeTo(0, tabHeights[miniControlSize]);
break;
@@ -3128,6 +2975,7 @@ bool nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext,
case StyleAppearance::SpinnerDownbutton:
case StyleAppearance::Statusbar:
case StyleAppearance::NumberInput:
+ case StyleAppearance::PasswordInput:
case StyleAppearance::Textfield:
case StyleAppearance::Textarea:
case StyleAppearance::Searchfield:
@@ -3140,14 +2988,6 @@ bool nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext,
case StyleAppearance::Tabpanels:
case StyleAppearance::Tab:
- case StyleAppearance::Treetwisty:
- case StyleAppearance::Treetwistyopen:
- case StyleAppearance::Treeview:
- case StyleAppearance::Treeheader:
- case StyleAppearance::Treeheadercell:
- case StyleAppearance::Treeitem:
- case StyleAppearance::Treeline:
-
case StyleAppearance::Range:
return !IsWidgetStyled(aPresContext, aFrame, aAppearance);
@@ -3184,6 +3024,7 @@ bool nsNativeThemeCocoa::ThemeDrawsFocusForWidget(nsIFrame*,
case StyleAppearance::Textfield:
case StyleAppearance::Searchfield:
case StyleAppearance::NumberInput:
+ case StyleAppearance::PasswordInput:
case StyleAppearance::Menulist:
case StyleAppearance::MenulistButton:
case StyleAppearance::Button:
@@ -3212,9 +3053,8 @@ bool nsNativeThemeCocoa::WidgetAppearanceDependsOnWindowFocus(
case StyleAppearance::SpinnerDownbutton:
case StyleAppearance::Separator:
case StyleAppearance::NumberInput:
+ case StyleAppearance::PasswordInput:
case StyleAppearance::Textfield:
- case StyleAppearance::Treeview:
- case StyleAppearance::Treeline:
case StyleAppearance::Textarea:
case StyleAppearance::Listbox:
return false;