| 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 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 DCHECK(p); | 692 DCHECK(p); |
| 693 | 693 |
| 694 const views::Widget* widget = dst->GetWidget(); | 694 const views::Widget* widget = dst->GetWidget(); |
| 695 if (!widget) | 695 if (!widget) |
| 696 return; | 696 return; |
| 697 *p -= widget->GetClientAreaBoundsInScreen().OffsetFromOrigin(); | 697 *p -= widget->GetClientAreaBoundsInScreen().OffsetFromOrigin(); |
| 698 views::View::ConvertPointFromWidget(dst, p); | 698 views::View::ConvertPointFromWidget(dst, p); |
| 699 } | 699 } |
| 700 | 700 |
| 701 gfx::Rect View::ConvertRectToParent(const gfx::Rect& rect) const { | 701 gfx::Rect View::ConvertRectToParent(const gfx::Rect& rect) const { |
| 702 gfx::RectF x_rect = rect; | 702 gfx::RectF x_rect = gfx::RectF(rect); |
| 703 GetTransform().TransformRect(&x_rect); | 703 GetTransform().TransformRect(&x_rect); |
| 704 x_rect.Offset(GetMirroredPosition().OffsetFromOrigin()); | 704 x_rect.Offset(GetMirroredPosition().OffsetFromOrigin()); |
| 705 // Pixels we partially occupy in the parent should be included. | 705 // Pixels we partially occupy in the parent should be included. |
| 706 return gfx::ToEnclosingRect(x_rect); | 706 return gfx::ToEnclosingRect(x_rect); |
| 707 } | 707 } |
| 708 | 708 |
| 709 gfx::Rect View::ConvertRectToWidget(const gfx::Rect& rect) const { | 709 gfx::Rect View::ConvertRectToWidget(const gfx::Rect& rect) const { |
| 710 gfx::Rect x_rect = rect; | 710 gfx::Rect x_rect = rect; |
| 711 for (const View* v = this; v; v = v->parent_) | 711 for (const View* v = this; v; v = v->parent_) |
| 712 x_rect = v->ConvertRectToParent(x_rect); | 712 x_rect = v->ConvertRectToParent(x_rect); |
| (...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2349 // Message the RootView to do the drag and drop. That way if we're removed | 2349 // Message the RootView to do the drag and drop. That way if we're removed |
| 2350 // the RootView can detect it and avoid calling us back. | 2350 // the RootView can detect it and avoid calling us back. |
| 2351 gfx::Point widget_location(event.location()); | 2351 gfx::Point widget_location(event.location()); |
| 2352 ConvertPointToWidget(this, &widget_location); | 2352 ConvertPointToWidget(this, &widget_location); |
| 2353 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2353 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
| 2354 // WARNING: we may have been deleted. | 2354 // WARNING: we may have been deleted. |
| 2355 return true; | 2355 return true; |
| 2356 } | 2356 } |
| 2357 | 2357 |
| 2358 } // namespace views | 2358 } // namespace views |
| OLD | NEW |