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;
const int kHierarchyButtonLeadingPadding = 11;
const int kIconTextSpacer = 4;
const int kTrailingPadding = 4;
const int kTrailingCellPadding = 4;
const int kIconLeadingPadding = 4;
const int kDefaultFontSize = 12;
......@@ -133,9 +133,10 @@ const CGFloat kKernAmount = 0.2;
NSKernAttributeName : @(kKernAmount),
NSFontAttributeName : [self fontForBookmarkBarCell],
}];
width += kIconTextSpacer + std::ceil(titleSize.width) + kTrailingPadding;
width +=
kIconTextSpacer + std::ceil(titleSize.width) + kTrailingCellPadding;
} else {
width += kTrailingPadding;
width += kTrailingCellPadding;
}
return width;
}
......@@ -383,7 +384,8 @@ const CGFloat kKernAmount = 0.2;
if ([title length] > 0) {
CGFloat textWidth =
[title sizeWithAttributes:[self titleTextAttributes]].width;
cellSize.width += kIconTextSpacer + std::ceil(textWidth) + kTrailingPadding;
cellSize.width +=
kIconTextSpacer + std::ceil(textWidth) + kTrailingCellPadding;
} else {
cellSize.width += kIconLeadingPadding;
}
......@@ -415,7 +417,8 @@ const CGFloat kKernAmount = 0.2;
? NSWidth(theRect) - NSMinX(imageRect) // Un-flip
: NSMaxX(imageRect);
textRect.origin.x = imageEnd + kIconTextSpacer;
textRect.size.width = NSWidth(theRect) - NSMinX(textRect) - kTrailingPadding;
textRect.size.width =
NSWidth(theRect) - NSMinX(textRect) - kTrailingCellPadding;
if (drawFolderArrow_)
textRect.size.width -=
[arrowImage_ size].width + kHierarchyButtonTrailingPadding;
......
......@@ -51,7 +51,7 @@ namespace {
NSTimeInterval gAutoCloseDelay = 1.5;
// The height of the window.
const CGFloat kWindowHeight = 29.0;
const CGFloat kZoomBubbleWindowHeight = 29.0;
// Width of the zoom in and zoom out buttons.
const CGFloat kZoomInOutButtonWidth = 44.0;
......@@ -216,7 +216,8 @@ void SetZoomBubbleAutoCloseDelayForTesting(NSTimeInterval time_interval) {
NSButton* zoomOutButton = [self addButtonWithTitleID:IDS_ZOOM_MINUS2
fontSize:kZoomInOutButtonFontSize
action:@selector(zoomOut:)];
NSRect rect = NSMakeRect(0, 0, kZoomInOutButtonWidth, kWindowHeight);
NSRect rect =
NSMakeRect(0, 0, kZoomInOutButtonWidth, kZoomBubbleWindowHeight);
[zoomOutButton setFrame:rect];
// Zoom label.
......
......@@ -19,18 +19,18 @@
namespace {
const SkColor kTextColor = SkColorSetRGB(0x66, 0x66, 0x66);
const SkColor kPromoTextColor = SkColorSetRGB(0x66, 0x66, 0x66);
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).
const CGFloat kVerticalPadding = 15;
const CGFloat kPromoVerticalPadding = 15;
// Width of the border (dp).
const CGFloat kBorderWidth = 1.0;
const CGFloat kPromoBorderWidth = 1.0;
// Font size of the promo text (pt).
const int kFontSize = 11;
const int kPromoFontSize = 11;
} // namespace
......@@ -50,16 +50,17 @@ const int kFontSize = 11;
}
- (CGFloat)borderWidth {
return kBorderWidth;
return kPromoBorderWidth;
}
- (CGFloat)preferredHeightForWidth:(CGFloat)width {
CGFloat availableWidth =
width - (2 * chrome_style::kHorizontalPadding) - (2 * kBorderWidth);
width - (2 * chrome_style::kHorizontalPadding) - (2 * kPromoBorderWidth);
NSRect frame = [[textView_ textStorage]
boundingRectWithSize:NSMakeSize(availableWidth, 0.0)
options:NSStringDrawingUsesLineFragmentOrigin];
return frame.size.height + (2 * kVerticalPadding) + (2 * kBorderWidth);
return frame.size.height + (2 * kPromoVerticalPadding) +
(2 * kPromoBorderWidth);
}
- (void)loadView {
......@@ -68,10 +69,10 @@ const int kFontSize = 11;
[promoView
setFillColor:skia::SkColorToDeviceNSColor(kPromoViewBackgroundColor)];
[promoView setContentViewMargins:NSMakeSize(chrome_style::kHorizontalPadding,
kVerticalPadding)];
kPromoVerticalPadding)];
[promoView setBorderType:NSLineBorder];
[promoView setBorderWidth:kBorderWidth];
[promoView setBorderColor:skia::SkColorToDeviceNSColor(kBorderColor)];
[promoView setBorderWidth:kPromoBorderWidth];
[promoView setBorderColor:skia::SkColorToDeviceNSColor(kPromoBorderColor)];
// Add the sync promo text.
size_t offset;
......@@ -80,14 +81,14 @@ const int kFontSize = 11;
l10n_util::GetStringFUTF16(promoStringId_, linkText, &offset);
NSString* nsPromoText = base::SysUTF16ToNSString(promoText);
NSString* nsLinkText = base::SysUTF16ToNSString(linkText);
NSFont* font = [NSFont labelFontOfSize:kFontSize];
NSFont* font = [NSFont labelFontOfSize:kPromoFontSize];
NSColor* linkColor = skia::SkColorToCalibratedNSColor(
chrome_style::GetLinkColor());
textView_.reset([[HyperlinkTextView alloc] init]);
[textView_ setMessage:nsPromoText
withFont:font
messageColor:skia::SkColorToDeviceNSColor(kTextColor)];
messageColor:skia::SkColorToDeviceNSColor(kPromoTextColor)];
[textView_ addLinkRange:NSMakeRange(offset, [nsLinkText length])
withURL:nil
linkColor:linkColor];
......
......@@ -17,8 +17,8 @@
namespace {
const CGFloat kWindowMinWidth = 500;
const CGFloat kButtonGap = 6;
const CGFloat kConstrainedWindowMinWidth = 500;
const CGFloat kConstrainedWindowButtonGap = 6;
} // namespace
......@@ -163,21 +163,22 @@ const CGFloat kButtonGap = 6;
buttonWidth += size.width;
}
if ([buttons_ count])
buttonWidth += ([buttons_ count] - 1) * kButtonGap;
buttonWidth += ([buttons_ count] - 1) * kConstrainedWindowButtonGap;
// Window width.
CGFloat windowWidth = buttonWidth;
if (accessoryView_.get())
windowWidth = std::max(windowWidth, NSWidth([accessoryView_ frame]));
windowWidth += chrome_style::kHorizontalPadding * 2;
windowWidth = std::max(windowWidth, kWindowMinWidth);
windowWidth = std::max(windowWidth, kConstrainedWindowMinWidth);
// Layout controls.
[self layoutButtonsWithWindowWidth:windowWidth];
CGFloat curY = [buttons_ count] ? NSMaxY([[buttons_ lastObject] frame])
: chrome_style::kClientBottomPadding;
CGFloat availableMessageWidth =
windowWidth - chrome_style::GetCloseButtonSize() - kButtonGap;
CGFloat availableMessageWidth = windowWidth -
chrome_style::GetCloseButtonSize() -
kConstrainedWindowButtonGap;
curY = [self layoutLinkAtYPos:curY
windowWidth:availableMessageWidth];
curY = [self layoutAccessoryViewAtYPos:curY];
......@@ -208,7 +209,7 @@ const CGFloat kButtonGap = 6;
rect.origin.x = curX - NSWidth(rect);
rect.origin.y = chrome_style::kClientBottomPadding;
[button setFrameOrigin:rect.origin];
curX = NSMinX(rect) - kButtonGap;
curX = NSMinX(rect) - kConstrainedWindowButtonGap;
}
// Layout remaining buttons left to right.
......@@ -217,7 +218,7 @@ const CGFloat kButtonGap = 6;
NSButton* button = [buttons_ objectAtIndex:i];
[button setFrameOrigin:
NSMakePoint(curX, chrome_style::kClientBottomPadding)];
curX += NSMaxX([button frame]) + kButtonGap;
curX += NSMaxX([button frame]) + kConstrainedWindowButtonGap;
}
}
......
......@@ -14,7 +14,7 @@
namespace {
// 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
// tendency to crash https://crbug.com/755516. To avoid this, probe the
......@@ -68,7 +68,7 @@ bool HasDisplayLinkDevice() {
if (useSimpleAnimations_) {
[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:kAnimationDuration];
[[NSAnimationContext currentContext] setDuration:kSheetAnimationDuration];
[[customWindow_ animator] setAlphaValue:1.0];
[NSAnimationContext endGrouping];
} else {
......@@ -87,7 +87,7 @@ bool HasDisplayLinkDevice() {
} ];
animation.reset(
[[NSViewAnimation alloc] initWithViewAnimations:animationArray]);
[animation setDuration:kAnimationDuration];
[animation setDuration:kSheetAnimationDuration];
[animation setAnimationBlockingMode:NSAnimationBlocking];
} else {
animation.reset([[ConstrainedWindowAnimationHide alloc]
......
......@@ -25,60 +25,61 @@
#include "ui/native_theme/native_theme.h"
// Distance from top border to icon.
const CGFloat kImagePaddingTop = 7;
const CGFloat kDownloadItemImagePaddingTop = 7;
// Distance from left border to icon.
const CGFloat kImagePaddingLeft = 9;
const CGFloat kDownloadItemImagePaddingLeft = 9;
// Horizontal distance from the icon to the text.
const CGFloat kImagePaddingRight = 7;
const CGFloat kDownloadItemImagePaddingRight = 7;
// Width of icon.
const CGFloat kImageWidth = 16;
const CGFloat kDownloadItemImageWidth = 16;
// Height of icon.
const CGFloat kImageHeight = 16;
const CGFloat kDownloadItemImageHeight = 16;
// x coordinate of download name string, in view coords.
const CGFloat kTextPosLeft = kImagePaddingLeft +
kImageWidth + DownloadShelf::kFiletypeIconOffset + kImagePaddingRight;
const CGFloat kDownloadItemTextPosLeft =
kDownloadItemImagePaddingLeft + kDownloadItemImageWidth +
DownloadShelf::kFiletypeIconOffset + kDownloadItemImagePaddingRight;
// Distance from end of download name string to dropdown area.
const CGFloat kTextPaddingRight = 3;
const CGFloat kDownloadItemTextPaddingRight = 3;
// y coordinate of download name string, in view coords, when status message
// is visible.
const CGFloat kPrimaryTextPosTop = 3;
const CGFloat kDownloadItemPrimaryTextPosTop = 3;
// y coordinate of download name string, in view coords, when status message
// is not visible.
const CGFloat kPrimaryTextOnlyPosTop = 10;
const CGFloat kDownloadItemPrimaryTextOnlyPosTop = 10;
// y coordinate of status message, in view coords.
const CGFloat kSecondaryTextPosTop = 18;
const CGFloat kDownloadItemSecondaryTextPosTop = 18;
// Width of dropdown area on the right (includes 1px for the border on each
// side).
const CGFloat kDropdownAreaWidth = 14;
const CGFloat kDownloadItemDropdownAreaWidth = 14;
// Width of dropdown arrow.
const CGFloat kDropdownArrowWidth = 5;
const CGFloat kDownloadItemDropdownArrowWidth = 5;
// Height of dropdown arrow.
const CGFloat kDropdownArrowHeight = 3;
const CGFloat kDownloadItemDropdownArrowHeight = 3;
// Vertical displacement of dropdown area, relative to the "centered" position.
const CGFloat kDropdownAreaY = -2;
const CGFloat kDownloadItemDropdownAreaY = -2;
// Duration of the two-lines-to-one-line animation, in seconds.
NSTimeInterval kShowStatusDuration = 0.3;
NSTimeInterval kHideStatusDuration = 0.3;
NSTimeInterval kDownloadItemShowStatusDuration = 0.3;
NSTimeInterval kDownloadItemHideStatusDuration = 0.3;
// Duration of the 'download complete' animation, in seconds.
const CGFloat kCompleteAnimationDuration = 2.5;
const CGFloat kDownloadItemCompleteAnimationDuration = 2.5;
// Duration of the 'download interrupted' animation, in seconds.
const CGFloat kInterruptedAnimationDuration = 2.5;
const CGFloat kDownloadItemInterruptedAnimationDuration = 2.5;
using download::DownloadItem;
......@@ -134,7 +135,7 @@ using download::DownloadItem;
- (void)setInitialState {
isStatusTextVisible_ = NO;
titleY_ = kPrimaryTextOnlyPosTop;
titleY_ = kDownloadItemPrimaryTextOnlyPosTop;
statusAlpha_ = 0.0;
[self setFont:[NSFont systemFontOfSize:
......@@ -211,7 +212,7 @@ using download::DownloadItem;
break;
completionAnimation_.reset([[DownloadItemCellAnimation alloc]
initWithDownloadItemCell:self
duration:kCompleteAnimationDuration
duration:kDownloadItemCompleteAnimationDuration
animationCurve:NSAnimationLinear]);
[completionAnimation_.get() setDelegate:self];
[completionAnimation_.get() startAnimation];
......@@ -231,7 +232,7 @@ using download::DownloadItem;
break;
completionAnimation_.reset([[DownloadItemCellAnimation alloc]
initWithDownloadItemCell:self
duration:kInterruptedAnimationDuration
duration:kDownloadItemInterruptedAnimationDuration
animationCurve:NSAnimationLinear]);
[completionAnimation_.get() setDelegate:self];
[completionAnimation_.get() startAnimation];
......@@ -278,7 +279,7 @@ using download::DownloadItem;
NSRect bounds = [[self controlView] bounds];
NSRect buttonRect, dropdownRect;
NSDivideRect(bounds, &dropdownRect, &buttonRect,
kDropdownAreaWidth, NSMaxXEdge);
kDownloadItemDropdownAreaWidth, NSMaxXEdge);
trackingAreaButton_.reset([[NSTrackingArea alloc]
initWithRect:buttonRect
......@@ -416,8 +417,9 @@ using download::DownloadItem;
if (![self secondaryTitle] || statusAlpha_ <= 0)
return;
CGFloat textWidth = NSWidth(innerFrame) -
(kTextPosLeft + kTextPaddingRight + kDropdownAreaWidth);
CGFloat textWidth = NSWidth(innerFrame) - (kDownloadItemTextPosLeft +
kDownloadItemTextPaddingRight +
kDownloadItemDropdownAreaWidth);
NSString* secondaryText = [self elideStatus:textWidth];
NSColor* secondaryColor =
[self titleColorForPart:kDownloadItemMouseOverButtonPart];
......@@ -433,7 +435,8 @@ using download::DownloadItem;
[self secondaryFont], NSFontAttributeName,
nil];
NSPoint secondaryPos =
NSMakePoint(innerFrame.origin.x + kTextPosLeft, kSecondaryTextPosTop);
NSMakePoint(innerFrame.origin.x + kDownloadItemTextPosLeft,
kDownloadItemSecondaryTextPosTop);
gfx::ScopedNSGraphicsContextSaveGState contextSave;
NSGraphicsContext* nsContext = [NSGraphicsContext currentContext];
......@@ -478,7 +481,7 @@ using download::DownloadItem;
NSRect buttonDrawRect, dropdownDrawRect;
NSDivideRect(drawFrame, &dropdownDrawRect, &buttonDrawRect,
kDropdownAreaWidth, NSMaxXEdge);
kDownloadItemDropdownAreaWidth, NSMaxXEdge);
NSBezierPath* buttonInnerPath = [self
leftRoundedPath:radius inRect:buttonDrawRect];
......@@ -524,8 +527,9 @@ using download::DownloadItem;
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
// Draw title
CGFloat textWidth = NSWidth(cellFrame) -
(kTextPosLeft + kTextPaddingRight + kDropdownAreaWidth);
CGFloat textWidth = NSWidth(cellFrame) - (kDownloadItemTextPosLeft +
kDownloadItemTextPaddingRight +
kDownloadItemDropdownAreaWidth);
[self setTitle:[self elideTitle:textWidth]];
NSColor* color = [self titleColorForPart:kDownloadItemMouseOverButtonPart];
......@@ -536,9 +540,8 @@ using download::DownloadItem;
color, NSForegroundColorAttributeName,
[self font], NSFontAttributeName,
nil];
NSPoint primaryPos = NSMakePoint(
cellFrame.origin.x + kTextPosLeft,
titleY_);
NSPoint primaryPos =
NSMakePoint(cellFrame.origin.x + kDownloadItemTextPosLeft, titleY_);
[primaryText drawAtPoint:primaryPos withAttributes:primaryTextAttributes];
......@@ -595,7 +598,7 @@ using download::DownloadItem;
hints:nil];
// Separator between button and popup parts
CGFloat lx = NSMaxX(cellFrame) - kDropdownAreaWidth + 0.5;
CGFloat lx = NSMaxX(cellFrame) - kDownloadItemDropdownAreaWidth + 0.5;
[[NSColor colorWithDeviceWhite:0.0 alpha:0.1] set];
[NSBezierPath strokeLineFromPoint:NSMakePoint(lx, NSMinY(cellFrame) + 1)
toPoint:NSMakePoint(lx, NSMaxY(cellFrame) - 1)];
......@@ -605,13 +608,16 @@ using download::DownloadItem;
// Popup arrow. Put center of mass of the arrow in the center of the
// dropdown area.
CGFloat cx = NSMaxX(cellFrame) - kDropdownAreaWidth/2 + 0.5;
CGFloat cx = NSMaxX(cellFrame) - kDownloadItemDropdownAreaWidth / 2 + 0.5;
CGFloat cy = NSMidY(cellFrame);
NSPoint p1 = NSMakePoint(cx - kDropdownArrowWidth/2,
cy - kDropdownArrowHeight/3 + kDropdownAreaY);
NSPoint p2 = NSMakePoint(cx + kDropdownArrowWidth/2,
cy - kDropdownArrowHeight/3 + kDropdownAreaY);
NSPoint p3 = NSMakePoint(cx, cy + kDropdownArrowHeight*2/3 + kDropdownAreaY);
NSPoint p1 = NSMakePoint(
cx - kDownloadItemDropdownArrowWidth / 2,
cy - kDownloadItemDropdownArrowHeight / 3 + kDownloadItemDropdownAreaY);
NSPoint p2 = NSMakePoint(
cx + kDownloadItemDropdownArrowWidth / 2,
cy - kDownloadItemDropdownArrowHeight / 3 + kDownloadItemDropdownAreaY);
NSPoint p3 = NSMakePoint(cx, cy + kDownloadItemDropdownArrowHeight * 2 / 3 +
kDownloadItemDropdownAreaY);
NSBezierPath *triangle = [NSBezierPath bezierPath];
[triangle moveToPoint:p1];
[triangle lineToPoint:p2];
......@@ -633,10 +639,9 @@ using download::DownloadItem;
}
- (NSRect)imageRectForBounds:(NSRect)cellFrame {
return NSMakeRect(cellFrame.origin.x + kImagePaddingLeft,
cellFrame.origin.y + kImagePaddingTop,
kImageWidth,
kImageHeight);
return NSMakeRect(cellFrame.origin.x + kDownloadItemImagePaddingLeft,
cellFrame.origin.y + kDownloadItemImagePaddingTop,
kDownloadItemImageWidth, kDownloadItemImageHeight);
}
- (void)setupToggleStatusVisibilityAnimation {
......@@ -651,7 +656,7 @@ using download::DownloadItem;
// Don't use core animation -- text in CA layers is not subpixel antialiased
toggleStatusVisibilityAnimation_.reset([[DownloadItemCellAnimation alloc]
initWithDownloadItemCell:self
duration:kShowStatusDuration
duration:kDownloadItemShowStatusDuration
animationCurve:NSAnimationEaseIn]);
[toggleStatusVisibilityAnimation_.get() setDelegate:self];
[toggleStatusVisibilityAnimation_.get() startAnimation];
......@@ -680,11 +685,12 @@ using download::DownloadItem;
progressed:(NSAnimationProgress)progress {
if (animation == toggleStatusVisibilityAnimation_) {
if (isStatusTextVisible_) {
titleY_ = (1 - progress)*kPrimaryTextOnlyPosTop + kPrimaryTextPosTop;
titleY_ = (1 - progress) * kDownloadItemPrimaryTextOnlyPosTop +
kDownloadItemPrimaryTextPosTop;
statusAlpha_ = progress;
} else {
titleY_ = progress*kPrimaryTextOnlyPosTop +
(1 - progress)*kPrimaryTextPosTop;
titleY_ = progress * kDownloadItemPrimaryTextOnlyPosTop +
(1 - progress) * kDownloadItemPrimaryTextPosTop;
statusAlpha_ = 1 - progress;
}
[[self controlView] setNeedsDisplay:YES];
......
......@@ -11,32 +11,33 @@
#include "chrome/grit/theme_resources.h"
// Distance from top border to icon.
const CGFloat kImagePaddingTop = 7;
const CGFloat kDownloadShowAllImagePaddingTop = 7;
// Distance from left border to icon.
const CGFloat kImagePaddingLeft = 11;
const CGFloat kDownloadShowAllImagePaddingLeft = 11;
// Width of icon.
const CGFloat kImageWidth = 16;
const CGFloat kDownloadShowAllImageWidth = 16;
// Height of icon.
const CGFloat kImageHeight = 16;
const CGFloat kDownloadShowAllImageHeight = 16;
// x distance between image and title.
const CGFloat kImageTextPadding = 4;
const CGFloat kDownloadShowAllImageTextPadding = 4;
// x coordinate of download name string, in view coords.
const CGFloat kTextPosLeft =
kImagePaddingLeft + kImageWidth + kImageTextPadding;
const CGFloat kDownloadShowAllTextPosLeft = kDownloadShowAllImagePaddingLeft +
kDownloadShowAllImageWidth +
kDownloadShowAllImageTextPadding;
// Distance from end of title to right border.
const CGFloat kTextPaddingRight = 13;
const CGFloat kDownloadShowAllTextPaddingRight = 13;
// y coordinate of title, in view coords.
const CGFloat kTextPosTop = 10;
const CGFloat kDownloadShowAllTextPosTop = 10;
// Width of outer stroke
const CGFloat kOuterStrokeWidth = 1;
const CGFloat kDownloadShowAllOuterStrokeWidth = 1;
@interface DownloadShowAllCell(Private)
- (const ui::ThemeProvider*)backgroundThemeWrappingProvider:
......@@ -156,8 +157,9 @@ const CGFloat kOuterStrokeWidth = 1;
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView {
// Draw title
NSPoint primaryPos = NSMakePoint(
cellFrame.origin.x + kTextPosLeft, kTextPosTop);
NSPoint primaryPos =
NSMakePoint(cellFrame.origin.x + kDownloadShowAllTextPosLeft,
kDownloadShowAllTextPosTop);
[[self title] drawAtPoint:primaryPos withAttributes:[self textAttributes]];
// Draw icon
......@@ -170,10 +172,9 @@ const CGFloat kOuterStrokeWidth = 1;
}
- (NSRect)imageRectForBounds:(NSRect)cellFrame {
return NSMakeRect(cellFrame.origin.x + kImagePaddingLeft,
cellFrame.origin.y + kImagePaddingTop,
kImageWidth,
kImageHeight);
return NSMakeRect(cellFrame.origin.x + kDownloadShowAllImagePaddingLeft,
cellFrame.origin.y + kDownloadShowAllImagePaddingTop,
kDownloadShowAllImageWidth, kDownloadShowAllImageHeight);
}
- (NSSize)cellSize {
......@@ -181,8 +182,9 @@ const CGFloat kOuterStrokeWidth = 1;
// Custom width:
NSSize textSize = [[self title] sizeWithAttributes:[self textAttributes]];
size.width = kTextPosLeft + textSize.width + kTextPaddingRight +
kOuterStrokeWidth * 2;
size.width = kDownloadShowAllTextPosLeft + textSize.width +
kDownloadShowAllTextPaddingRight +
kDownloadShowAllOuterStrokeWidth * 2;
return size;
}
@end
......@@ -38,11 +38,11 @@ NSString* const kBrowserActionButtonDraggingNotification =
NSString* const kBrowserActionButtonDragEndNotification =
@"BrowserActionButtonDragEndNotification";
static const CGFloat kAnimationDuration = 0.2;
static const CGFloat kMinimumDragDistance = 5;
static const CGFloat kBrowserActionButtonAnimationDuration = 0.2;
static const CGFloat kBrowserActionButtonMinimumDragDistance = 5;
// Mirrors ui/views/mouse_constants.h for suppressing popup activation.
static const int kMinimumMsBetweenCloseOpenPopup = 100;
static const int kBrowserActionButtonMinimumMsBetweenCloseOpenPopup = 100;
@interface BrowserActionButton ()
- (void)endDrag;
......@@ -69,7 +69,8 @@ class ToolbarActionViewDelegateBridge : public ToolbarActionViewDelegate {
// 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.
base::TimeDelta delta = base::TimeTicks::Now() - popup_closed_time_;
return delta.InMilliseconds() >= kMinimumMsBetweenCloseOpenPopup;
return delta.InMilliseconds() >=
kBrowserActionButtonMinimumMsBetweenCloseOpenPopup;
}
private:
......@@ -234,7 +235,7 @@ void ToolbarActionViewDelegateBridge::DoShowContextMenu() {
[self setShowsBorderOnlyWhileMouseInside:YES];
moveAnimation_.reset([[NSViewAnimation alloc] init]);
[moveAnimation_ gtm_setDuration:kAnimationDuration
[moveAnimation_ gtm_setDuration:kBrowserActionButtonAnimationDuration
eventMask:NSLeftMouseUpMask];
[moveAnimation_ setAnimationBlockingMode:NSAnimationNonblocking];
......@@ -294,11 +295,13 @@ void ToolbarActionViewDelegateBridge::DoShowContextMenu() {
NSPoint eventPoint = [theEvent locationInWindow];
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];
CGFloat dx = eventPoint.x - dragStart.x;
CGFloat dy = eventPoint.y - dragStart.y;
if (dx*dx + dy*dy < kMinimumDragDistance*kMinimumDragDistance)
if (dx * dx + dy * dy < kBrowserActionButtonMinimumDragDistance *
kBrowserActionButtonMinimumDragDistance)
return;
// The start of a drag. Position the button above all others.
......
......@@ -32,7 +32,7 @@ const SkColor kPressedBackgroundColor = 0x1E000000;
const SkColor kPressedDarkBackgroundColor = 0x3DFFFFFF;
// Amount of inset for the background frame.
const CGFloat kBackgroundFrameYInset = 2.0;
const CGFloat kDecorationBackgroundFrameYInset = 2.0;
} // namespace
......@@ -186,7 +186,7 @@ CGFloat LocationBarDecoration::GetWidthForSpace(CGFloat width) {
}
NSRect LocationBarDecoration::GetBackgroundFrame(NSRect frame) {
return NSInsetRect(frame, 0.0, kBackgroundFrameYInset);
return NSInsetRect(frame, 0.0, kDecorationBackgroundFrameYInset);
}
void LocationBarDecoration::UpdateAccessibilityView(NSRect apparent_frame) {
......
......@@ -94,7 +94,7 @@ const CGFloat kLastPinnedTabSpacing = 2.0;
// The amount by which the new tab button is offset (from the tabs).
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
// all the work. Useful for code that wants to conditionally animate.
......@@ -412,7 +412,7 @@ NSRect FlipRectInView(NSView* view, NSRect rect) {
@synthesize trailingIndentForControls = trailingIndentForControls_;
+ (CGFloat)tabAnimationDuration {
return kAnimationDuration;
return kTabAnimationDuration;
}
- (id)initWithView:(TabStripView*)view
......@@ -948,7 +948,7 @@ contextMenuModelForController:(TabControllerCocoa*)controller
NSRect enclosingRect = NSZeroRect;
ScopedNSAnimationContextGroup mainAnimationGroup(animate);
mainAnimationGroup.SetCurrentContextDuration(kAnimationDuration);
mainAnimationGroup.SetCurrentContextDuration(kTabAnimationDuration);
// Update the current subviews and their z-order if requested.
if (doUpdate)
......@@ -1168,7 +1168,7 @@ contextMenuModelForController:(TabControllerCocoa*)controller
// display the wrong content when using a theme that creates transparent
// tabs.
ScopedNSAnimationContextGroup subAnimationGroup(animate);
subAnimationGroup.SetCurrentContextDuration(kAnimationDuration);
subAnimationGroup.SetCurrentContextDuration(kTabAnimationDuration);
NSView* tabView = [tab view];
[[NSAnimationContext currentContext] setCompletionHandler:^{
[tabView setNeedsDisplay:YES];
......@@ -1513,7 +1513,7 @@ contextMenuModelForController:(TabControllerCocoa*)controller
NSRect newFrame = [tabView frame];
newFrame = NSOffsetRect(newFrame, 0, -newFrame.size.height);
ScopedNSAnimationContextGroup animationGroup(true);
animationGroup.SetCurrentContextDuration(kAnimationDuration);
animationGroup.SetCurrentContextDuration(kTabAnimationDuration);
[[tabView animator] setFrame:newFrame];
}
......
......@@ -88,7 +88,8 @@ const CGFloat kRapidCloseDist = 2.5;
+ (void)setTabEdgeStrokeColor;
@end
extern NSString* const _Nonnull NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification;
extern NSString* const
NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification;
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