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

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

Issue 1866403005: Fix rtl shelf overflow bubble (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit test Created 4 years, 7 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
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 } // namespace 67 } // namespace
68 68
69 // static 69 // static
70 const char BubbleFrameView::kViewClassName[] = "BubbleFrameView"; 70 const char BubbleFrameView::kViewClassName[] = "BubbleFrameView";
71 71
72 BubbleFrameView::BubbleFrameView(const gfx::Insets& title_margins, 72 BubbleFrameView::BubbleFrameView(const gfx::Insets& title_margins,
73 const gfx::Insets& content_margins) 73 const gfx::Insets& content_margins)
74 : bubble_border_(nullptr), 74 : bubble_border_(nullptr),
75 mirror_arrow_in_rtl_(true),
75 title_margins_(title_margins), 76 title_margins_(title_margins),
76 content_margins_(content_margins), 77 content_margins_(content_margins),
77 title_icon_(new views::ImageView()), 78 title_icon_(new views::ImageView()),
78 title_(nullptr), 79 title_(nullptr),
79 close_(nullptr), 80 close_(nullptr),
80 footnote_container_(nullptr), 81 footnote_container_(nullptr),
81 close_button_clicked_(false) { 82 close_button_clicked_(false) {
82 AddChildView(title_icon_); 83 AddChildView(title_icon_);
83 84
84 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 85 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
(...skipping 28 matching lines...) Expand all
113 // Windows will automatically create a tooltip for the close button based on 114 // Windows will automatically create a tooltip for the close button based on
114 // the HTCLOSE result from NonClientHitTest(). 115 // the HTCLOSE result from NonClientHitTest().
115 close->SetTooltipText(l10n_util::GetStringUTF16(IDS_APP_CLOSE)); 116 close->SetTooltipText(l10n_util::GetStringUTF16(IDS_APP_CLOSE));
116 #endif 117 #endif
117 return close; 118 return close;
118 } 119 }
119 120
120 gfx::Rect BubbleFrameView::GetBoundsForClientView() const { 121 gfx::Rect BubbleFrameView::GetBoundsForClientView() const {
121 gfx::Rect client_bounds = GetContentsBounds(); 122 gfx::Rect client_bounds = GetContentsBounds();
122 client_bounds.Inset(GetInsets()); 123 client_bounds.Inset(GetInsets());
124
125 // After GetBoundsForClientView() returns, RTL code will mirror the ClientView
126 // in the bubble. If we're not mirroring the arrow, we don't want this, so we
127 // pre-mirror here so the subsequent swap results in a no-op.
128 if (base::i18n::IsRTL() && !mirror_arrow_in_rtl_)
129 client_bounds.set_x(GetMirroredXForRect(client_bounds));
130
123 if (footnote_container_) { 131 if (footnote_container_) {
124 client_bounds.set_height(client_bounds.height() - 132 client_bounds.set_height(client_bounds.height() -
125 footnote_container_->height()); 133 footnote_container_->height());
126 } 134 }
127 return client_bounds; 135 return client_bounds;
128 } 136 }
129 137
130 gfx::Rect BubbleFrameView::GetWindowBoundsForClientBounds( 138 gfx::Rect BubbleFrameView::GetWindowBoundsForClientBounds(
131 const gfx::Rect& client_bounds) const { 139 const gfx::Rect& client_bounds) const {
132 gfx::Size size(GetSizeForClientSize(client_bounds.size())); 140 gfx::Size size(GetSizeForClientSize(client_bounds.size()));
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 size.Enlarge(client_insets.width(), client_insets.height()); 518 size.Enlarge(client_insets.width(), client_insets.height());
511 size.SetToMax(gfx::Size(title_bar_width, 0)); 519 size.SetToMax(gfx::Size(title_bar_width, 0));
512 520
513 if (footnote_container_) 521 if (footnote_container_)
514 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); 522 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width()));
515 523
516 return size; 524 return size;
517 } 525 }
518 526
519 } // namespace views 527 } // namespace views
OLDNEW
« ui/views/bubble/bubble_frame_view.h ('K') | « ui/views/bubble/bubble_frame_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698