Commit 332bdd7b authored by Allen Bauer's avatar Allen Bauer Committed by Commit Bot

Re-order selected tabs painting for hover effects.

Hovering over selected tabs will not properly order painting such that the
painting order will paint the lower tab "tails" over the left adjacent tab.

While this has always been present, with the recent added painting of the
stroke on the tabs, this is much more apparent.

Bug: 871838
Change-Id: I4dd4c4264107fb8a058b5210b02c27008498f35d
Reviewed-on: https://chromium-review.googlesource.com/1165689
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581423}
parent faa34ebc
...@@ -1228,21 +1228,23 @@ void TabStrip::PaintChildren(const views::PaintInfo& paint_info) { ...@@ -1228,21 +1228,23 @@ void TabStrip::PaintChildren(const views::PaintInfo& paint_info) {
// of hovered background tabs due to the painting order. This manifests as // of hovered background tabs due to the painting order. This manifests as
// the lower left curve the tab being visibly overwritten. This code detects // the lower left curve the tab being visibly overwritten. This code detects
// the hovered cases and defers painting of the given tab to below. // the hovered cases and defers painting of the given tab to below.
auto check_hovered_or_paint = [&paint_info, &hovered_tab, const auto check_hovered_selected_or_paint =
&hovered_tabs](Tab* tab) { [&paint_info, &hovered_tab, &hovered_tabs, &selected_tabs](Tab* tab) {
if (MD::IsRefreshUi() && tab->mouse_hovered()) if (MD::IsRefreshUi() && tab->mouse_hovered())
hovered_tab = tab; hovered_tab = tab;
else if (MD::IsRefreshUi() && tab->hover_controller()->ShouldDraw()) else if (MD::IsRefreshUi() && tab->hover_controller()->ShouldDraw())
hovered_tabs.push_back(tab); hovered_tabs.push_back(tab);
else else if (tab->IsSelected())
tab->Paint(paint_info); selected_tabs.push_back(tab);
}; else
tab->Paint(paint_info);
auto paint_closing_tabs = [=](int index) { };
const auto paint_closing_tabs = [=](int index) {
if (tabs_closing_map_.find(index) == tabs_closing_map_.end()) if (tabs_closing_map_.find(index) == tabs_closing_map_.end())
return; return;
for (Tab* tab : base::Reversed(tabs_closing_map_[index])) for (Tab* tab : base::Reversed(tabs_closing_map_[index]))
check_hovered_or_paint(tab); check_hovered_selected_or_paint(tab);
}; };
paint_closing_tabs(tab_count()); paint_closing_tabs(tab_count());
...@@ -1261,10 +1263,8 @@ void TabStrip::PaintChildren(const views::PaintInfo& paint_info) { ...@@ -1261,10 +1263,8 @@ void TabStrip::PaintChildren(const views::PaintInfo& paint_info) {
} else if (tab->IsActive()) { } else if (tab->IsActive()) {
active_tab = tab; active_tab = tab;
active_tab_index = i; active_tab_index = i;
} else if (tab->IsSelected()) {
selected_tabs.push_back(tab);
} else if (!stacked_layout_) { } else if (!stacked_layout_) {
check_hovered_or_paint(tab); check_hovered_selected_or_paint(tab);
} }
paint_closing_tabs(i); paint_closing_tabs(i);
} }
......
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