Commit 64729272 authored by spqchan's avatar spqchan Committed by Commit Bot

Revert "[MacViews] Fix for incorrect extension padding"

This reverts commit 2b9a46a9.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> [MacViews] Fix for incorrect extension padding
>
> Move the extensions 2pt to the right on Mac to match the native Mac
> placements.
>
> Bug: 792593
> Change-Id: I579520a37043667dfa289b110287c034447c3812
> Reviewed-on: https://chromium-review.googlesource.com/982353
> Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
> Commit-Queue: Sarah Chan <spqchan@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#546536}

TBR=ellyjones@chromium.org,spqchan@chromium.org

Bug: 792593
Change-Id: I517f941cd1b950e45d2879636e1ad0c07c2f5a49
Reviewed-on: https://chromium-review.googlesource.com/989535
Commit-Queue: Sarah Chan <spqchan@chromium.org>
Reviewed-by: default avatarSarah Chan <spqchan@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549472}
parent 64fc6d00
......@@ -91,16 +91,8 @@ int GetLayoutConstant(LayoutConstant constant) {
return touch_optimized_material ? 68 : 120;
case TAB_STANDARD_WIDTH:
return touch_optimized_material ? 245 : 193;
case TOOLBAR_ACTION_LEFT_PADDING:
#if defined(OS_MACOSX)
return 2;
#else
return 0;
#endif
case TOOLBAR_ELEMENT_PADDING: {
constexpr int kElementPadding[] = {0, 8, 0, 4};
return kElementPadding[mode];
}
case TOOLBAR_ELEMENT_PADDING:
return hybrid ? 8 : 0;
case TOOLBAR_STANDARD_SPACING: {
constexpr int kSpacings[] = {4, 8, 12, 8};
return kSpacings[mode];
......
......@@ -98,10 +98,6 @@ enum LayoutConstant {
// one side)
TAB_STANDARD_WIDTH,
// Additional left horizontal padding between the browser actions and the
// omnibox.
TOOLBAR_ACTION_LEFT_PADDING,
// Additional horizontal padding between the elements in the toolbar.
TOOLBAR_ELEMENT_PADDING,
......
......@@ -88,7 +88,6 @@ bool ToolbarActionsBar::disable_animations_for_testing_ = false;
ToolbarActionsBar::PlatformSettings::PlatformSettings()
: item_spacing(GetLayoutConstant(TOOLBAR_STANDARD_SPACING)),
left_padding(GetLayoutConstant(TOOLBAR_ACTION_LEFT_PADDING)),
icons_per_overflow_menu_row(1) {}
ToolbarActionsBar::ToolbarActionsBar(ToolbarActionsBarDelegate* delegate,
......@@ -168,9 +167,7 @@ gfx::Size ToolbarActionsBar::GetFullSize() const {
num_rows += (std::max(0, icon_count - 1) / num_icons);
}
gfx::Size size = gfx::ScaleToFlooredSize(GetViewSize(), num_icons, num_rows);
size.Enlarge(platform_settings_.left_padding, 0);
return size;
return gfx::ScaleToFlooredSize(GetViewSize(), num_icons, num_rows);
}
int ToolbarActionsBar::GetMinimumWidth() const {
......@@ -178,8 +175,7 @@ int ToolbarActionsBar::GetMinimumWidth() const {
}
int ToolbarActionsBar::GetMaximumWidth() const {
return IconCountToWidth(toolbar_actions_.size()) +
platform_settings_.left_padding;
return IconCountToWidth(toolbar_actions_.size());
}
int ToolbarActionsBar::IconCountToWidth(size_t icons) const {
......@@ -187,8 +183,7 @@ int ToolbarActionsBar::IconCountToWidth(size_t icons) const {
}
size_t ToolbarActionsBar::WidthToIconCount(int pixels) const {
int available_width = pixels - platform_settings_.left_padding;
return base::ClampToRange(available_width / GetViewSize().width(), 0,
return base::ClampToRange(pixels / GetViewSize().width(), 0,
static_cast<int>(toolbar_actions_.size()));
}
......@@ -280,9 +275,7 @@ gfx::Rect ToolbarActionsBar::GetFrameForIndex(
const auto size = GetViewSize();
return gfx::Rect(
gfx::Point(index_in_row * size.width() + platform_settings_.left_padding,
row_index * size.height()),
size);
gfx::Point(index_in_row * size.width(), row_index * size.height()), size);
}
std::vector<ToolbarActionViewController*>
......
......@@ -58,10 +58,6 @@ class ToolbarActionsBar : public ToolbarActionsModel::Observer,
// container and the first item, and between the last item and end of
// the container.
int item_spacing;
// The additional spacing between the container and omnibox.
int left_padding;
// The number of icons per row in the overflow menu.
int icons_per_overflow_menu_row;
};
......
......@@ -255,9 +255,8 @@ TEST_P(ToolbarActionsBarUnitTest, BasicToolbarActionsBarTest) {
// By default, all three actions should be visible.
EXPECT_EQ(3u, toolbar_actions_bar()->GetIconCount());
const gfx::Size view_size = ToolbarActionsBar::GetViewSize();
// Check the widths.
int expected_width = 3 * view_size.width() + platform_settings.left_padding;
int expected_width = 3 * view_size.width();
EXPECT_EQ(expected_width, toolbar_actions_bar()->GetFullSize().width());
// Since all icons are showing, the current width should be the max width.
int maximum_width = expected_width;
......@@ -273,7 +272,7 @@ TEST_P(ToolbarActionsBarUnitTest, BasicToolbarActionsBarTest) {
EXPECT_EQ(2u, toolbar_actions_bar()->GetIconCount());
// The current width should now be enough for two icons.
expected_width = 2 * view_size.width() + platform_settings.left_padding;
expected_width = 2 * view_size.width();
EXPECT_EQ(expected_width, toolbar_actions_bar()->GetFullSize().width());
// The maximum and minimum widths should have remained constant (since we have
// the same number of actions).
......@@ -445,11 +444,7 @@ TEST_P(ToolbarActionsBarUnitTest, TestHighlightMode) {
TEST_P(ToolbarActionsBarUnitTest, TestActionFrameBounds) {
const auto icon_rect = [](int x, int y) {
const auto size = ToolbarActionsBar::GetViewSize();
return gfx::Rect(
gfx::Point(
x * size.width() + GetLayoutConstant(TOOLBAR_ACTION_LEFT_PADDING),
y * size.height()),
size);
return gfx::Rect(gfx::Point(x * size.width(), y * size.height()), size);
};
constexpr int kIconsPerOverflowRow = 3;
......
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