Chromium Code Reviews| Index: chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm |
| diff --git a/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm b/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm |
| index 7bdd563e1a2d4fc05c0886bf054690ea4f26ae8e..c81dbb46b30709f5bb3e14210feb0dffb95e719a 100644 |
| --- a/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm |
| +++ b/chrome/browser/ui/cocoa/location_bar/bubble_decoration.mm |
| @@ -19,9 +19,15 @@ const CGFloat kRightSideMargin = 1.0; |
| // Padding between the icon/label and bubble edges. |
| CGFloat BubblePadding() { |
| - return ui::MaterialDesignController::IsModeMaterial() ? 7 : 3; |
| + return ui::MaterialDesignController::IsModeMaterial() ? 8.0 : 3.0; |
| } |
| +// Additional padding between the divider between the omnibox text and the |
| +// divider. The desired value is 8px. We get 3px by subtracting the existing |
| +// padding in location_bar_view from 8px. |
| +CGFloat DividerPadding() { |
| + return ui::MaterialDesignController::IsModeMaterial() ? 3.0 : 0.0; |
| +} |
| // Padding between the icon and label. |
| const CGFloat kIconLabelPadding = 4.0; |
| @@ -54,7 +60,8 @@ CGFloat BubbleDecoration::GetWidthForImageAndLabel(NSImage* image, |
| // underestimate, so floor() seems to work better. |
| const CGFloat label_width = |
| std::floor([label sizeWithAttributes:attributes_].width); |
| - return BubblePadding() + image_width + kIconLabelPadding + label_width; |
| + return BubblePadding() + image_width + kIconLabelPadding + label_width + |
| + DividerPadding(); |
| } |
| NSRect BubbleDecoration::GetImageRectInFrame(NSRect frame) { |
| @@ -100,6 +107,24 @@ void BubbleDecoration::DrawInFrame(NSRect frame, NSView* control_view) { |
| textOffset = NSMaxX(imageRect) + kIconLabelPadding; |
| } |
| + // Draw the divider and set the text color. |
| + if (ui::MaterialDesignController::IsModeMaterial()) { |
| + NSBezierPath* line = [NSBezierPath bezierPath]; |
| + [line setLineWidth:0]; |
|
shrike
2016/05/19 17:57:11
Change the line width to 1 - we actually want a 1p
spqchan
2016/05/19 23:05:34
Done.
|
| + [line moveToPoint:NSMakePoint(NSMaxX(decoration_frame) - DividerPadding(), |
| + NSMinY(decoration_frame))]; |
| + [line lineToPoint:NSMakePoint(NSMaxX(decoration_frame) - DividerPadding(), |
| + NSMaxY(decoration_frame))]; |
| + |
| + bool in_dark_mode = [[control_view window] inIncognitoModeWithSystemTheme]; |
| + [GetDividerColor(in_dark_mode) set]; |
| + [line stroke]; |
| + |
| + NSColor* text_color = |
| + in_dark_mode ? [NSColor whiteColor] : GetBackgroundBorderColor(); |
| + SetTextColor(text_color); |
| + } |
| + |
| if (label_) { |
| NSRect textRect = frame; |
| textRect.origin.x = textOffset; |
| @@ -114,22 +139,7 @@ void BubbleDecoration::DrawWithBackgroundInFrame(NSRect background_frame, |
| NSView* control_view) { |
| NSRect rect = NSInsetRect(background_frame, 0, 1); |
| rect.size.width -= kRightSideMargin; |
| - if (ui::MaterialDesignController::IsModeMaterial()) { |
| - CGFloat lineWidth = [control_view cr_lineWidth]; |
| - rect = NSInsetRect(rect, lineWidth / 2., lineWidth / 2.); |
| - NSBezierPath* path = [NSBezierPath bezierPathWithRoundedRect:rect |
| - xRadius:3 |
| - yRadius:3]; |
| - [path setLineWidth:lineWidth]; |
| - bool inDarkMode = [[control_view window] inIncognitoModeWithSystemTheme]; |
| - if (inDarkMode) { |
| - [[NSColor whiteColor] set]; |
| - [path fill]; |
| - } else { |
| - [GetBackgroundBorderColor() set]; |
| - [path stroke]; |
| - } |
| - } else { |
| + if (!ui::MaterialDesignController::IsModeMaterial()) { |
| ui::DrawNinePartImage( |
| rect, GetBubbleImageIds(), NSCompositeSourceOver, 1.0, true); |
| } |