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

Unified Diff: chrome/browser/chromeos/frame/bubble_frame_view.cc

Issue 8479042: UI polish for certificate viewer (Closed) Base URL: /usr/local/google/home/bshe/NoTouchChromium/../TouchChromium/src/@trunk
Patch Set: Remove body margins of two internal pages(due to the changes in tabs.css file). Created 9 years, 1 month 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/chromeos/frame/bubble_frame_view.cc
diff --git a/chrome/browser/chromeos/frame/bubble_frame_view.cc b/chrome/browser/chromeos/frame/bubble_frame_view.cc
index dd418520ad36b2a5a7929352a1ec61a823bf645f..de3e805f61e105f4ccfcc1d3727d5e0a2b9159a8 100644
--- a/chrome/browser/chromeos/frame/bubble_frame_view.cc
+++ b/chrome/browser/chromeos/frame/bubble_frame_view.cc
@@ -151,6 +151,15 @@ gfx::Insets BubbleFrameView::GetInsets() const {
kHorizontalPadding);
flackr 2011/11/21 20:43:31 I think the Insets you return here should not incl
bshe 2011/11/22 16:26:24 I was thinking that I can use offset_insets to off
}
+gfx::Insets BubbleFrameView::GetOffsetInsets() const {
+ return (style_ & STYLE_FLUSH_CONTENT) ?
+ gfx::Insets(0,
+ -kHorizontalPadding,
+ 0,
+ -kHorizontalPadding) :
+ gfx::Insets();
+}
+
gfx::Size BubbleFrameView::GetPreferredSize() {
gfx::Size pref = frame_->client_view()->GetPreferredSize();
gfx::Rect bounds(0, 0, pref.width(), pref.height());
@@ -171,22 +180,33 @@ void BubbleFrameView::Layout() {
if (throbber_)
throbber_size = throbber_->GetPreferredSize();
+ // Need to center elements which are shorter.
+ int max_height = std::max(title_size.height(),
+ std::max(close_button_size.height(),
+ throbber_size.height()));
+
if (title_) {
title_->SetBounds(
- insets.left(), insets.top(),
+ insets.left(),
+ insets.top() + (static_cast<int>(
flackr 2011/11/21 20:43:31 Remove static_cast, integer division results in an
bshe 2011/11/22 16:26:24 Done. A stupid mistake...
+ (max_height - title_size.height()) / 2)), // Center
std::max(0, width() - insets.width() - close_button_size.width()),
title_size.height());
}
if (close_button_) {
close_button_->SetBounds(
- width() - insets.right() - close_button_size.width(), insets.top(),
+ width() - insets.right() - close_button_size.width(),
+ insets.top() + (static_cast<int>(
flackr 2011/11/21 20:43:31 ditto
bshe 2011/11/22 16:26:24 Done.
+ (max_height - close_button_size.height()) / 2)),
close_button_size.width(), close_button_size.height());
}
if (throbber_) {
throbber_->SetBounds(
- insets.left(), insets.top(),
+ insets.left(),
+ insets.top() + (static_cast<int> (
flackr 2011/11/21 20:43:31 ditto
bshe 2011/11/22 16:26:24 Done.
+ (max_height - throbber_size.height()) / 2)),
std::min(throbber_size.width(), width()),
throbber_size.height());
}
@@ -199,9 +219,12 @@ void BubbleFrameView::Layout() {
std::max(title_size.height(), close_button_size.height()),
throbber_size.height());
}
- client_view_bounds_.SetRect(insets.left(), top_height,
- std::max(0, width() - insets.width()),
- std::max(0, height() - top_height - insets.bottom()));
+
+ gfx::Insets offset_insets = GetOffsetInsets();
flackr 2011/11/21 20:43:31 As per my above comment, my preference would be if
bshe 2011/11/22 16:26:24 Done.
+ client_view_bounds_.SetRect(insets.left() + offset_insets.left(), top_height,
+ std::max(0, width() - insets.width() - offset_insets.width()),
+ std::max(0, height() - top_height - insets.bottom()
+ - offset_insets.bottom()));
}
void BubbleFrameView::OnPaint(gfx::Canvas* canvas) {

Powered by Google App Engine
This is Rietveld 408576698