| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef NDEBUG | 8 #ifndef NDEBUG |
| 9 #include <iostream> | 9 #include <iostream> |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include "app/drag_drop_types.h" | 12 #include "app/drag_drop_types.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "base/scoped_handle.h" | |
| 16 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 17 #include "gfx/canvas_skia.h" | 16 #include "gfx/canvas_skia.h" |
| 18 #include "gfx/path.h" | 17 #include "gfx/path.h" |
| 19 #include "third_party/skia/include/core/SkShader.h" | 18 #include "third_party/skia/include/core/SkShader.h" |
| 20 #include "views/background.h" | 19 #include "views/background.h" |
| 21 #include "views/layout_manager.h" | 20 #include "views/layout_manager.h" |
| 22 #include "views/views_delegate.h" | 21 #include "views/views_delegate.h" |
| 23 #include "views/widget/root_view.h" | 22 #include "views/widget/root_view.h" |
| 24 #include "views/widget/tooltip_manager.h" | 23 #include "views/widget/tooltip_manager.h" |
| 25 #include "views/widget/widget.h" | 24 #include "views/widget/widget.h" |
| 26 #include "views/window/window.h" | 25 #include "views/window/window.h" |
| 27 | 26 |
| 28 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
| 28 #include "base/win/scoped_gdi_object.h" |
| 29 #include "views/accessibility/view_accessibility.h" | 29 #include "views/accessibility/view_accessibility.h" |
| 30 #endif | 30 #endif |
| 31 #if defined(OS_LINUX) | 31 #if defined(OS_LINUX) |
| 32 #include "app/scoped_handle_gtk.h" | 32 #include "app/scoped_handle_gtk.h" |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 namespace views { | 35 namespace views { |
| 36 | 36 |
| 37 // static | 37 // static |
| 38 ViewsDelegate* ViewsDelegate::views_delegate = NULL; | 38 ViewsDelegate* ViewsDelegate::views_delegate = NULL; |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 gfx::NativeCursor View::GetCursorForPoint(Event::EventType event_type, | 443 gfx::NativeCursor View::GetCursorForPoint(Event::EventType event_type, |
| 444 const gfx::Point& p) { | 444 const gfx::Point& p) { |
| 445 return NULL; | 445 return NULL; |
| 446 } | 446 } |
| 447 | 447 |
| 448 bool View::HitTest(const gfx::Point& l) const { | 448 bool View::HitTest(const gfx::Point& l) const { |
| 449 if (l.x() >= 0 && l.x() < width() && l.y() >= 0 && l.y() < height()) { | 449 if (l.x() >= 0 && l.x() < width() && l.y() >= 0 && l.y() < height()) { |
| 450 if (HasHitTestMask()) { | 450 if (HasHitTestMask()) { |
| 451 gfx::Path mask; | 451 gfx::Path mask; |
| 452 GetHitTestMask(&mask); | 452 GetHitTestMask(&mask); |
| 453 ScopedRegion rgn(mask.CreateNativeRegion()); | |
| 454 // TODO: can this use SkRegion's contains instead? | 453 // TODO: can this use SkRegion's contains instead? |
| 455 #if defined(OS_WIN) | 454 #if defined(OS_WIN) |
| 455 base::win::ScopedRegion rgn(mask.CreateNativeRegion()); |
| 456 return !!PtInRegion(rgn, l.x(), l.y()); | 456 return !!PtInRegion(rgn, l.x(), l.y()); |
| 457 #elif defined(TOOLKIT_USES_GTK) | 457 #elif defined(TOOLKIT_USES_GTK) |
| 458 ScopedRegion rgn(mask.CreateNativeRegion()); |
| 458 return gdk_region_point_in(rgn.Get(), l.x(), l.y()); | 459 return gdk_region_point_in(rgn.Get(), l.x(), l.y()); |
| 459 #endif | 460 #endif |
| 460 } | 461 } |
| 461 // No mask, but inside our bounds. | 462 // No mask, but inside our bounds. |
| 462 return true; | 463 return true; |
| 463 } | 464 } |
| 464 // Outside our bounds. | 465 // Outside our bounds. |
| 465 return false; | 466 return false; |
| 466 } | 467 } |
| 467 | 468 |
| (...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1530 possible_drag = false; | 1531 possible_drag = false; |
| 1531 start_pt = gfx::Point(); | 1532 start_pt = gfx::Point(); |
| 1532 } | 1533 } |
| 1533 | 1534 |
| 1534 void View::DragInfo::PossibleDrag(const gfx::Point& p) { | 1535 void View::DragInfo::PossibleDrag(const gfx::Point& p) { |
| 1535 possible_drag = true; | 1536 possible_drag = true; |
| 1536 start_pt = p; | 1537 start_pt = p; |
| 1537 } | 1538 } |
| 1538 | 1539 |
| 1539 } // namespace | 1540 } // namespace |
| OLD | NEW |