summaryrefslogtreecommitdiffstats
path: root/ash/shelf/overflow_bubble.cc
diff options
context:
space:
mode:
authorsimon.hong81@gmail.com <simon.hong81@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-09 04:10:30 +0000
committersimon.hong81@gmail.com <simon.hong81@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-09 04:10:30 +0000
commit341f9e1b8e1261222fd7f4e61302b0b22275619b (patch)
tree13d1ff97360aa1d29ce5fa18d83cb552e4c528e7 /ash/shelf/overflow_bubble.cc
parentaf497fadf9848ab9c2a0fcd20b38b2b9e09db537 (diff)
downloadchromium_src-341f9e1b8e1261222fd7f4e61302b0b22275619b.zip
chromium_src-341f9e1b8e1261222fd7f4e61302b0b22275619b.tar.gz
chromium_src-341f9e1b8e1261222fd7f4e61302b0b22275619b.tar.bz2
[ash] Overflow bubble shows empty slot
Problem: When an item is ripped out from the overflow bubble, overflow bubble shows an empty slot for invisible view(drag_view). The size of overflow bubble size should be shrunk. R=skuhne@chromium.org, jamescook@chromium.org BUG=312536 TEST=ash_unittests --gtest_filter=*.OverflowBubbleSize, visual test Review URL: https://codereview.chromium.org/49503005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234077 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/shelf/overflow_bubble.cc')
-rw-r--r--ash/shelf/overflow_bubble.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/ash/shelf/overflow_bubble.cc b/ash/shelf/overflow_bubble.cc
index 0b62f46..f0514cb 100644
--- a/ash/shelf/overflow_bubble.cc
+++ b/ash/shelf/overflow_bubble.cc
@@ -131,6 +131,7 @@ void OverflowBubbleView::ScrollByXOffset(int x_offset) {
const gfx::Rect visible_bounds(GetContentsBounds());
const gfx::Size contents_size(GetContentsSize());
+ DCHECK_GE(contents_size.width(), visible_bounds.width());
int x = std::min(contents_size.width() - visible_bounds.width(),
std::max(0, scroll_offset_.x() + x_offset));
scroll_offset_.set_x(x);
@@ -140,6 +141,7 @@ void OverflowBubbleView::ScrollByYOffset(int y_offset) {
const gfx::Rect visible_bounds(GetContentsBounds());
const gfx::Size contents_size(GetContentsSize());
+ DCHECK_GE(contents_size.width(), visible_bounds.width());
int y = std::min(contents_size.height() - visible_bounds.height(),
std::max(0, scroll_offset_.y() + y_offset));
scroll_offset_.set_y(y);
@@ -173,12 +175,16 @@ void OverflowBubbleView::Layout() {
}
void OverflowBubbleView::ChildPreferredSizeChanged(views::View* child) {
- // Ensures |launch_view_| is still visible.
- ScrollByXOffset(0);
- ScrollByYOffset(0);
- Layout();
-
+ // When contents size is changed, ContentsBounds should be updated before
+ // calculating scroll offset.
SizeToContents();
+
+ // Ensures |shelf_view_| is still visible.
+ if (IsHorizontalAlignment())
+ ScrollByXOffset(0);
+ else
+ ScrollByYOffset(0);
+ Layout();
}
bool OverflowBubbleView::OnMouseWheel(const ui::MouseWheelEvent& event) {