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/base/accessibility/accessible_view_state.h" | 7 #include "ui/base/accessibility/accessible_view_state.h" |
8 #include "ui/base/hit_test.h" | 8 #include "ui/base/hit_test.h" |
9 #include "ui/gfx/rect_conversions.h" | 9 #include "ui/gfx/rect_conversions.h" |
10 #include "ui/views/rect_based_targeting_utils.h" | 10 #include "ui/views/rect_based_targeting_utils.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 if (handler) | 225 if (handler) |
226 return handler; | 226 return handler; |
227 } | 227 } |
228 | 228 |
229 return View::GetTooltipHandlerForPoint(point); | 229 return View::GetTooltipHandlerForPoint(point); |
230 } | 230 } |
231 | 231 |
232 //////////////////////////////////////////////////////////////////////////////// | 232 //////////////////////////////////////////////////////////////////////////////// |
233 // NonClientFrameView, public: | 233 // NonClientFrameView, public: |
234 | 234 |
| 235 NonClientFrameView::~NonClientFrameView() { |
| 236 } |
| 237 |
235 void NonClientFrameView::SetInactiveRenderingDisabled(bool disable) { | 238 void NonClientFrameView::SetInactiveRenderingDisabled(bool disable) { |
236 if (paint_as_active_ == disable) | 239 if (inactive_rendering_disabled_ == disable) |
237 return; | 240 return; |
238 | 241 |
239 paint_as_active_ = disable; | 242 bool should_paint_as_active_old = ShouldPaintAsActive(); |
240 ShouldPaintAsActiveChanged(); | 243 inactive_rendering_disabled_ = disable; |
| 244 |
| 245 // The widget schedules a paint when the activation changes. |
| 246 if (should_paint_as_active_old != ShouldPaintAsActive()) |
| 247 SchedulePaint(); |
| 248 } |
| 249 |
| 250 bool NonClientFrameView::ShouldPaintAsActive() const { |
| 251 return inactive_rendering_disabled_ || GetWidget()->IsActive(); |
241 } | 252 } |
242 | 253 |
243 int NonClientFrameView::GetHTComponentForFrame(const gfx::Point& point, | 254 int NonClientFrameView::GetHTComponentForFrame(const gfx::Point& point, |
244 int top_resize_border_height, | 255 int top_resize_border_height, |
245 int resize_border_thickness, | 256 int resize_border_thickness, |
246 int top_resize_corner_height, | 257 int top_resize_corner_height, |
247 int resize_corner_width, | 258 int resize_corner_width, |
248 bool can_resize) { | 259 bool can_resize) { |
249 // Tricky: In XP, native behavior is to return HTTOPLEFT and HTTOPRIGHT for | 260 // Tricky: In XP, native behavior is to return HTTOPLEFT and HTTOPRIGHT for |
250 // a |resize_corner_size|-length strip of both the side and top borders, but | 261 // a |resize_corner_size|-length strip of both the side and top borders, but |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 305 |
295 bool NonClientFrameView::HitTestRect(const gfx::Rect& rect) const { | 306 bool NonClientFrameView::HitTestRect(const gfx::Rect& rect) const { |
296 // For the default case, we assume the non-client frame view never overlaps | 307 // For the default case, we assume the non-client frame view never overlaps |
297 // the client view. | 308 // the client view. |
298 return !GetWidget()->client_view()->bounds().Intersects(rect); | 309 return !GetWidget()->client_view()->bounds().Intersects(rect); |
299 } | 310 } |
300 | 311 |
301 //////////////////////////////////////////////////////////////////////////////// | 312 //////////////////////////////////////////////////////////////////////////////// |
302 // NonClientFrameView, protected: | 313 // NonClientFrameView, protected: |
303 | 314 |
304 bool NonClientFrameView::ShouldPaintAsActive() const { | |
305 return GetWidget()->IsActive() || paint_as_active_; | |
306 } | |
307 | |
308 void NonClientFrameView::ShouldPaintAsActiveChanged() { | |
309 SchedulePaint(); | |
310 } | |
311 | |
312 void NonClientFrameView::GetAccessibleState(ui::AccessibleViewState* state) { | 315 void NonClientFrameView::GetAccessibleState(ui::AccessibleViewState* state) { |
313 state->role = ui::AccessibilityTypes::ROLE_CLIENT; | 316 state->role = ui::AccessibilityTypes::ROLE_CLIENT; |
314 } | 317 } |
315 | 318 |
316 const char* NonClientFrameView::GetClassName() const { | 319 const char* NonClientFrameView::GetClassName() const { |
317 return kViewClassName; | 320 return kViewClassName; |
318 } | 321 } |
319 | 322 |
320 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 323 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
321 // Overridden to do nothing. The NonClientView manually calls Layout on the | 324 // Overridden to do nothing. The NonClientView manually calls Layout on the |
322 // FrameView when it is itself laid out, see comment in NonClientView::Layout. | 325 // FrameView when it is itself laid out, see comment in NonClientView::Layout. |
323 } | 326 } |
324 | 327 |
| 328 NonClientFrameView::NonClientFrameView() : inactive_rendering_disabled_(false) { |
| 329 } |
| 330 |
325 } // namespace views | 331 } // namespace views |
OLD | NEW |