зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1335191 - Remove nsIWidget::SetWindowTitlebarColor and the nsCocoaWindow implementation. r=spohl
It's unused and no longer has any effect. MozReview-Commit-ID: DroUFYOovMx --HG-- extra : rebase_source : fe85188b00dab9fde50409153f464297aff774fa
This commit is contained in:
Родитель
3989197ef0
Коммит
51da09f53f
|
@ -38,8 +38,6 @@ typedef struct _nsCocoaWindowList {
|
|||
// Data Storage
|
||||
NSMutableDictionary* mState;
|
||||
BOOL mDrawsIntoWindowFrame;
|
||||
NSColor* mActiveTitlebarColor;
|
||||
NSColor* mInactiveTitlebarColor;
|
||||
|
||||
// Invalidation disabling
|
||||
BOOL mDisabledNeedsDisplay;
|
||||
|
@ -58,8 +56,6 @@ typedef struct _nsCocoaWindowList {
|
|||
- (NSMutableDictionary*)exportState;
|
||||
- (void)setDrawsContentsIntoWindowFrame:(BOOL)aState;
|
||||
- (BOOL)drawsContentsIntoWindowFrame;
|
||||
- (void)setTitlebarColor:(NSColor*)aColor forActiveWindow:(BOOL)aActive;
|
||||
- (NSColor*)titlebarColorForActiveWindow:(BOOL)aActive;
|
||||
|
||||
|
||||
- (void)mouseEntered:(NSEvent*)aEvent;
|
||||
|
@ -179,8 +175,6 @@ typedef struct _nsCocoaWindowList {
|
|||
NSRect mWindowButtonsRect;
|
||||
NSRect mFullScreenButtonRect;
|
||||
}
|
||||
// Pass nil here to get the default appearance.
|
||||
- (void)setTitlebarColor:(NSColor*)aColor forActiveWindow:(BOOL)aActive;
|
||||
- (void)setUnifiedToolbarHeight:(CGFloat)aHeight;
|
||||
- (CGFloat)unifiedToolbarHeight;
|
||||
- (CGFloat)titlebarHeight;
|
||||
|
@ -309,7 +303,6 @@ public:
|
|||
virtual void SetDrawsTitle(bool aDrawTitle) override;
|
||||
virtual void SetUseBrightTitlebarForeground(bool aBrightForeground) override;
|
||||
virtual nsresult SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
|
||||
virtual void SetWindowTitlebarColor(nscolor aColor, bool aActive) override;
|
||||
virtual void SetDrawsInTitlebar(bool aState) override;
|
||||
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override;
|
||||
virtual nsresult SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
||||
|
|
|
@ -2430,44 +2430,6 @@ nsCocoaWindow::SetNonClientMargins(LayoutDeviceIntMargin &margins)
|
|||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
void
|
||||
nsCocoaWindow::SetWindowTitlebarColor(nscolor aColor, bool aActive)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
if (!mWindow)
|
||||
return;
|
||||
|
||||
// If they pass a color with a complete transparent alpha component, use the
|
||||
// native titlebar appearance.
|
||||
if (NS_GET_A(aColor) == 0) {
|
||||
[mWindow setTitlebarColor:nil forActiveWindow:(BOOL)aActive];
|
||||
} else {
|
||||
// Transform from sRGBA to monitor RGBA. This seems like it would make trying
|
||||
// to match the system appearance lame, so probably we just shouldn't color
|
||||
// correct chrome.
|
||||
if (gfxPlatform::GetCMSMode() == eCMSMode_All) {
|
||||
qcms_transform *transform = gfxPlatform::GetCMSRGBATransform();
|
||||
if (transform) {
|
||||
uint8_t color[3];
|
||||
color[0] = NS_GET_R(aColor);
|
||||
color[1] = NS_GET_G(aColor);
|
||||
color[2] = NS_GET_B(aColor);
|
||||
qcms_transform_data(transform, color, color, 1);
|
||||
aColor = NS_RGB(color[0], color[1], color[2]);
|
||||
}
|
||||
}
|
||||
|
||||
[mWindow setTitlebarColor:[NSColor colorWithDeviceRed:NS_GET_R(aColor)/255.0
|
||||
green:NS_GET_G(aColor)/255.0
|
||||
blue:NS_GET_B(aColor)/255.0
|
||||
alpha:NS_GET_A(aColor)/255.0]
|
||||
forActiveWindow:(BOOL)aActive];
|
||||
}
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
void nsCocoaWindow::SetDrawsInTitlebar(bool aState)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
@ -3095,8 +3057,6 @@ static NSMutableSet *gSwizzledFrameViewClasses = nil;
|
|||
mDrawsIntoWindowFrame = NO;
|
||||
[super initWithContentRect:aContentRect styleMask:aStyle backing:aBufferingType defer:aFlag];
|
||||
mState = nil;
|
||||
mActiveTitlebarColor = nil;
|
||||
mInactiveTitlebarColor = nil;
|
||||
mDisabledNeedsDisplay = NO;
|
||||
mTrackingArea = nil;
|
||||
mDirtyRect = NSZeroRect;
|
||||
|
@ -3186,8 +3146,6 @@ GetMenuMaskImage()
|
|||
|
||||
- (void)dealloc
|
||||
{
|
||||
[mActiveTitlebarColor release];
|
||||
[mInactiveTitlebarColor release];
|
||||
[self removeTrackingArea];
|
||||
ChildViewMouseTracker::OnDestroyWindow(self);
|
||||
[super dealloc];
|
||||
|
@ -3195,8 +3153,6 @@ GetMenuMaskImage()
|
|||
|
||||
static const NSString* kStateTitleKey = @"title";
|
||||
static const NSString* kStateDrawsContentsIntoWindowFrameKey = @"drawsContentsIntoWindowFrame";
|
||||
static const NSString* kStateActiveTitlebarColorKey = @"activeTitlebarColor";
|
||||
static const NSString* kStateInactiveTitlebarColorKey = @"inactiveTitlebarColor";
|
||||
static const NSString* kStateShowsToolbarButton = @"showsToolbarButton";
|
||||
static const NSString* kStateCollectionBehavior = @"collectionBehavior";
|
||||
|
||||
|
@ -3206,8 +3162,6 @@ static const NSString* kStateCollectionBehavior = @"collectionBehavior";
|
|||
[self setTitle:title];
|
||||
}
|
||||
[self setDrawsContentsIntoWindowFrame:[[aState objectForKey:kStateDrawsContentsIntoWindowFrameKey] boolValue]];
|
||||
[self setTitlebarColor:[aState objectForKey:kStateActiveTitlebarColorKey] forActiveWindow:YES];
|
||||
[self setTitlebarColor:[aState objectForKey:kStateInactiveTitlebarColorKey] forActiveWindow:NO];
|
||||
[self setShowsToolbarButton:[[aState objectForKey:kStateShowsToolbarButton] boolValue]];
|
||||
[self setCollectionBehavior:[[aState objectForKey:kStateCollectionBehavior] unsignedIntValue]];
|
||||
}
|
||||
|
@ -3220,14 +3174,6 @@ static const NSString* kStateCollectionBehavior = @"collectionBehavior";
|
|||
}
|
||||
[state setObject:[NSNumber numberWithBool:[self drawsContentsIntoWindowFrame]]
|
||||
forKey:kStateDrawsContentsIntoWindowFrameKey];
|
||||
NSColor* activeTitlebarColor = [self titlebarColorForActiveWindow:YES];
|
||||
if (activeTitlebarColor) {
|
||||
[state setObject:activeTitlebarColor forKey:kStateActiveTitlebarColorKey];
|
||||
}
|
||||
NSColor* inactiveTitlebarColor = [self titlebarColorForActiveWindow:NO];
|
||||
if (inactiveTitlebarColor) {
|
||||
[state setObject:inactiveTitlebarColor forKey:kStateInactiveTitlebarColorKey];
|
||||
}
|
||||
[state setObject:[NSNumber numberWithBool:[self showsToolbarButton]]
|
||||
forKey:kStateShowsToolbarButton];
|
||||
[state setObject:[NSNumber numberWithUnsignedInt: [self collectionBehavior]]
|
||||
|
@ -3278,24 +3224,6 @@ static const NSString* kStateCollectionBehavior = @"collectionBehavior";
|
|||
return mBrightTitlebarForeground;
|
||||
}
|
||||
|
||||
// Pass nil here to get the default appearance.
|
||||
- (void)setTitlebarColor:(NSColor*)aColor forActiveWindow:(BOOL)aActive
|
||||
{
|
||||
[aColor retain];
|
||||
if (aActive) {
|
||||
[mActiveTitlebarColor release];
|
||||
mActiveTitlebarColor = aColor;
|
||||
} else {
|
||||
[mInactiveTitlebarColor release];
|
||||
mInactiveTitlebarColor = aColor;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSColor*)titlebarColorForActiveWindow:(BOOL)aActive
|
||||
{
|
||||
return aActive ? mActiveTitlebarColor : mInactiveTitlebarColor;
|
||||
}
|
||||
|
||||
- (NSView*)trackingAreaView
|
||||
{
|
||||
NSView* contentView = [self contentView];
|
||||
|
@ -3580,12 +3508,6 @@ static const NSString* kStateCollectionBehavior = @"collectionBehavior";
|
|||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
|
||||
- (void)setTitlebarColor:(NSColor*)aColor forActiveWindow:(BOOL)aActive
|
||||
{
|
||||
[super setTitlebarColor:aColor forActiveWindow:aActive];
|
||||
[self setTitlebarNeedsDisplayInRect:[self titlebarRect]];
|
||||
}
|
||||
|
||||
- (void)setTitlebarNeedsDisplayInRect:(NSRect)aRect
|
||||
{
|
||||
[self setTitlebarNeedsDisplayInRect:aRect sync:NO];
|
||||
|
|
|
@ -256,8 +256,6 @@ public:
|
|||
{ return NS_OK; }
|
||||
virtual bool HasPendingInputEvent() override;
|
||||
virtual void SetIcon(const nsAString &aIconSpec) override {}
|
||||
virtual void SetWindowTitlebarColor(nscolor aColor, bool aActive)
|
||||
override {}
|
||||
virtual void SetDrawsInTitlebar(bool aState) override {}
|
||||
virtual bool ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) override;
|
||||
virtual void FreeNativeData(void * data, uint32_t aDataType) override {}
|
||||
|
|
|
@ -1451,24 +1451,6 @@ class nsIWidget : public nsISupports
|
|||
*/
|
||||
virtual bool HasPendingInputEvent() = 0;
|
||||
|
||||
/**
|
||||
* Set the background color of the window titlebar for this widget. On Mac,
|
||||
* for example, this will remove the grey gradient and bottom border and
|
||||
* instead show a single, solid color.
|
||||
*
|
||||
* Ignored on any platform that does not support it. Ignored by widgets that
|
||||
* do not represent windows.
|
||||
*
|
||||
* @param aColor The color to set the title bar background to. Alpha values
|
||||
* other than fully transparent (0) are respected if possible
|
||||
* on the platform. An alpha of 0 will cause the window to
|
||||
* draw with the default style for the platform.
|
||||
*
|
||||
* @param aActive Whether the color should be applied to active or inactive
|
||||
* windows.
|
||||
*/
|
||||
virtual void SetWindowTitlebarColor(nscolor aColor, bool aActive) = 0;
|
||||
|
||||
/**
|
||||
* If set to true, the window will draw its contents into the titlebar
|
||||
* instead of below it.
|
||||
|
|
Загрузка…
Ссылка в новой задаче