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 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 void View::Paint(const ui::PaintContext& parent_context) { | 734 void View::Paint(const ui::PaintContext& parent_context) { |
735 if (!visible_) | 735 if (!visible_) |
736 return; | 736 return; |
737 if (size().IsEmpty()) | 737 if (size().IsEmpty()) |
738 return; | 738 return; |
739 | 739 |
740 gfx::Vector2d offset_to_parent; | 740 gfx::Vector2d offset_to_parent; |
741 if (!layer()) { | 741 if (!layer()) { |
742 // If the View has a layer() then it is a paint root. Otherwise, we need to | 742 // If the View has a layer() then it is a paint root. Otherwise, we need to |
743 // add the offset from the parent into the total offset from the paint root. | 743 // add the offset from the parent into the total offset from the paint root. |
744 DCHECK_IMPLIES(!parent(), bounds().origin() == gfx::Point()); | 744 DCHECK(parent() || bounds().origin() == gfx::Point()); |
745 offset_to_parent = GetMirroredPosition().OffsetFromOrigin(); | 745 offset_to_parent = GetMirroredPosition().OffsetFromOrigin(); |
746 } | 746 } |
747 ui::PaintContext context(parent_context, offset_to_parent); | 747 ui::PaintContext context(parent_context, offset_to_parent); |
748 | 748 |
749 bool is_invalidated = true; | 749 bool is_invalidated = true; |
750 if (context.CanCheckInvalid()) { | 750 if (context.CanCheckInvalid()) { |
751 #if DCHECK_IS_ON() | 751 #if DCHECK_IS_ON() |
752 gfx::Vector2d offset; | 752 gfx::Vector2d offset; |
753 context.Visited(this); | 753 context.Visited(this); |
754 View* view = this; | 754 View* view = this; |
(...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 // Message the RootView to do the drag and drop. That way if we're removed | 2356 // Message the RootView to do the drag and drop. That way if we're removed |
2357 // the RootView can detect it and avoid calling us back. | 2357 // the RootView can detect it and avoid calling us back. |
2358 gfx::Point widget_location(event.location()); | 2358 gfx::Point widget_location(event.location()); |
2359 ConvertPointToWidget(this, &widget_location); | 2359 ConvertPointToWidget(this, &widget_location); |
2360 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2360 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
2361 // WARNING: we may have been deleted. | 2361 // WARNING: we may have been deleted. |
2362 return true; | 2362 return true; |
2363 } | 2363 } |
2364 | 2364 |
2365 } // namespace views | 2365 } // namespace views |
OLD | NEW |