Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(699)

Unified Diff: chrome/browser/ui/panels/panel_overflow_strip.cc

Issue 8885019: Fix 2 panel overflow related bugs on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
« chrome/browser/ui/panels/panel_manager.cc ('K') | « chrome/browser/ui/panels/panel_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698