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

Side by Side Diff: ui/views/bubble/bubble_frame_view.cc

Issue 2821463004: Revert of Fix layout of BubbleFrameView when there's only a close button in the (Closed)
Patch Set: Created 3 years, 8 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/bubble/bubble_frame_view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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() + LayoutProvider::Get()->GetDistanceMetric( 260 ? close_->height()
261 DISTANCE_CLOSE_BUTTON_MARGIN)
262 : 0; 261 : 0;
263 insets += gfx::Insets(std::max(title_height, close_height), 0, 0, 0); 262 insets += gfx::Insets(std::max(title_height, close_height), 0, 0, 0);
264 return insets; 263 return insets;
265 } 264 }
266 265
267 gfx::Size BubbleFrameView::GetPreferredSize() const { 266 gfx::Size BubbleFrameView::GetPreferredSize() const {
268 // Get the preferred size of the client area. 267 // Get the preferred size of the client area.
269 gfx::Size client_size = GetWidget()->client_view()->GetPreferredSize(); 268 gfx::Size client_size = GetWidget()->client_view()->GetPreferredSize();
270 // Expand it to include the bubble border and space for the arrow. 269 // Expand it to include the bubble border and space for the arrow.
271 return GetWindowBoundsForClientBounds(gfx::Rect(client_size)).size(); 270 return GetWindowBoundsForClientBounds(gfx::Rect(client_size)).size();
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 size.Enlarge(client_insets.width(), client_insets.height()); 528 size.Enlarge(client_insets.width(), client_insets.height());
530 size.SetToMax(gfx::Size(title_bar_width, 0)); 529 size.SetToMax(gfx::Size(title_bar_width, 0));
531 530
532 if (footnote_container_) 531 if (footnote_container_)
533 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); 532 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width()));
534 533
535 return size; 534 return size;
536 } 535 }
537 536
538 } // namespace views 537 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/bubble/bubble_frame_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698