| 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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. | 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. |
| 6 | 6 |
| 7 #include "ui/views/view.h" | 7 #include "ui/views/view.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 #else | 941 #else |
| 942 return gfx::kNullCursor; | 942 return gfx::kNullCursor; |
| 943 #endif | 943 #endif |
| 944 } | 944 } |
| 945 | 945 |
| 946 bool View::HitTestPoint(const gfx::Point& point) const { | 946 bool View::HitTestPoint(const gfx::Point& point) const { |
| 947 return HitTestRect(gfx::Rect(point, gfx::Size(1, 1))); | 947 return HitTestRect(gfx::Rect(point, gfx::Size(1, 1))); |
| 948 } | 948 } |
| 949 | 949 |
| 950 bool View::HitTestRect(const gfx::Rect& rect) const { | 950 bool View::HitTestRect(const gfx::Rect& rect) const { |
| 951 // If no ViewTargeter is installed on |this|, use the ViewTargeter installed | |
| 952 // on our root view instead. | |
| 953 ViewTargeter* view_targeter = targeter(); | 951 ViewTargeter* view_targeter = targeter(); |
| 954 if (!view_targeter) | 952 if (!view_targeter) |
| 955 view_targeter = GetWidget()->GetRootView()->targeter(); | 953 view_targeter = GetWidget()->GetRootView()->targeter(); |
| 956 CHECK(view_targeter); | 954 CHECK(view_targeter); |
| 957 return view_targeter->DoesIntersectRect(this, rect); | 955 return view_targeter->DoesIntersectRect(this, rect); |
| 958 } | 956 } |
| 959 | 957 |
| 960 bool View::IsMouseHovered() { | 958 bool View::IsMouseHovered() { |
| 961 // If we haven't yet been placed in an onscreen view hierarchy, we can't be | 959 // If we haven't yet been placed in an onscreen view hierarchy, we can't be |
| 962 // hovered. | 960 // hovered. |
| (...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2475 // Message the RootView to do the drag and drop. That way if we're removed | 2473 // Message the RootView to do the drag and drop. That way if we're removed |
| 2476 // the RootView can detect it and avoid calling us back. | 2474 // the RootView can detect it and avoid calling us back. |
| 2477 gfx::Point widget_location(event.location()); | 2475 gfx::Point widget_location(event.location()); |
| 2478 ConvertPointToWidget(this, &widget_location); | 2476 ConvertPointToWidget(this, &widget_location); |
| 2479 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2477 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
| 2480 // WARNING: we may have been deleted. | 2478 // WARNING: we may have been deleted. |
| 2481 return true; | 2479 return true; |
| 2482 } | 2480 } |
| 2483 | 2481 |
| 2484 } // namespace views | 2482 } // namespace views |
| OLD | NEW |