Commit f2134df8 authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Position trailing NTB separator correctly for RTL mode.

Also moves the separator to have 8 DIP between its trailing edge and the NTB,
instead of between its leading edge and the NTB.  This parallels how it's
positioned when the tabs are drawing it in the other two NTB positions.

Bug: none
Test: Run with --force-ui-direction=rtl --new-tab-button-position=trailing and ensure a separator is visible next to the new tab button
Change-Id: I7e58485626c5ebab5dd477cefada5825479bdcb4
Reviewed-on: https://chromium-review.googlesource.com/1132484Reviewed-by: default avatarAllen Bauer <kylixrd@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574195}
parent 1e8515dd
...@@ -1349,12 +1349,15 @@ void TabStrip::PaintChildren(const views::PaintInfo& paint_info) { ...@@ -1349,12 +1349,15 @@ void TabStrip::PaintChildren(const views::PaintInfo& paint_info) {
void TabStrip::OnPaint(gfx::Canvas* canvas) { void TabStrip::OnPaint(gfx::Canvas* canvas) {
views::View::OnPaint(canvas); views::View::OnPaint(canvas);
// In refresh, paint a separator before a trailing new tab button.
if (MD::IsRefreshUi() && GetNewTabButtonPosition() == TRAILING) { if (MD::IsRefreshUi() && GetNewTabButtonPosition() == TRAILING) {
float separator_height = Tab::GetTabSeparatorHeight(); const int width = Tab::kSeparatorThickness;
const float separator_height = Tab::GetTabSeparatorHeight();
gfx::RectF separator_bounds( gfx::RectF separator_bounds(
new_tab_button_bounds_.x() - Tab::GetCornerRadius(), GetMirroredXWithWidthInView(
(height() - separator_height) / 2, Tab::kSeparatorThickness, new_tab_button_bounds_.x() - Tab::GetCornerRadius() - width, width),
separator_height); (height() - separator_height) / 2, width, separator_height);
cc::PaintFlags flags; cc::PaintFlags flags;
flags.setAntiAlias(true); flags.setAntiAlias(true);
flags.setColor(GetTabSeparatorColor()); flags.setColor(GetTabSeparatorColor());
...@@ -1607,13 +1610,18 @@ int TabStrip::GetFrameGrabWidth() const { ...@@ -1607,13 +1610,18 @@ int TabStrip::GetFrameGrabWidth() const {
constexpr int kGrabWidth = 50; constexpr int kGrabWidth = 50;
int width = kGrabWidth; int width = kGrabWidth;
// There might be no tabs yet during startup. const NewTabButtonPosition position = controller_->GetNewTabButtonPosition();
if ((controller_->GetNewTabButtonPosition() != AFTER_TABS) && tab_count()) { if (position != AFTER_TABS) {
// The grab area is adjacent to the last tab. This tab has mostly empty // The grab area is adjacent to the last tab. This tab has mostly empty
// space where the outer (lower) corners are, which should be treated as // space where the outer (lower) corners are, which should be treated as
// part of the grab area, so decrease the size of the remaining grab area by // part of the grab area, so decrease the size of the remaining grab area by
// that width. // that width.
width -= Tab::GetCornerRadius(); width -= Tab::GetCornerRadius();
// The trailing NTB has a separator just before it; don't count that as part
// of the frame grab width since it looks visually distinct.
if (position == TRAILING)
width += Tab::kSeparatorThickness;
} }
return width; return width;
......
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