diff options
author | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-08 21:20:13 +0000 |
---|---|---|
committer | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-08 21:20:13 +0000 |
commit | 11dc6b8bbb654ebff47328ddf1abd35ff0fc17eb (patch) | |
tree | b2a8cae44bd8eb0d663f0796d7c48527f0110e81 | |
parent | 872127049f5e7ff7fb2be25f6c20989b05934def (diff) | |
download | chromium_src-11dc6b8bbb654ebff47328ddf1abd35ff0fc17eb.zip chromium_src-11dc6b8bbb654ebff47328ddf1abd35ff0fc17eb.tar.gz chromium_src-11dc6b8bbb654ebff47328ddf1abd35ff0fc17eb.tar.bz2 |
Fix 2 panel overflow related bugs on Windows.
1) Bug 106880: Creating more than 6 overflow panels or closing the 6th overflow panel triggers assert on debug version
2) Bug 106882: Hovering the mouse over the top of the overflow panels may expand the overflow panels
BUG=106880,106882
TEST=Manul test by following repro steps as in bugs
Review URL: http://codereview.chromium.org/8885019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113663 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/ui/panels/panel_manager.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/panels/panel_overflow_strip.cc | 20 |
2 files changed, 16 insertions, 6 deletions
diff --git a/chrome/browser/ui/panels/panel_manager.cc b/chrome/browser/ui/panels/panel_manager.cc index 79676f2..6a209dd 100644 --- a/chrome/browser/ui/panels/panel_manager.cc +++ b/chrome/browser/ui/panels/panel_manager.cc @@ -18,7 +18,7 @@ #include "ui/gfx/screen.h" namespace { -const int kOverflowStripThickness = 24; +const int kOverflowStripThickness = 26; // Width of spacing around panel strip and the left/right edges of the screen. const int kPanelStripLeftMargin = kOverflowStripThickness + 6; diff --git a/chrome/browser/ui/panels/panel_overflow_strip.cc b/chrome/browser/ui/panels/panel_overflow_strip.cc index b26ae8e..c0d0a88 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()) 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 = panels_.size() >= 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; |