Commit a6b665da authored by Oscar Johansson's avatar Oscar Johansson Committed by Commit Bot

Rename constants to be unique (mac)

When building using jumbo, files gets merged and constants
with the same name may end up in the same scope and conflict.

This commit solves the issue by renaming the constants to
something more file specific.

Bug: 803406
Change-Id: I70976f012e9be6f395d4bfcc43e785515071ebb3
Reviewed-on: https://chromium-review.googlesource.com/1142783
Commit-Queue: Oscar Johansson <oscarj@opera.com>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576511}
parent f06fd249
...@@ -33,7 +33,7 @@ const int kHierarchyButtonTrailingPadding = 4; ...@@ -33,7 +33,7 @@ const int kHierarchyButtonTrailingPadding = 4;
const int kHierarchyButtonLeadingPadding = 11; const int kHierarchyButtonLeadingPadding = 11;
const int kIconTextSpacer = 4; const int kIconTextSpacer = 4;
const int kTrailingPadding = 4; const int kTrailingCellPadding = 4;
const int kIconLeadingPadding = 4; const int kIconLeadingPadding = 4;
const int kDefaultFontSize = 12; const int kDefaultFontSize = 12;
...@@ -133,9 +133,10 @@ const CGFloat kKernAmount = 0.2; ...@@ -133,9 +133,10 @@ const CGFloat kKernAmount = 0.2;
NSKernAttributeName : @(kKernAmount), NSKernAttributeName : @(kKernAmount),
NSFontAttributeName : [self fontForBookmarkBarCell], NSFontAttributeName : [self fontForBookmarkBarCell],
}]; }];
width += kIconTextSpacer + std::ceil(titleSize.width) + kTrailingPadding; width +=
kIconTextSpacer + std::ceil(titleSize.width) + kTrailingCellPadding;
} else { } else {
width += kTrailingPadding; width += kTrailingCellPadding;
} }
return width; return width;
} }
...@@ -383,7 +384,8 @@ const CGFloat kKernAmount = 0.2; ...@@ -383,7 +384,8 @@ const CGFloat kKernAmount = 0.2;
if ([title length] > 0) { if ([title length] > 0) {
CGFloat textWidth = CGFloat textWidth =
[title sizeWithAttributes:[self titleTextAttributes]].width; [title sizeWithAttributes:[self titleTextAttributes]].width;
cellSize.width += kIconTextSpacer + std::ceil(textWidth) + kTrailingPadding; cellSize.width +=
kIconTextSpacer + std::ceil(textWidth) + kTrailingCellPadding;
} else { } else {
cellSize.width += kIconLeadingPadding; cellSize.width += kIconLeadingPadding;
} }
...@@ -415,7 +417,8 @@ const CGFloat kKernAmount = 0.2; ...@@ -415,7 +417,8 @@ const CGFloat kKernAmount = 0.2;
? NSWidth(theRect) - NSMinX(imageRect) // Un-flip ? NSWidth(theRect) - NSMinX(imageRect) // Un-flip
: NSMaxX(imageRect); : NSMaxX(imageRect);
textRect.origin.x = imageEnd + kIconTextSpacer; textRect.origin.x = imageEnd + kIconTextSpacer;
textRect.size.width = NSWidth(theRect) - NSMinX(textRect) - kTrailingPadding; textRect.size.width =
NSWidth(theRect) - NSMinX(textRect) - kTrailingCellPadding;
if (drawFolderArrow_) if (drawFolderArrow_)
textRect.size.width -= textRect.size.width -=
[arrowImage_ size].width + kHierarchyButtonTrailingPadding; [arrowImage_ size].width + kHierarchyButtonTrailingPadding;
......
...@@ -51,7 +51,7 @@ namespace { ...@@ -51,7 +51,7 @@ namespace {
NSTimeInterval gAutoCloseDelay = 1.5; NSTimeInterval gAutoCloseDelay = 1.5;
// The height of the window. // The height of the window.
const CGFloat kWindowHeight = 29.0; const CGFloat kZoomBubbleWindowHeight = 29.0;
// Width of the zoom in and zoom out buttons. // Width of the zoom in and zoom out buttons.
const CGFloat kZoomInOutButtonWidth = 44.0; const CGFloat kZoomInOutButtonWidth = 44.0;
...@@ -216,7 +216,8 @@ void SetZoomBubbleAutoCloseDelayForTesting(NSTimeInterval time_interval) { ...@@ -216,7 +216,8 @@ void SetZoomBubbleAutoCloseDelayForTesting(NSTimeInterval time_interval) {
NSButton* zoomOutButton = [self addButtonWithTitleID:IDS_ZOOM_MINUS2 NSButton* zoomOutButton = [self addButtonWithTitleID:IDS_ZOOM_MINUS2
fontSize:kZoomInOutButtonFontSize fontSize:kZoomInOutButtonFontSize
action:@selector(zoomOut:)]; action:@selector(zoomOut:)];
NSRect rect = NSMakeRect(0, 0, kZoomInOutButtonWidth, kWindowHeight); NSRect rect =
NSMakeRect(0, 0, kZoomInOutButtonWidth, kZoomBubbleWindowHeight);
[zoomOutButton setFrame:rect]; [zoomOutButton setFrame:rect];
// Zoom label. // Zoom label.
......
...@@ -19,18 +19,18 @@ ...@@ -19,18 +19,18 @@
namespace { namespace {
const SkColor kTextColor = SkColorSetRGB(0x66, 0x66, 0x66); const SkColor kPromoTextColor = SkColorSetRGB(0x66, 0x66, 0x66);
const SkColor kPromoViewBackgroundColor = SkColorSetRGB(0xf5, 0xf5, 0xf5); const SkColor kPromoViewBackgroundColor = SkColorSetRGB(0xf5, 0xf5, 0xf5);
const SkColor kBorderColor = SkColorSetRGB(0xe5, 0xe5, 0xe5); const SkColor kPromoBorderColor = SkColorSetRGB(0xe5, 0xe5, 0xe5);
// Vertical padding of the promo (dp). // Vertical padding of the promo (dp).
const CGFloat kVerticalPadding = 15; const CGFloat kPromoVerticalPadding = 15;
// Width of the border (dp). // Width of the border (dp).
const CGFloat kBorderWidth = 1.0; const CGFloat kPromoBorderWidth = 1.0;
// Font size of the promo text (pt). // Font size of the promo text (pt).
const int kFontSize = 11; const int kPromoFontSize = 11;
} // namespace } // namespace
...@@ -50,16 +50,17 @@ const int kFontSize = 11; ...@@ -50,16 +50,17 @@ const int kFontSize = 11;
} }
- (CGFloat)borderWidth { - (CGFloat)borderWidth {
return kBorderWidth; return kPromoBorderWidth;
} }
- (CGFloat)preferredHeightForWidth:(CGFloat)width { - (CGFloat)preferredHeightForWidth:(CGFloat)width {
CGFloat availableWidth = CGFloat availableWidth =
width - (2 * chrome_style::kHorizontalPadding) - (2 * kBorderWidth); width - (2 * chrome_style::kHorizontalPadding) - (2 * kPromoBorderWidth);
NSRect frame = [[textView_ textStorage] NSRect frame = [[textView_ textStorage]
boundingRectWithSize:NSMakeSize(availableWidth, 0.0) boundingRectWithSize:NSMakeSize(availableWidth, 0.0)
options:NSStringDrawingUsesLineFragmentOrigin]; options:NSStringDrawingUsesLineFragmentOrigin];
return frame.size.height + (2 * kVerticalPadding) + (2 * kBorderWidth); return frame.size.height + (2 * kPromoVerticalPadding) +
(2 * kPromoBorderWidth);
} }
- (void)loadView { - (void)loadView {
...@@ -68,10 +69,10 @@ const int kFontSize = 11; ...@@ -68,10 +69,10 @@ const int kFontSize = 11;
[promoView [promoView
setFillColor:skia::SkColorToDeviceNSColor(kPromoViewBackgroundColor)]; setFillColor:skia::SkColorToDeviceNSColor(kPromoViewBackgroundColor)];
[promoView setContentViewMargins:NSMakeSize(chrome_style::kHorizontalPadding, [promoView setContentViewMargins:NSMakeSize(chrome_style::kHorizontalPadding,
kVerticalPadding)]; kPromoVerticalPadding)];
[promoView setBorderType:NSLineBorder]; [promoView setBorderType:NSLineBorder];
[promoView setBorderWidth:kBorderWidth]; [promoView setBorderWidth:kPromoBorderWidth];
[promoView setBorderColor:skia::SkColorToDeviceNSColor(kBorderColor)]; [promoView setBorderColor:skia::SkColorToDeviceNSColor(kPromoBorderColor)];
// Add the sync promo text. // Add the sync promo text.
size_t offset; size_t offset;
...@@ -80,14 +81,14 @@ const int kFontSize = 11; ...@@ -80,14 +81,14 @@ const int kFontSize = 11;
l10n_util::GetStringFUTF16(promoStringId_, linkText, &offset); l10n_util::GetStringFUTF16(promoStringId_, linkText, &offset);
NSString* nsPromoText = base::SysUTF16ToNSString(promoText); NSString* nsPromoText = base::SysUTF16ToNSString(promoText);
NSString* nsLinkText = base::SysUTF16ToNSString(linkText); NSString* nsLinkText = base::SysUTF16ToNSString(linkText);
NSFont* font = [NSFont labelFontOfSize:kFontSize]; NSFont* font = [NSFont labelFontOfSize:kPromoFontSize];
NSColor* linkColor = skia::SkColorToCalibratedNSColor( NSColor* linkColor = skia::SkColorToCalibratedNSColor(
chrome_style::GetLinkColor()); chrome_style::GetLinkColor());
textView_.reset([[HyperlinkTextView alloc] init]); textView_.reset([[HyperlinkTextView alloc] init]);
[textView_ setMessage:nsPromoText [textView_ setMessage:nsPromoText
withFont:font withFont:font
messageColor:skia::SkColorToDeviceNSColor(kTextColor)]; messageColor:skia::SkColorToDeviceNSColor(kPromoTextColor)];
[textView_ addLinkRange:NSMakeRange(offset, [nsLinkText length]) [textView_ addLinkRange:NSMakeRange(offset, [nsLinkText length])
withURL:nil withURL:nil
linkColor:linkColor]; linkColor:linkColor];
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
namespace { namespace {
const CGFloat kWindowMinWidth = 500; const CGFloat kConstrainedWindowMinWidth = 500;
const CGFloat kButtonGap = 6; const CGFloat kConstrainedWindowButtonGap = 6;
} // namespace } // namespace
...@@ -163,21 +163,22 @@ const CGFloat kButtonGap = 6; ...@@ -163,21 +163,22 @@ const CGFloat kButtonGap = 6;
buttonWidth += size.width; buttonWidth += size.width;
} }
if ([buttons_ count]) if ([buttons_ count])
buttonWidth += ([buttons_ count] - 1) * kButtonGap; buttonWidth += ([buttons_ count] - 1) * kConstrainedWindowButtonGap;
// Window width. // Window width.
CGFloat windowWidth = buttonWidth; CGFloat windowWidth = buttonWidth;
if (accessoryView_.get()) if (accessoryView_.get())
windowWidth = std::max(windowWidth, NSWidth([accessoryView_ frame])); windowWidth = std::max(windowWidth, NSWidth([accessoryView_ frame]));
windowWidth += chrome_style::kHorizontalPadding * 2; windowWidth += chrome_style::kHorizontalPadding * 2;
windowWidth = std::max(windowWidth, kWindowMinWidth); windowWidth = std::max(windowWidth, kConstrainedWindowMinWidth);
// Layout controls. // Layout controls.
[self layoutButtonsWithWindowWidth:windowWidth]; [self layoutButtonsWithWindowWidth:windowWidth];
CGFloat curY = [buttons_ count] ? NSMaxY([[buttons_ lastObject] frame]) CGFloat curY = [buttons_ count] ? NSMaxY([[buttons_ lastObject] frame])
: chrome_style::kClientBottomPadding; : chrome_style::kClientBottomPadding;
CGFloat availableMessageWidth = CGFloat availableMessageWidth = windowWidth -
windowWidth - chrome_style::GetCloseButtonSize() - kButtonGap; chrome_style::GetCloseButtonSize() -
kConstrainedWindowButtonGap;
curY = [self layoutLinkAtYPos:curY curY = [self layoutLinkAtYPos:curY
windowWidth:availableMessageWidth]; windowWidth:availableMessageWidth];
curY = [self layoutAccessoryViewAtYPos:curY]; curY = [self layoutAccessoryViewAtYPos:curY];
...@@ -208,7 +209,7 @@ const CGFloat kButtonGap = 6; ...@@ -208,7 +209,7 @@ const CGFloat kButtonGap = 6;
rect.origin.x = curX - NSWidth(rect); rect.origin.x = curX - NSWidth(rect);
rect.origin.y = chrome_style::kClientBottomPadding; rect.origin.y = chrome_style::kClientBottomPadding;
[button setFrameOrigin:rect.origin]; [button setFrameOrigin:rect.origin];
curX = NSMinX(rect) - kButtonGap; curX = NSMinX(rect) - kConstrainedWindowButtonGap;
} }
// Layout remaining buttons left to right. // Layout remaining buttons left to right.
...@@ -217,7 +218,7 @@ const CGFloat kButtonGap = 6; ...@@ -217,7 +218,7 @@ const CGFloat kButtonGap = 6;
NSButton* button = [buttons_ objectAtIndex:i]; NSButton* button = [buttons_ objectAtIndex:i];
[button setFrameOrigin: [button setFrameOrigin:
NSMakePoint(curX, chrome_style::kClientBottomPadding)]; NSMakePoint(curX, chrome_style::kClientBottomPadding)];
curX += NSMaxX([button frame]) + kButtonGap; curX += NSMaxX([button frame]) + kConstrainedWindowButtonGap;
} }
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
namespace { namespace {
// Length of the animation in seconds. // Length of the animation in seconds.
const NSTimeInterval kAnimationDuration = 0.18; const NSTimeInterval kSheetAnimationDuration = 0.18;
// If the machine has a DisplayLink device attached, the WindowServer has a // If the machine has a DisplayLink device attached, the WindowServer has a
// tendency to crash https://crbug.com/755516. To avoid this, probe the // tendency to crash https://crbug.com/755516. To avoid this, probe the
...@@ -68,7 +68,7 @@ bool HasDisplayLinkDevice() { ...@@ -68,7 +68,7 @@ bool HasDisplayLinkDevice() {
if (useSimpleAnimations_) { if (useSimpleAnimations_) {
[NSAnimationContext beginGrouping]; [NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:kAnimationDuration]; [[NSAnimationContext currentContext] setDuration:kSheetAnimationDuration];
[[customWindow_ animator] setAlphaValue:1.0]; [[customWindow_ animator] setAlphaValue:1.0];
[NSAnimationContext endGrouping]; [NSAnimationContext endGrouping];
} else { } else {
...@@ -87,7 +87,7 @@ bool HasDisplayLinkDevice() { ...@@ -87,7 +87,7 @@ bool HasDisplayLinkDevice() {
} ]; } ];
animation.reset( animation.reset(
[[NSViewAnimation alloc] initWithViewAnimations:animationArray]); [[NSViewAnimation alloc] initWithViewAnimations:animationArray]);
[animation setDuration:kAnimationDuration]; [animation setDuration:kSheetAnimationDuration];
[animation setAnimationBlockingMode:NSAnimationBlocking]; [animation setAnimationBlockingMode:NSAnimationBlocking];
} else { } else {
animation.reset([[ConstrainedWindowAnimationHide alloc] animation.reset([[ConstrainedWindowAnimationHide alloc]
......
...@@ -11,32 +11,33 @@ ...@@ -11,32 +11,33 @@
#include "chrome/grit/theme_resources.h" #include "chrome/grit/theme_resources.h"
// Distance from top border to icon. // Distance from top border to icon.
const CGFloat kImagePaddingTop = 7; const CGFloat kDownloadShowAllImagePaddingTop = 7;
// Distance from left border to icon. // Distance from left border to icon.
const CGFloat kImagePaddingLeft = 11; const CGFloat kDownloadShowAllImagePaddingLeft = 11;
// Width of icon. // Width of icon.
const CGFloat kImageWidth = 16; const CGFloat kDownloadShowAllImageWidth = 16;
// Height of icon. // Height of icon.
const CGFloat kImageHeight = 16; const CGFloat kDownloadShowAllImageHeight = 16;
// x distance between image and title. // x distance between image and title.
const CGFloat kImageTextPadding = 4; const CGFloat kDownloadShowAllImageTextPadding = 4;
// x coordinate of download name string, in view coords. // x coordinate of download name string, in view coords.
const CGFloat kTextPosLeft = const CGFloat kDownloadShowAllTextPosLeft = kDownloadShowAllImagePaddingLeft +
kImagePaddingLeft + kImageWidth + kImageTextPadding; kDownloadShowAllImageWidth +
kDownloadShowAllImageTextPadding;
// Distance from end of title to right border. // Distance from end of title to right border.
const CGFloat kTextPaddingRight = 13; const CGFloat kDownloadShowAllTextPaddingRight = 13;
// y coordinate of title, in view coords. // y coordinate of title, in view coords.
const CGFloat kTextPosTop = 10; const CGFloat kDownloadShowAllTextPosTop = 10;
// Width of outer stroke // Width of outer stroke
const CGFloat kOuterStrokeWidth = 1; const CGFloat kDownloadShowAllOuterStrokeWidth = 1;
@interface DownloadShowAllCell(Private) @interface DownloadShowAllCell(Private)
- (const ui::ThemeProvider*)backgroundThemeWrappingProvider: - (const ui::ThemeProvider*)backgroundThemeWrappingProvider:
...@@ -156,8 +157,9 @@ const CGFloat kOuterStrokeWidth = 1; ...@@ -156,8 +157,9 @@ const CGFloat kOuterStrokeWidth = 1;
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
// Draw title // Draw title
NSPoint primaryPos = NSMakePoint( NSPoint primaryPos =
cellFrame.origin.x + kTextPosLeft, kTextPosTop); NSMakePoint(cellFrame.origin.x + kDownloadShowAllTextPosLeft,
kDownloadShowAllTextPosTop);
[[self title] drawAtPoint:primaryPos withAttributes:[self textAttributes]]; [[self title] drawAtPoint:primaryPos withAttributes:[self textAttributes]];
// Draw icon // Draw icon
...@@ -170,10 +172,9 @@ const CGFloat kOuterStrokeWidth = 1; ...@@ -170,10 +172,9 @@ const CGFloat kOuterStrokeWidth = 1;
} }
- (NSRect)imageRectForBounds:(NSRect)cellFrame { - (NSRect)imageRectForBounds:(NSRect)cellFrame {
return NSMakeRect(cellFrame.origin.x + kImagePaddingLeft, return NSMakeRect(cellFrame.origin.x + kDownloadShowAllImagePaddingLeft,
cellFrame.origin.y + kImagePaddingTop, cellFrame.origin.y + kDownloadShowAllImagePaddingTop,
kImageWidth, kDownloadShowAllImageWidth, kDownloadShowAllImageHeight);
kImageHeight);
} }
- (NSSize)cellSize { - (NSSize)cellSize {
...@@ -181,8 +182,9 @@ const CGFloat kOuterStrokeWidth = 1; ...@@ -181,8 +182,9 @@ const CGFloat kOuterStrokeWidth = 1;
// Custom width: // Custom width:
NSSize textSize = [[self title] sizeWithAttributes:[self textAttributes]]; NSSize textSize = [[self title] sizeWithAttributes:[self textAttributes]];
size.width = kTextPosLeft + textSize.width + kTextPaddingRight + size.width = kDownloadShowAllTextPosLeft + textSize.width +
kOuterStrokeWidth * 2; kDownloadShowAllTextPaddingRight +
kDownloadShowAllOuterStrokeWidth * 2;
return size; return size;
} }
@end @end
...@@ -38,11 +38,11 @@ NSString* const kBrowserActionButtonDraggingNotification = ...@@ -38,11 +38,11 @@ NSString* const kBrowserActionButtonDraggingNotification =
NSString* const kBrowserActionButtonDragEndNotification = NSString* const kBrowserActionButtonDragEndNotification =
@"BrowserActionButtonDragEndNotification"; @"BrowserActionButtonDragEndNotification";
static const CGFloat kAnimationDuration = 0.2; static const CGFloat kBrowserActionButtonAnimationDuration = 0.2;
static const CGFloat kMinimumDragDistance = 5; static const CGFloat kBrowserActionButtonMinimumDragDistance = 5;
// Mirrors ui/views/mouse_constants.h for suppressing popup activation. // Mirrors ui/views/mouse_constants.h for suppressing popup activation.
static const int kMinimumMsBetweenCloseOpenPopup = 100; static const int kBrowserActionButtonMinimumMsBetweenCloseOpenPopup = 100;
@interface BrowserActionButton () @interface BrowserActionButton ()
- (void)endDrag; - (void)endDrag;
...@@ -69,7 +69,8 @@ class ToolbarActionViewDelegateBridge : public ToolbarActionViewDelegate { ...@@ -69,7 +69,8 @@ class ToolbarActionViewDelegateBridge : public ToolbarActionViewDelegate {
// If the user clicks on the browser action button to close the bubble, // If the user clicks on the browser action button to close the bubble,
// don't show the next popup too soon on the mouse button up. // don't show the next popup too soon on the mouse button up.
base::TimeDelta delta = base::TimeTicks::Now() - popup_closed_time_; base::TimeDelta delta = base::TimeTicks::Now() - popup_closed_time_;
return delta.InMilliseconds() >= kMinimumMsBetweenCloseOpenPopup; return delta.InMilliseconds() >=
kBrowserActionButtonMinimumMsBetweenCloseOpenPopup;
} }
private: private:
...@@ -234,7 +235,7 @@ void ToolbarActionViewDelegateBridge::DoShowContextMenu() { ...@@ -234,7 +235,7 @@ void ToolbarActionViewDelegateBridge::DoShowContextMenu() {
[self setShowsBorderOnlyWhileMouseInside:YES]; [self setShowsBorderOnlyWhileMouseInside:YES];
moveAnimation_.reset([[NSViewAnimation alloc] init]); moveAnimation_.reset([[NSViewAnimation alloc] init]);
[moveAnimation_ gtm_setDuration:kAnimationDuration [moveAnimation_ gtm_setDuration:kBrowserActionButtonAnimationDuration
eventMask:NSLeftMouseUpMask]; eventMask:NSLeftMouseUpMask];
[moveAnimation_ setAnimationBlockingMode:NSAnimationNonblocking]; [moveAnimation_ setAnimationBlockingMode:NSAnimationNonblocking];
...@@ -294,11 +295,13 @@ void ToolbarActionViewDelegateBridge::DoShowContextMenu() { ...@@ -294,11 +295,13 @@ void ToolbarActionViewDelegateBridge::DoShowContextMenu() {
NSPoint eventPoint = [theEvent locationInWindow]; NSPoint eventPoint = [theEvent locationInWindow];
if (!isBeingDragged_) { if (!isBeingDragged_) {
// Don't initiate a drag until it moves at least kMinimumDragDistance. // Don't initiate a drag until it moves at least
// kBrowserActionButtonMinimumDragDistance.
NSPoint dragStart = [self convertPoint:dragStartPoint_ toView:nil]; NSPoint dragStart = [self convertPoint:dragStartPoint_ toView:nil];
CGFloat dx = eventPoint.x - dragStart.x; CGFloat dx = eventPoint.x - dragStart.x;
CGFloat dy = eventPoint.y - dragStart.y; CGFloat dy = eventPoint.y - dragStart.y;
if (dx*dx + dy*dy < kMinimumDragDistance*kMinimumDragDistance) if (dx * dx + dy * dy < kBrowserActionButtonMinimumDragDistance *
kBrowserActionButtonMinimumDragDistance)
return; return;
// The start of a drag. Position the button above all others. // The start of a drag. Position the button above all others.
......
...@@ -32,7 +32,7 @@ const SkColor kPressedBackgroundColor = 0x1E000000; ...@@ -32,7 +32,7 @@ const SkColor kPressedBackgroundColor = 0x1E000000;
const SkColor kPressedDarkBackgroundColor = 0x3DFFFFFF; const SkColor kPressedDarkBackgroundColor = 0x3DFFFFFF;
// Amount of inset for the background frame. // Amount of inset for the background frame.
const CGFloat kBackgroundFrameYInset = 2.0; const CGFloat kDecorationBackgroundFrameYInset = 2.0;
} // namespace } // namespace
...@@ -186,7 +186,7 @@ CGFloat LocationBarDecoration::GetWidthForSpace(CGFloat width) { ...@@ -186,7 +186,7 @@ CGFloat LocationBarDecoration::GetWidthForSpace(CGFloat width) {
} }
NSRect LocationBarDecoration::GetBackgroundFrame(NSRect frame) { NSRect LocationBarDecoration::GetBackgroundFrame(NSRect frame) {
return NSInsetRect(frame, 0.0, kBackgroundFrameYInset); return NSInsetRect(frame, 0.0, kDecorationBackgroundFrameYInset);
} }
void LocationBarDecoration::UpdateAccessibilityView(NSRect apparent_frame) { void LocationBarDecoration::UpdateAccessibilityView(NSRect apparent_frame) {
......
...@@ -94,7 +94,7 @@ const CGFloat kLastPinnedTabSpacing = 2.0; ...@@ -94,7 +94,7 @@ const CGFloat kLastPinnedTabSpacing = 2.0;
// The amount by which the new tab button is offset (from the tabs). // The amount by which the new tab button is offset (from the tabs).
const CGFloat kNewTabButtonOffset = 10.0; const CGFloat kNewTabButtonOffset = 10.0;
const NSTimeInterval kAnimationDuration = 0.125; const NSTimeInterval kTabAnimationDuration = 0.125;
// Helper class for doing NSAnimationContext calls that takes a bool to disable // Helper class for doing NSAnimationContext calls that takes a bool to disable
// all the work. Useful for code that wants to conditionally animate. // all the work. Useful for code that wants to conditionally animate.
...@@ -412,7 +412,7 @@ NSRect FlipRectInView(NSView* view, NSRect rect) { ...@@ -412,7 +412,7 @@ NSRect FlipRectInView(NSView* view, NSRect rect) {
@synthesize trailingIndentForControls = trailingIndentForControls_; @synthesize trailingIndentForControls = trailingIndentForControls_;
+ (CGFloat)tabAnimationDuration { + (CGFloat)tabAnimationDuration {
return kAnimationDuration; return kTabAnimationDuration;
} }
- (id)initWithView:(TabStripView*)view - (id)initWithView:(TabStripView*)view
...@@ -948,7 +948,7 @@ contextMenuModelForController:(TabControllerCocoa*)controller ...@@ -948,7 +948,7 @@ contextMenuModelForController:(TabControllerCocoa*)controller
NSRect enclosingRect = NSZeroRect; NSRect enclosingRect = NSZeroRect;
ScopedNSAnimationContextGroup mainAnimationGroup(animate); ScopedNSAnimationContextGroup mainAnimationGroup(animate);
mainAnimationGroup.SetCurrentContextDuration(kAnimationDuration); mainAnimationGroup.SetCurrentContextDuration(kTabAnimationDuration);
// Update the current subviews and their z-order if requested. // Update the current subviews and their z-order if requested.
if (doUpdate) if (doUpdate)
...@@ -1168,7 +1168,7 @@ contextMenuModelForController:(TabControllerCocoa*)controller ...@@ -1168,7 +1168,7 @@ contextMenuModelForController:(TabControllerCocoa*)controller
// display the wrong content when using a theme that creates transparent // display the wrong content when using a theme that creates transparent
// tabs. // tabs.
ScopedNSAnimationContextGroup subAnimationGroup(animate); ScopedNSAnimationContextGroup subAnimationGroup(animate);
subAnimationGroup.SetCurrentContextDuration(kAnimationDuration); subAnimationGroup.SetCurrentContextDuration(kTabAnimationDuration);
NSView* tabView = [tab view]; NSView* tabView = [tab view];
[[NSAnimationContext currentContext] setCompletionHandler:^{ [[NSAnimationContext currentContext] setCompletionHandler:^{
[tabView setNeedsDisplay:YES]; [tabView setNeedsDisplay:YES];
...@@ -1513,7 +1513,7 @@ contextMenuModelForController:(TabControllerCocoa*)controller ...@@ -1513,7 +1513,7 @@ contextMenuModelForController:(TabControllerCocoa*)controller
NSRect newFrame = [tabView frame]; NSRect newFrame = [tabView frame];
newFrame = NSOffsetRect(newFrame, 0, -newFrame.size.height); newFrame = NSOffsetRect(newFrame, 0, -newFrame.size.height);
ScopedNSAnimationContextGroup animationGroup(true); ScopedNSAnimationContextGroup animationGroup(true);
animationGroup.SetCurrentContextDuration(kAnimationDuration); animationGroup.SetCurrentContextDuration(kTabAnimationDuration);
[[tabView animator] setFrame:newFrame]; [[tabView animator] setFrame:newFrame];
} }
......
...@@ -88,7 +88,8 @@ const CGFloat kRapidCloseDist = 2.5; ...@@ -88,7 +88,8 @@ const CGFloat kRapidCloseDist = 2.5;
+ (void)setTabEdgeStrokeColor; + (void)setTabEdgeStrokeColor;
@end @end
extern NSString* const _Nonnull NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification; extern NSString* const
NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification;
namespace { namespace {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment