Index: chrome/browser/ui/panels/panel_overflow_strip.cc |
diff --git a/chrome/browser/ui/panels/panel_overflow_strip.cc b/chrome/browser/ui/panels/panel_overflow_strip.cc |
index b26ae8e412083b88356d055e026a580e772d7699..c523147d897bc1124bd73b5a76435223513a28a1 100644 |
--- a/chrome/browser/ui/panels/panel_overflow_strip.cc |
+++ b/chrome/browser/ui/panels/panel_overflow_strip.cc |
@@ -102,7 +102,7 @@ void PanelOverflowStrip::Refresh() { |
} |
void PanelOverflowStrip::DoRefresh(size_t start_index, size_t end_index) { |
- if (panels_.empty()) |
+ if (panels_.empty() || start_index == panels_.size()) |
jennb
2011/12/08 20:05:46
Sufficient to just check start_index >= end_index?
|
return; |
DCHECK(start_index < panels_.size()); |
@@ -112,7 +112,6 @@ void PanelOverflowStrip::DoRefresh(size_t start_index, size_t end_index) { |
Panel* panel = panels_[index]; |
gfx::Rect new_bounds = ComputeLayout(index, |
panel->IconOnlySize()); |
- DCHECK(!new_bounds.IsEmpty()); |
panel->SetPanelBounds(new_bounds); |
} |
} |
@@ -155,10 +154,18 @@ bool PanelOverflowStrip::ShouldShowOverflowTitles( |
if (panels_.empty()) |
return false; |
- int width = are_overflow_titles_shown_ ? kOverflowAreaHoverWidth |
- : display_area_.width(); |
+ int width; |
+ Panel* top_visible_panel; |
+ if (are_overflow_titles_shown_) { |
+ width = kOverflowAreaHoverWidth; |
+ top_visible_panel = panels_.back(); |
+ } else { |
+ width = display_area_.width(); |
+ top_visible_panel = num_panels() >= kMaxVisibleOverflowPanelsAllowed ? |
+ panels_[kMaxVisibleOverflowPanelsAllowed - 1] : panels_.back(); |
+ } |
return mouse_position.x() <= display_area_.x() + width && |
- panels_.back()->GetBounds().y() <= mouse_position.y() && |
+ top_visible_panel->GetBounds().y() <= mouse_position.y() && |
mouse_position.y() <= display_area_.bottom(); |
} |
@@ -167,6 +174,9 @@ void PanelOverflowStrip::ShowOverflowTitles(bool show_overflow_titles) { |
return; |
are_overflow_titles_shown_ = show_overflow_titles; |
+ if (panels_.empty()) |
+ return; |
+ |
if (show_overflow_titles) { |
overflow_hover_animator_start_width_ = display_area_.width(); |
overflow_hover_animator_end_width_ = kOverflowAreaHoverWidth; |