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

Side by Side Diff: ui/views/window/non_client_view.cc

Issue 1866403005: Fix rtl shelf overflow bubble (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move RTL adjustment (bubble_frame_view -> non_client_view) 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/window/non_client_view.h" 5 #include "ui/views/window/non_client_view.h"
6 6
7 #include "ui/accessibility/ax_view_state.h" 7 #include "ui/accessibility/ax_view_state.h"
8 #include "ui/base/hit_test.h" 8 #include "ui/base/hit_test.h"
9 #include "ui/gfx/geometry/rect_conversions.h" 9 #include "ui/gfx/geometry/rect_conversions.h"
10 #include "ui/views/rect_based_targeting_utils.h" 10 #include "ui/views/rect_based_targeting_utils.h"
(...skipping 25 matching lines...) Expand all
36 bool NonClientFrameView::GetClientMask(const gfx::Size& size, 36 bool NonClientFrameView::GetClientMask(const gfx::Size& size,
37 gfx::Path* mask) const { 37 gfx::Path* mask) const {
38 return false; 38 return false;
39 } 39 }
40 40
41 //////////////////////////////////////////////////////////////////////////////// 41 ////////////////////////////////////////////////////////////////////////////////
42 // NonClientView, public: 42 // NonClientView, public:
43 43
44 NonClientView::NonClientView() 44 NonClientView::NonClientView()
45 : client_view_(nullptr), 45 : client_view_(nullptr),
46 mirror_client_in_rtl_(true),
46 overlay_view_(nullptr) { 47 overlay_view_(nullptr) {
47 SetEventTargeter( 48 SetEventTargeter(
48 std::unique_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); 49 std::unique_ptr<views::ViewTargeter>(new views::ViewTargeter(this)));
49 } 50 }
50 51
51 NonClientView::~NonClientView() { 52 NonClientView::~NonClientView() {
52 // This value may have been reset before the window hierarchy shuts down, 53 // This value may have been reset before the window hierarchy shuts down,
53 // so we need to manually remove it. 54 // so we need to manually remove it.
54 RemoveChildView(frame_view_.get()); 55 RemoveChildView(frame_view_.get());
55 } 56 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 159 }
159 160
160 gfx::Size NonClientView::GetMaximumSize() const { 161 gfx::Size NonClientView::GetMaximumSize() const {
161 return frame_view_->GetMaximumSize(); 162 return frame_view_->GetMaximumSize();
162 } 163 }
163 164
164 void NonClientView::Layout() { 165 void NonClientView::Layout() {
165 LayoutFrameView(); 166 LayoutFrameView();
166 167
167 // Then layout the ClientView, using those bounds. 168 // Then layout the ClientView, using those bounds.
168 client_view_->SetBoundsRect(frame_view_->GetBoundsForClientView()); 169 gfx::Rect client_bounds = frame_view_->GetBoundsForClientView();
170
171 // RTL code will mirror the ClientView in the frame by default. If this isn't
172 // desired, pre-mirror it here so the subsequent mirror results in a no-op.
sky 2016/04/29 17:17:27 nit: you're not doing pre-mirror here, rather anot
Greg Levin 2016/05/02 00:49:19 Done.
173 if (base::i18n::IsRTL() && !mirror_client_in_rtl_)
174 client_bounds.set_x(GetMirroredXForRect(client_bounds));
175
176 client_view_->SetBoundsRect(client_bounds);
169 177
170 gfx::Path client_clip; 178 gfx::Path client_clip;
171 if (frame_view_->GetClientMask(client_view_->size(), &client_clip)) 179 if (frame_view_->GetClientMask(client_view_->size(), &client_clip))
172 client_view_->set_clip_path(client_clip); 180 client_view_->set_clip_path(client_clip);
173 181
174 // We need to manually call Layout on the ClientView as well for the same 182 // We need to manually call Layout on the ClientView as well for the same
175 // reason as above. 183 // reason as above.
176 client_view_->Layout(); 184 client_view_->Layout();
177 185
178 if (overlay_view_ && overlay_view_->visible()) 186 if (overlay_view_ && overlay_view_->visible())
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 // the client view. 344 // the client view.
337 return !GetWidget()->client_view()->bounds().Intersects(rect); 345 return !GetWidget()->client_view()->bounds().Intersects(rect);
338 } 346 }
339 347
340 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { 348 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
341 // Overridden to do nothing. The NonClientView manually calls Layout on the 349 // Overridden to do nothing. The NonClientView manually calls Layout on the
342 // FrameView when it is itself laid out, see comment in NonClientView::Layout. 350 // FrameView when it is itself laid out, see comment in NonClientView::Layout.
343 } 351 }
344 352
345 } // namespace views 353 } // namespace views
OLDNEW
« ash/shelf/shelf_view_unittest.cc ('K') | « ui/views/window/non_client_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698