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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 gfx::Insets BubbleFrameView::GetInsets() const { | 250 gfx::Insets BubbleFrameView::GetInsets() const { |
| 251 gfx::Insets insets = content_margins_; | 251 gfx::Insets insets = content_margins_; |
| 252 | 252 |
| 253 const int icon_height = title_icon_->GetPreferredSize().height(); | 253 const int icon_height = title_icon_->GetPreferredSize().height(); |
| 254 const int label_height = title_->GetPreferredSize().height(); | 254 const int label_height = title_->GetPreferredSize().height(); |
| 255 const bool has_title = icon_height > 0 || label_height > 0; | 255 const bool has_title = icon_height > 0 || label_height > 0; |
| 256 const int title_padding = has_title ? title_margins_.height() : 0; | 256 const int title_padding = has_title ? title_margins_.height() : 0; |
| 257 const int title_height = std::max(icon_height, label_height) + title_padding; | 257 const int title_height = std::max(icon_height, label_height) + title_padding; |
| 258 const int close_height = | 258 const int close_height = |
| 259 GetWidget()->widget_delegate()->ShouldShowCloseButton() | 259 GetWidget()->widget_delegate()->ShouldShowCloseButton() |
| 260 ? close_->height() | 260 ? close_->height() + |
| 261 2 * ViewsDelegate::GetInstance()->GetDistanceMetric( | |
| 262 DistanceMetric::CLOSE_BUTTON_MARGIN) | |
|
Peter Kasting
2017/04/11 20:12:58
I'm wondering whether this is correct, or we only
Evan Stade
2017/04/11 20:20:16
I think whether it's 1x or 2x here defines whether
| |
| 261 : 0; | 263 : 0; |
| 262 insets += gfx::Insets(std::max(title_height, close_height), 0, 0, 0); | 264 insets += gfx::Insets(std::max(title_height, close_height), 0, 0, 0); |
| 263 return insets; | 265 return insets; |
| 264 } | 266 } |
| 265 | 267 |
| 266 gfx::Size BubbleFrameView::GetPreferredSize() const { | 268 gfx::Size BubbleFrameView::GetPreferredSize() const { |
| 267 // Get the preferred size of the client area. | 269 // Get the preferred size of the client area. |
| 268 gfx::Size client_size = GetWidget()->client_view()->GetPreferredSize(); | 270 gfx::Size client_size = GetWidget()->client_view()->GetPreferredSize(); |
| 269 // Expand it to include the bubble border and space for the arrow. | 271 // Expand it to include the bubble border and space for the arrow. |
| 270 return GetWindowBoundsForClientBounds(gfx::Rect(client_size)).size(); | 272 return GetWindowBoundsForClientBounds(gfx::Rect(client_size)).size(); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 528 size.Enlarge(client_insets.width(), client_insets.height()); | 530 size.Enlarge(client_insets.width(), client_insets.height()); |
| 529 size.SetToMax(gfx::Size(title_bar_width, 0)); | 531 size.SetToMax(gfx::Size(title_bar_width, 0)); |
| 530 | 532 |
| 531 if (footnote_container_) | 533 if (footnote_container_) |
| 532 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); | 534 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); |
| 533 | 535 |
| 534 return size; | 536 return size; |
| 535 } | 537 } |
| 536 | 538 |
| 537 } // namespace views | 539 } // namespace views |
| OLD | NEW |