summaryrefslogtreecommitdiffstats
path: root/ui/message_center/views/notifier_settings_view.cc
diff options
context:
space:
mode:
authormukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-20 15:45:26 +0000
committermukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-20 15:45:26 +0000
commit171ced94495e78847ade3a81c0916b124eb6ad49 (patch)
tree9134045ce27509e185c27f3b50901f397f049d27 /ui/message_center/views/notifier_settings_view.cc
parenta0494061158325db4fb4ac7c79199728673a6e11 (diff)
downloadchromium_src-171ced94495e78847ade3a81c0916b124eb6ad49.zip
chromium_src-171ced94495e78847ade3a81c0916b124eb6ad49.tar.gz
chromium_src-171ced94495e78847ade3a81c0916b124eb6ad49.tar.bz2
Fix notification settings dialog visuals.
This CL does the following things: - do not shrink the contents of the scroll view, instead enlarge the window if there is a scroll bar. - set an empty insets for separator, otherwise a scrollbar appears when the total height of the contents is exactly same as the expected window height. - fix the length of the separator. BUG=161094 Review URL: https://codereview.chromium.org/12566037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189289 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/message_center/views/notifier_settings_view.cc')
-rw-r--r--ui/message_center/views/notifier_settings_view.cc23
1 files changed, 12 insertions, 11 deletions
diff --git a/ui/message_center/views/notifier_settings_view.cc b/ui/message_center/views/notifier_settings_view.cc
index c535507..aedcca0 100644
--- a/ui/message_center/views/notifier_settings_view.cc
+++ b/ui/message_center/views/notifier_settings_view.cc
@@ -102,14 +102,15 @@ Separator::~Separator() {
void Separator::Paint(const views::View& view, gfx::Canvas* canvas) {
gfx::Rect bounds(view.GetLocalBounds());
bounds.Inset(kMarginWidth, 0);
- const views::ScrollView* scroll_view =
- static_cast<const views::ScrollView*>(&view);
- bounds.set_width(bounds.width() - scroll_view->GetScrollBarWidth());
canvas->DrawLine(bounds.origin(), bounds.top_right(), kSeparatorColor);
}
gfx::Insets Separator::GetInsets() const {
- return gfx::Insets(1, 0, 0, 0);
+ // Do not set the insets for the separator. This means that the separater will
+ // overlap with the top of the scroll contents, otherwise the scroll view will
+ // create a scroll bar if the contents height is exactly same as the height of
+ // the window.
+ return gfx::Insets();
}
} // namespace
@@ -272,12 +273,7 @@ NotifierSettingsView::NotifierSettingsView(
}
scroller_->SetContents(contents_view);
- gfx::Size contents_size = contents_view->GetPreferredSize();
- if (kMinimumWindowHeight <
- title_entry_->GetPreferredSize().height() + contents_size.height()) {
- contents_size.Enlarge(-scroller_->GetScrollBarWidth(), 0);
- }
- contents_view->SetBoundsRect(gfx::Rect(contents_size));
+ contents_view->SetBoundsRect(gfx::Rect(contents_view->GetPreferredSize()));
}
NotifierSettingsView::~NotifierSettingsView() {
@@ -304,7 +300,12 @@ void NotifierSettingsView::Layout() {
}
gfx::Size NotifierSettingsView::GetMinimumSize() {
- return gfx::Size(kMinimumWindowWidth, kMinimumWindowHeight);
+ gfx::Size size(kMinimumWindowWidth, kMinimumWindowHeight);
+ int total_height = title_entry_->GetPreferredSize().height() +
+ scroller_->contents()->GetPreferredSize().height();
+ if (total_height > kMinimumWindowHeight)
+ size.Enlarge(scroller_->GetScrollBarWidth(), 0);
+ return size;
}
gfx::Size NotifierSettingsView::GetPreferredSize() {