Commit 7cd720bd authored by guohui's avatar guohui Committed by Commit bot

Fix UI glitches in the new avatar bubble

1. the ruler lines in the "not claire" view on mac is not full width.
2. the title cards on windows has extra padding at the top.

BUG=406618

Review URL: https://codereview.chromium.org/516163003

Cr-Commit-Position: refs/heads/master@{#292967}
parent 9dbbf211
...@@ -95,7 +95,7 @@ const CGFloat kFixedGaiaViewHeight = 440; ...@@ -95,7 +95,7 @@ const CGFloat kFixedGaiaViewHeight = 440;
const CGFloat kFixedAccountRemovalViewWidth = 280; const CGFloat kFixedAccountRemovalViewWidth = 280;
// Fixed size for the switch user view. // Fixed size for the switch user view.
const int kFixedSwitchUserViewWidth = 280; const int kFixedSwitchUserViewWidth = 320;
// The tag number for the primary account. // The tag number for the primary account.
const int kPrimaryProfileTag = -1; const int kPrimaryProfileTag = -1;
...@@ -231,7 +231,7 @@ NSView* BuildTitleCard(NSRect frame_rect, ...@@ -231,7 +231,7 @@ NSView* BuildTitleCard(NSRect frame_rect,
[container addSubview:button]; [container addSubview:button];
[container addSubview:title_label]; [container addSubview:title_label];
CGFloat height = std::max(NSMaxY([title_label frame]), CGFloat height = std::max(NSMaxY([title_label frame]),
NSMaxY([button frame])) + kSmallVerticalSpacing; NSMaxY([button frame])) + kVerticalSpacing;
[container setFrameSize:NSMakeSize(NSWidth([container frame]), height)]; [container setFrameSize:NSMakeSize(NSWidth([container frame]), height)];
return container.autorelease(); return container.autorelease();
...@@ -1902,7 +1902,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, ...@@ -1902,7 +1902,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
NSBox* separator = [self horizontalSeparatorWithFrame: NSBox* separator = [self horizontalSeparatorWithFrame:
NSMakeRect(0, yOffset, kFixedGaiaViewWidth, 0)]; NSMakeRect(0, yOffset, kFixedGaiaViewWidth, 0)];
[container addSubview:separator]; [container addSubview:separator];
yOffset = NSMaxY([separator frame]) + kSmallVerticalSpacing; yOffset = NSMaxY([separator frame]) + kVerticalSpacing;
NSView* titleView = BuildTitleCard( NSView* titleView = BuildTitleCard(
NSMakeRect(0, yOffset, kFixedGaiaViewWidth, 0), NSMakeRect(0, yOffset, kFixedGaiaViewWidth, 0),
...@@ -1974,7 +1974,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, ...@@ -1974,7 +1974,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
NSBox* separator = [self horizontalSeparatorWithFrame: NSBox* separator = [self horizontalSeparatorWithFrame:
NSMakeRect(0, yOffset, kFixedAccountRemovalViewWidth, 0)]; NSMakeRect(0, yOffset, kFixedAccountRemovalViewWidth, 0)];
[container addSubview:separator]; [container addSubview:separator];
yOffset = NSMaxY([separator frame]) + kSmallVerticalSpacing; yOffset = NSMaxY([separator frame]) + kVerticalSpacing;
NSView* titleView = BuildTitleCard( NSView* titleView = BuildTitleCard(
NSMakeRect(0, yOffset, kFixedAccountRemovalViewWidth,0), NSMakeRect(0, yOffset, kFixedAccountRemovalViewWidth,0),
...@@ -2014,7 +2014,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, ...@@ -2014,7 +2014,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
yOffset = NSMaxY([disconnectButton frame]); yOffset = NSMaxY([disconnectButton frame]);
NSBox* separator = [self horizontalSeparatorWithFrame: NSBox* separator = [self horizontalSeparatorWithFrame:
NSMakeRect(0, yOffset, kFixedMenuWidth, 0)]; NSMakeRect(0, yOffset, kFixedSwitchUserViewWidth, 0)];
[container addSubview:separator]; [container addSubview:separator];
yOffset = NSMaxY([separator frame]); yOffset = NSMaxY([separator frame]);
...@@ -2030,7 +2030,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, ...@@ -2030,7 +2030,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
yOffset = NSMaxY([addPersonButton frame]); yOffset = NSMaxY([addPersonButton frame]);
separator = [self horizontalSeparatorWithFrame: separator = [self horizontalSeparatorWithFrame:
NSMakeRect(0, yOffset, kFixedMenuWidth, 0)]; NSMakeRect(0, yOffset, kFixedSwitchUserViewWidth, 0)];
[container addSubview:separator]; [container addSubview:separator];
yOffset = NSMaxY([separator frame]); yOffset = NSMaxY([separator frame]);
...@@ -2050,7 +2050,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, ...@@ -2050,7 +2050,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
separator = [self horizontalSeparatorWithFrame: separator = [self horizontalSeparatorWithFrame:
NSMakeRect(0, yOffset, kFixedSwitchUserViewWidth, 0)]; NSMakeRect(0, yOffset, kFixedSwitchUserViewWidth, 0)];
[container addSubview:separator]; [container addSubview:separator];
yOffset = NSMaxY([separator frame]) + kSmallVerticalSpacing; yOffset = NSMaxY([separator frame]) + kVerticalSpacing;
NSView* titleView = BuildTitleCard( NSView* titleView = BuildTitleCard(
NSMakeRect(0, yOffset, kFixedSwitchUserViewWidth,0), NSMakeRect(0, yOffset, kFixedSwitchUserViewWidth,0),
...@@ -2060,7 +2060,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, ...@@ -2060,7 +2060,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
[container addSubview:titleView]; [container addSubview:titleView];
yOffset = NSMaxY([titleView frame]); yOffset = NSMaxY([titleView frame]);
[container setFrameSize:NSMakeSize(kFixedAccountRemovalViewWidth, yOffset)]; [container setFrameSize:NSMakeSize(kFixedSwitchUserViewWidth, yOffset)];
return container.autorelease(); return container.autorelease();
} }
......
...@@ -72,9 +72,11 @@ const int kButtonHeight = 32; ...@@ -72,9 +72,11 @@ const int kButtonHeight = 32;
const int kFixedGaiaViewHeight = 440; const int kFixedGaiaViewHeight = 440;
const int kFixedGaiaViewWidth = 360; const int kFixedGaiaViewWidth = 360;
const int kFixedAccountRemovalViewWidth = 280; const int kFixedAccountRemovalViewWidth = 280;
const int kFixedSwitchUserViewWidth = 280; const int kFixedSwitchUserViewWidth = 320;
const int kLargeImageSide = 88; const int kLargeImageSide = 88;
const int kVerticalSpacing = 16;
// Creates a GridLayout with a single column. This ensures that all the child // Creates a GridLayout with a single column. This ensures that all the child
// views added get auto-expanded to fill the full width of the bubble. // views added get auto-expanded to fill the full width of the bubble.
views::GridLayout* CreateSingleColumnLayout(views::View* view, int width) { views::GridLayout* CreateSingleColumnLayout(views::View* view, int width) {
...@@ -422,8 +424,9 @@ class TitleCard : public views::View { ...@@ -422,8 +424,9 @@ class TitleCard : public views::View {
AddChildView(title_label_); AddChildView(title_label_);
} }
// Creates a new view that has the |title_card| with padding at the top, an // Creates a new view that has the |title_card| with horizontal padding at the
// edge-to-edge separator below, and the specified |view| at the bottom. // top, an edge-to-edge separator below, and the specified |view| at the
// bottom.
static views::View* AddPaddedTitleCard(views::View* view, static views::View* AddPaddedTitleCard(views::View* view,
TitleCard* title_card, TitleCard* title_card,
int width) { int width) {
...@@ -442,9 +445,9 @@ class TitleCard : public views::View { ...@@ -442,9 +445,9 @@ class TitleCard : public views::View {
layout->AddColumnSet(1)->AddColumn(views::GridLayout::FILL, layout->AddColumnSet(1)->AddColumn(views::GridLayout::FILL,
views::GridLayout::FILL, 0,views::GridLayout::FIXED, width, width); views::GridLayout::FILL, 0,views::GridLayout::FIXED, width, width);
layout->StartRowWithPadding(1, 0, 0, views::kButtonVEdgeMarginNew); layout->StartRowWithPadding(1, 0, 0, kVerticalSpacing);
layout->AddView(title_card); layout->AddView(title_card);
layout->StartRowWithPadding(1, 1, 0, views::kRelatedControlVerticalSpacing); layout->StartRowWithPadding(1, 1, 0, kVerticalSpacing);
layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); layout->AddView(new views::Separator(views::Separator::HORIZONTAL));
layout->StartRow(1, 1); layout->StartRow(1, 1);
......
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