Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/bubble/bubble_frame_view.h" | 5 #include "ui/views/bubble/bubble_frame_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 | 238 |
| 239 gfx::Insets BubbleFrameView::GetInsets() const { | 239 gfx::Insets BubbleFrameView::GetInsets() const { |
| 240 gfx::Insets insets = content_margins_; | 240 gfx::Insets insets = content_margins_; |
| 241 | 241 |
| 242 const int icon_height = title_icon_->GetPreferredSize().height(); | 242 const int icon_height = title_icon_->GetPreferredSize().height(); |
| 243 const int label_height = title_->GetPreferredSize().height(); | 243 const int label_height = title_->GetPreferredSize().height(); |
| 244 const bool has_title = icon_height > 0 || label_height > 0; | 244 const bool has_title = icon_height > 0 || label_height > 0; |
| 245 const int title_padding = has_title ? title_margins_.height() : 0; | 245 const int title_padding = has_title ? title_margins_.height() : 0; |
| 246 const int title_height = std::max(icon_height, label_height) + title_padding; | 246 const int title_height = std::max(icon_height, label_height) + title_padding; |
| 247 const int close_height = close_->visible() ? close_->height() : 0; | 247 const int close_height = close_->visible() ? close_->height() : 0; |
| 248 insets += gfx::Insets(std::max(title_height, close_height), 0, 0, 0); | 248 const int min_height = |
| 249 !GetWidget()->widget_delegate()->ShouldShowCloseButton() | |
|
msw
2016/07/28 18:49:32
This is wrong, numerous cross-platform bubbles and
| |
| 250 ? close_->height() | |
| 251 : 0; | |
| 252 insets += | |
| 253 gfx::Insets(std::max({title_height, close_height, min_height}), 0, 0, 0); | |
| 249 return insets; | 254 return insets; |
| 250 } | 255 } |
| 251 | 256 |
| 252 gfx::Size BubbleFrameView::GetPreferredSize() const { | 257 gfx::Size BubbleFrameView::GetPreferredSize() const { |
| 253 // Get the preferred size of the client area. | 258 // Get the preferred size of the client area. |
| 254 gfx::Size client_size = GetWidget()->client_view()->GetPreferredSize(); | 259 gfx::Size client_size = GetWidget()->client_view()->GetPreferredSize(); |
| 255 // Expand it to include the bubble border and space for the arrow. | 260 // Expand it to include the bubble border and space for the arrow. |
| 256 return GetWindowBoundsForClientBounds(gfx::Rect(client_size)).size(); | 261 return GetWindowBoundsForClientBounds(gfx::Rect(client_size)).size(); |
| 257 } | 262 } |
| 258 | 263 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 512 size.Enlarge(client_insets.width(), client_insets.height()); | 517 size.Enlarge(client_insets.width(), client_insets.height()); |
| 513 size.SetToMax(gfx::Size(title_bar_width, 0)); | 518 size.SetToMax(gfx::Size(title_bar_width, 0)); |
| 514 | 519 |
| 515 if (footnote_container_) | 520 if (footnote_container_) |
| 516 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); | 521 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); |
| 517 | 522 |
| 518 return size; | 523 return size; |
| 519 } | 524 } |
| 520 | 525 |
| 521 } // namespace views | 526 } // namespace views |
| OLD | NEW |