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