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/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 Loading... | |
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |