| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/view.h" | 5 #include "views/view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 gfx::Point point_in_child_coords(point); | 762 gfx::Point point_in_child_coords(point); |
| 763 View::ConvertPointToView(this, child, &point_in_child_coords); | 763 View::ConvertPointToView(this, child, &point_in_child_coords); |
| 764 if (child->HitTest(point_in_child_coords)) | 764 if (child->HitTest(point_in_child_coords)) |
| 765 return child->GetEventHandlerForPoint(point_in_child_coords); | 765 return child->GetEventHandlerForPoint(point_in_child_coords); |
| 766 } | 766 } |
| 767 return this; | 767 return this; |
| 768 } | 768 } |
| 769 | 769 |
| 770 gfx::NativeCursor View::GetCursorForPoint(ui::EventType event_type, | 770 gfx::NativeCursor View::GetCursorForPoint(ui::EventType event_type, |
| 771 const gfx::Point& p) { | 771 const gfx::Point& p) { |
| 772 #if defined(OS_WIN) |
| 773 static HCURSOR arrow = LoadCursor(NULL, IDC_ARROW); |
| 774 return arrow; |
| 775 #else |
| 772 return NULL; | 776 return NULL; |
| 777 #endif |
| 773 } | 778 } |
| 774 | 779 |
| 775 bool View::HitTest(const gfx::Point& l) const { | 780 bool View::HitTest(const gfx::Point& l) const { |
| 776 if (l.x() >= 0 && l.x() < width() && l.y() >= 0 && l.y() < height()) { | 781 if (GetLocalBounds().Contains(l)) { |
| 777 if (HasHitTestMask()) { | 782 if (HasHitTestMask()) { |
| 778 gfx::Path mask; | 783 gfx::Path mask; |
| 779 GetHitTestMask(&mask); | 784 GetHitTestMask(&mask); |
| 780 // TODO: can this use SkRegion's contains instead? | 785 // TODO: can this use SkRegion's contains instead? |
| 781 #if defined(OS_WIN) | 786 #if defined(OS_WIN) |
| 782 base::win::ScopedRegion rgn(mask.CreateNativeRegion()); | 787 base::win::ScopedRegion rgn(mask.CreateNativeRegion()); |
| 783 return !!PtInRegion(rgn, l.x(), l.y()); | 788 return !!PtInRegion(rgn, l.x(), l.y()); |
| 784 #elif defined(TOOLKIT_USES_GTK) | 789 #elif defined(TOOLKIT_USES_GTK) |
| 785 ui::ScopedRegion rgn(mask.CreateNativeRegion()); | 790 ui::ScopedRegion rgn(mask.CreateNativeRegion()); |
| 786 return gdk_region_point_in(rgn.Get(), l.x(), l.y()); | 791 return gdk_region_point_in(rgn.Get(), l.x(), l.y()); |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1747 | 1752 |
| 1748 OSExchangeData data; | 1753 OSExchangeData data; |
| 1749 WriteDragData(press_pt, &data); | 1754 WriteDragData(press_pt, &data); |
| 1750 | 1755 |
| 1751 // Message the RootView to do the drag and drop. That way if we're removed | 1756 // Message the RootView to do the drag and drop. That way if we're removed |
| 1752 // the RootView can detect it and avoid calling us back. | 1757 // the RootView can detect it and avoid calling us back. |
| 1753 GetWidget()->RunShellDrag(this, data, drag_operations); | 1758 GetWidget()->RunShellDrag(this, data, drag_operations); |
| 1754 } | 1759 } |
| 1755 | 1760 |
| 1756 } // namespace views | 1761 } // namespace views |
| OLD | NEW |