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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 } | 488 } |
489 | 489 |
490 bool Window::ContainsPoint(const gfx::Point& local_point) const { | 490 bool Window::ContainsPoint(const gfx::Point& local_point) const { |
491 return gfx::Rect(bounds().size()).Contains(local_point); | 491 return gfx::Rect(bounds().size()).Contains(local_point); |
492 } | 492 } |
493 | 493 |
494 bool Window::HitTest(const gfx::Point& local_point) { | 494 bool Window::HitTest(const gfx::Point& local_point) { |
495 // Expand my bounds for hit testing (override is usually zero but it's | 495 // Expand my bounds for hit testing (override is usually zero but it's |
496 // probably cheaper to do the math every time than to branch). | 496 // probably cheaper to do the math every time than to branch). |
497 gfx::Rect local_bounds(gfx::Point(), bounds().size()); | 497 gfx::Rect local_bounds(gfx::Point(), bounds().size()); |
498 local_bounds.Inset(hit_test_bounds_override_outer_); | 498 local_bounds.Inset(aura::Env::GetInstance()->is_touch_down() ? |
| 499 hit_test_bounds_override_outer_touch_ : |
| 500 hit_test_bounds_override_outer_mouse_); |
499 | 501 |
500 if (!delegate_ || !delegate_->HasHitTestMask()) | 502 if (!delegate_ || !delegate_->HasHitTestMask()) |
501 return local_bounds.Contains(local_point); | 503 return local_bounds.Contains(local_point); |
502 | 504 |
503 gfx::Path mask; | 505 gfx::Path mask; |
504 delegate_->GetHitTestMask(&mask); | 506 delegate_->GetHitTestMask(&mask); |
505 | 507 |
506 SkRegion clip_region; | 508 SkRegion clip_region; |
507 clip_region.setRect(local_bounds.x(), local_bounds.y(), | 509 clip_region.setRect(local_bounds.x(), local_bounds.y(), |
508 local_bounds.width(), local_bounds.height()); | 510 local_bounds.width(), local_bounds.height()); |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 for (Windows::const_reverse_iterator it = children_.rbegin(), | 943 for (Windows::const_reverse_iterator it = children_.rbegin(), |
942 rend = children_.rend(); | 944 rend = children_.rend(); |
943 it != rend; ++it) { | 945 it != rend; ++it) { |
944 Window* child = *it; | 946 Window* child = *it; |
945 child->PrintWindowHierarchy(depth + 1); | 947 child->PrintWindowHierarchy(depth + 1); |
946 } | 948 } |
947 } | 949 } |
948 #endif | 950 #endif |
949 | 951 |
950 } // namespace aura | 952 } // namespace aura |
OLD | NEW |