| 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/aura/window.h" | 5 #include "ui/aura/window.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 : type_(client::WINDOW_TYPE_UNKNOWN), | 47 : type_(client::WINDOW_TYPE_UNKNOWN), |
| 48 delegate_(delegate), | 48 delegate_(delegate), |
| 49 layer_(NULL), | 49 layer_(NULL), |
| 50 parent_(NULL), | 50 parent_(NULL), |
| 51 transient_parent_(NULL), | 51 transient_parent_(NULL), |
| 52 visible_(false), | 52 visible_(false), |
| 53 id_(-1), | 53 id_(-1), |
| 54 transparent_(false), | 54 transparent_(false), |
| 55 user_data_(NULL), | 55 user_data_(NULL), |
| 56 stops_event_propagation_(false), | 56 stops_event_propagation_(false), |
| 57 ignore_events_(false) { | 57 ignore_events_(false), |
| 58 hit_test_bounds_inset_(0) { |
| 58 } | 59 } |
| 59 | 60 |
| 60 Window::~Window() { | 61 Window::~Window() { |
| 61 // layer_ can be NULL if Init() wasn't invoked, which can happen | 62 // layer_ can be NULL if Init() wasn't invoked, which can happen |
| 62 // only in tests. | 63 // only in tests. |
| 63 if (layer_) | 64 if (layer_) |
| 64 layer_->SuppressPaint(); | 65 layer_->SuppressPaint(); |
| 65 | 66 |
| 66 // Let the delegate know we're in the processing of destroying. | 67 // Let the delegate know we're in the processing of destroying. |
| 67 if (delegate_) | 68 if (delegate_) |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 ConvertPointToWindow(root_window, this, &local_point); | 395 ConvertPointToWindow(root_window, this, &local_point); |
| 395 return GetTargetBounds().Contains(local_point); | 396 return GetTargetBounds().Contains(local_point); |
| 396 } | 397 } |
| 397 | 398 |
| 398 bool Window::ContainsPoint(const gfx::Point& local_point) { | 399 bool Window::ContainsPoint(const gfx::Point& local_point) { |
| 399 gfx::Rect local_bounds(gfx::Point(), bounds().size()); | 400 gfx::Rect local_bounds(gfx::Point(), bounds().size()); |
| 400 return local_bounds.Contains(local_point); | 401 return local_bounds.Contains(local_point); |
| 401 } | 402 } |
| 402 | 403 |
| 403 bool Window::HitTest(const gfx::Point& local_point) { | 404 bool Window::HitTest(const gfx::Point& local_point) { |
| 405 gfx::Rect local_bounds(gfx::Point(), bounds().size()); |
| 406 local_bounds.Inset(hit_test_bounds_inset_, hit_test_bounds_inset_); |
| 404 // TODO(beng): hittest masks. | 407 // TODO(beng): hittest masks. |
| 405 return ContainsPoint(local_point); | 408 return local_bounds.Contains(local_point); |
| 406 } | 409 } |
| 407 | 410 |
| 408 Window* Window::GetEventHandlerForPoint(const gfx::Point& local_point) { | 411 Window* Window::GetEventHandlerForPoint(const gfx::Point& local_point) { |
| 409 return GetWindowForPoint(local_point, true, true); | 412 return GetWindowForPoint(local_point, true, true); |
| 410 } | 413 } |
| 411 | 414 |
| 412 Window* Window::GetTopWindowContainingPoint(const gfx::Point& local_point) { | 415 Window* Window::GetTopWindowContainingPoint(const gfx::Point& local_point) { |
| 413 return GetWindowForPoint(local_point, false, false); | 416 return GetWindowForPoint(local_point, false, false); |
| 414 } | 417 } |
| 415 | 418 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 parent_->children().end(), | 738 parent_->children().end(), |
| 736 this); | 739 this); |
| 737 for (++i; i != parent_->children().end(); ++i) { | 740 for (++i; i != parent_->children().end(); ++i) { |
| 738 if ((*i)->StopsEventPropagation()) | 741 if ((*i)->StopsEventPropagation()) |
| 739 return true; | 742 return true; |
| 740 } | 743 } |
| 741 return false; | 744 return false; |
| 742 } | 745 } |
| 743 | 746 |
| 744 } // namespace aura | 747 } // namespace aura |
| OLD | NEW |