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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
237 } | 237 } |
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 = |
248 close_->visible() || !has_title ? close_->height() : 0; | |
msw
2016/07/13 19:23:44
Consider leaving close_height as-is and doing some
Elly Fong-Jones
2016/07/13 20:18:22
Done.
| |
248 insets += gfx::Insets(std::max(title_height, close_height), 0, 0, 0); | 249 insets += gfx::Insets(std::max(title_height, close_height), 0, 0, 0); |
249 return insets; | 250 return insets; |
250 } | 251 } |
251 | 252 |
252 gfx::Size BubbleFrameView::GetPreferredSize() const { | 253 gfx::Size BubbleFrameView::GetPreferredSize() const { |
253 // Get the preferred size of the client area. | 254 // Get the preferred size of the client area. |
254 gfx::Size client_size = GetWidget()->client_view()->GetPreferredSize(); | 255 gfx::Size client_size = GetWidget()->client_view()->GetPreferredSize(); |
255 // Expand it to include the bubble border and space for the arrow. | 256 // Expand it to include the bubble border and space for the arrow. |
256 return GetWindowBoundsForClientBounds(gfx::Rect(client_size)).size(); | 257 return GetWindowBoundsForClientBounds(gfx::Rect(client_size)).size(); |
257 } | 258 } |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
512 size.Enlarge(client_insets.width(), client_insets.height()); | 513 size.Enlarge(client_insets.width(), client_insets.height()); |
513 size.SetToMax(gfx::Size(title_bar_width, 0)); | 514 size.SetToMax(gfx::Size(title_bar_width, 0)); |
514 | 515 |
515 if (footnote_container_) | 516 if (footnote_container_) |
516 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); | 517 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); |
517 | 518 |
518 return size; | 519 return size; |
519 } | 520 } |
520 | 521 |
521 } // namespace views | 522 } // namespace views |
OLD | NEW |