Commit 9f63bdb8 authored by Patti's avatar Patti Committed by Commit Bot

Omnibox/Views: Fix BubbleIconView icon size for touch.

The BubbleIconView icons in touch mode should be 20x20. Currently, they look
about 24x24, so downsize them here by using border insets for the icon padding
instead of relying on the internal ImageView to center itself within the larger
BubbleIconView.

Bug: 829887, 830059, 801583
Change-Id: Ib98ef8dbb6279148375d431a1bb4224015fe02c7
Reviewed-on: https://chromium-review.googlesource.com/1002217
Commit-Queue: Patti <patricialor@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549387}
parent 746989b5
...@@ -37,7 +37,10 @@ BubbleIconView::BubbleIconView(CommandUpdater* command_updater, ...@@ -37,7 +37,10 @@ BubbleIconView::BubbleIconView(CommandUpdater* command_updater,
delegate_(delegate), delegate_(delegate),
command_id_(command_id), command_id_(command_id),
active_(false), active_(false),
suppress_mouse_released_action_(false) {} suppress_mouse_released_action_(false) {
SetBorder(views::CreateEmptyBorder(
gfx::Insets(GetLayoutConstant(LOCATION_BAR_ICON_INTERIOR_PADDING))));
}
BubbleIconView::~BubbleIconView() {} BubbleIconView::~BubbleIconView() {}
...@@ -93,19 +96,13 @@ bool BubbleIconView::GetTooltipText(const gfx::Point& p, ...@@ -93,19 +96,13 @@ bool BubbleIconView::GetTooltipText(const gfx::Point& p,
} }
gfx::Size BubbleIconView::CalculatePreferredSize() const { gfx::Size BubbleIconView::CalculatePreferredSize() const {
gfx::Rect image_rect(image_->GetPreferredSize()); gfx::Size image_rect(image_->GetPreferredSize());
image_rect.Inset( image_rect.Enlarge(GetInsets().width(), GetInsets().height());
-gfx::Insets(GetLayoutConstant(LOCATION_BAR_ICON_INTERIOR_PADDING))); return image_rect;
DCHECK_EQ(image_rect.height(),
GetLayoutConstant(LOCATION_BAR_HEIGHT) -
2 * (GetLayoutConstant(LOCATION_BAR_ELEMENT_PADDING) +
BackgroundWith1PxBorder::kLocationBarBorderThicknessDip));
return image_rect.size();
} }
void BubbleIconView::Layout() { void BubbleIconView::Layout() {
View::Layout(); image_->SetBoundsRect(GetContentsBounds());
image_->SetBoundsRect(GetLocalBounds());
} }
bool BubbleIconView::OnMousePressed(const ui::MouseEvent& event) { bool BubbleIconView::OnMousePressed(const ui::MouseEvent& event) {
......
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