Index: ui/views/window/dialog_client_view.cc |
diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc |
index ba1698812e6e3c5b2bfad31c089d5eb218ff3496..4f462d1f03bad140b507c193faa47d8088e785c5 100644 |
--- a/ui/views/window/dialog_client_view.cc |
+++ b/ui/views/window/dialog_client_view.cc |
@@ -371,11 +371,9 @@ gfx::Size DialogClientView::GetPreferredSize() { |
} |
prefsize.Enlarge(0, button_height); |
- if (footnote_view_) { |
- gfx::Size footnote_size = footnote_view_->GetPreferredSize(); |
- prefsize.Enlarge(0, footnote_size.height()); |
- prefsize.set_width(std::max(prefsize.width(), footnote_size.width())); |
- } |
+ const gfx::Size& footnote_size = GetFootnoteSize(); |
+ prefsize.Enlarge(0, footnote_size.height()); |
+ prefsize.set_width(std::max(prefsize.width(), footnote_size.width())); |
return prefsize; |
} |
@@ -493,16 +491,16 @@ int DialogClientView::GetDialogButtonsAreaHeight() const { |
style_params_.button_vedge_margin; |
} |
-int DialogClientView::GetFootnoteViewHeight() const { |
- return footnote_view_ ? footnote_view_->GetPreferredSize().height() : 0; |
+gfx::Size DialogClientView::GetFootnoteSize() const { |
+ return footnote_view_ && footnote_view_->visible() ? |
+ footnote_view_->GetPreferredSize() : gfx::Size(); |
} |
void DialogClientView::LayoutDialogButtons() { |
gfx::Rect lb = GetContentsBounds(); |
gfx::Rect extra_bounds; |
int bottom_y = lb.bottom() - style_params_.button_vedge_margin; |
- if (footnote_view_) |
- bottom_y -= footnote_view_->GetPreferredSize().height(); |
+ bottom_y -= GetFootnoteSize().height(); |
int button_height = GetButtonsHeight(); |
if (cancel_button_) { |
@@ -541,13 +539,13 @@ void DialogClientView::LayoutDialogButtons() { |
void DialogClientView::LayoutContentsView() { |
gfx::Rect lb = GetContentsBounds(); |
lb.set_height(std::max(0, lb.height() - GetDialogButtonsAreaHeight() - |
- GetFootnoteViewHeight())); |
+ GetFootnoteSize().height())); |
contents_view()->SetBoundsRect(lb); |
contents_view()->Layout(); |
} |
void DialogClientView::LayoutFootnoteView() { |
- int height = GetFootnoteViewHeight(); |
+ int height = GetFootnoteSize().height(); |
gfx::Rect bounds = GetContentsBounds(); |
bounds.set_y(bounds.height() - height); |
bounds.set_height(height); |