Commit 4fd18fba authored by Gregory Chatzinoff's avatar Gregory Chatzinoff Committed by Commit Bot

Fix spacing of bubble for New Tab Page Promotion.

The bubble was previously too far away from its target  because the
Open Tabs Button included a lot of padding around the image. Now, the
bubble targets the image directly and has a smaller margin so that it
is an appropriate distance away from the target. The unit tests
expectations were adjusted downward by 8 to account for this reduction
in margin (note that the short text case only went down to 50 px since
50 is the minimum width).

Bug: 780977
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I1f18df5e9b2d464e1d12b3a04ef87f8166397b18
Reviewed-on: https://chromium-review.googlesource.com/807667Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Reviewed-by: default avataredchin <edchin@chromium.org>
Commit-Queue: Gregory Chatzinoff <gchatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522236}
parent 7aae11ad
......@@ -33,7 +33,7 @@ const CGFloat kFontSize = 16.0f;
// Margin between the bubble view's bounds and its content. This margin is on
// all sides of the bubble.
const CGFloat kBubbleMargin = 8.0f;
const CGFloat kBubbleMargin = 4.0f;
// Padding between the top and bottom the bubble's background and the top and
// bottom of the label.
const CGFloat kLabelVerticalPadding = 8.0f;
......
......@@ -46,8 +46,8 @@ TEST_F(BubbleViewTest, BubbleSizeShortText) {
CGSize bubbleSize = [bubble sizeThatFits:maxSize_];
// Since the label is shorter than the minimum line width, expect the bubble
// to be the minimum width and accommodate one line of text.
EXPECT_NEAR(56.0f, bubbleSize.width, 1.0f);
EXPECT_NEAR(61.5f, bubbleSize.height, 1.0f);
EXPECT_NEAR(50.0f, bubbleSize.width, 1.0f);
EXPECT_NEAR(53.5f, bubbleSize.height, 1.0f);
}
// Test |sizeThatFits| given text that should wrap onto multiple lines.
......@@ -57,8 +57,8 @@ TEST_F(BubbleViewTest, BubbleSizeMultipleLineText) {
alignment:alignment_];
CGSize bubbleSize = [bubble sizeThatFits:maxSize_];
// The bubble should fit the label, which contains two lines of text.
EXPECT_NEAR(349.0f, bubbleSize.width, 1.0f);
EXPECT_NEAR(80.5f, bubbleSize.height, 1.0f);
EXPECT_NEAR(341.0f, bubbleSize.width, 1.0f);
EXPECT_NEAR(72.5f, bubbleSize.height, 1.0f);
}
// Test that the accessibility label matches the display text.
......
......@@ -675,9 +675,10 @@ UIColor* BackgroundColor() {
- (CGPoint)anchorPointForTabSwitcherButton:(BubbleArrowDirection)direction {
CGPoint anchorPoint =
bubble_util::AnchorPoint(_tabSwitcherButton.frame, direction);
return [_tabSwitcherButton.superview convertPoint:anchorPoint
toView:_tabSwitcherButton.window];
bubble_util::AnchorPoint(_tabSwitcherButton.imageView.frame, direction);
return [_tabSwitcherButton.imageView.superview
convertPoint:anchorPoint
toView:_tabSwitcherButton.imageView.window];
}
#pragma mark -
......
......@@ -794,9 +794,11 @@ using ios::material::TimingFunction;
#pragma mark - BubbleViewAnchorPointProvider methods.
- (CGPoint)anchorPointForTabSwitcherButton:(BubbleArrowDirection)direction {
CGPoint anchorPoint = bubble_util::AnchorPoint(stackButton_.frame, direction);
return [stackButton_.superview convertPoint:anchorPoint
toView:stackButton_.window];
CGPoint anchorPoint =
bubble_util::AnchorPoint(stackButton_.imageView.frame, direction);
return [stackButton_.imageView.superview
convertPoint:anchorPoint
toView:stackButton_.imageView.window];
}
- (CGPoint)anchorPointForToolsMenuButton:(BubbleArrowDirection)direction {
......
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