| 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/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 void Window::RemoveObserver(WindowObserver* observer) { | 478 void Window::RemoveObserver(WindowObserver* observer) { |
| 479 observers_.RemoveObserver(observer); | 479 observers_.RemoveObserver(observer); |
| 480 } | 480 } |
| 481 | 481 |
| 482 bool Window::ContainsPointInRoot(const gfx::Point& point_in_root) { | 482 bool Window::ContainsPointInRoot(const gfx::Point& point_in_root) { |
| 483 Window* root_window = GetRootWindow(); | 483 Window* root_window = GetRootWindow(); |
| 484 if (!root_window) | 484 if (!root_window) |
| 485 return false; | 485 return false; |
| 486 gfx::Point local_point(point_in_root); | 486 gfx::Point local_point(point_in_root); |
| 487 ConvertPointToWindow(root_window, this, &local_point); | 487 ConvertPointToWindow(root_window, this, &local_point); |
| 488 return GetTargetBounds().Contains(local_point); | 488 return gfx::Rect(GetTargetBounds().size()).Contains(local_point); |
| 489 } | 489 } |
| 490 | 490 |
| 491 bool Window::ContainsPoint(const gfx::Point& local_point) { | 491 bool Window::ContainsPoint(const gfx::Point& local_point) { |
| 492 gfx::Rect local_bounds(gfx::Point(), bounds().size()); | 492 return gfx::Rect(bounds().size()).Contains(local_point); |
| 493 return local_bounds.Contains(local_point); | |
| 494 } | 493 } |
| 495 | 494 |
| 496 bool Window::HitTest(const gfx::Point& local_point) { | 495 bool Window::HitTest(const gfx::Point& local_point) { |
| 497 // Expand my bounds for hit testing (override is usually zero but it's | 496 // Expand my bounds for hit testing (override is usually zero but it's |
| 498 // probably cheaper to do the math every time than to branch). | 497 // probably cheaper to do the math every time than to branch). |
| 499 gfx::Rect local_bounds(gfx::Point(), bounds().size()); | 498 gfx::Rect local_bounds(gfx::Point(), bounds().size()); |
| 500 local_bounds.Inset(hit_test_bounds_override_outer_); | 499 local_bounds.Inset(hit_test_bounds_override_outer_); |
| 501 | 500 |
| 502 if (!delegate_ || !delegate_->HasHitTestMask()) | 501 if (!delegate_ || !delegate_->HasHitTestMask()) |
| 503 return local_bounds.Contains(local_point); | 502 return local_bounds.Contains(local_point); |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 for (Windows::const_reverse_iterator it = children_.rbegin(), | 944 for (Windows::const_reverse_iterator it = children_.rbegin(), |
| 946 rend = children_.rend(); | 945 rend = children_.rend(); |
| 947 it != rend; ++it) { | 946 it != rend; ++it) { |
| 948 Window* child = *it; | 947 Window* child = *it; |
| 949 child->PrintWindowHierarchy(depth + 1); | 948 child->PrintWindowHierarchy(depth + 1); |
| 950 } | 949 } |
| 951 } | 950 } |
| 952 #endif | 951 #endif |
| 953 | 952 |
| 954 } // namespace aura | 953 } // namespace aura |
| OLD | NEW |