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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 void View::Paint(const ui::PaintContext& parent_context) { | 820 void View::Paint(const ui::PaintContext& parent_context) { |
821 if (!visible_) | 821 if (!visible_) |
822 return; | 822 return; |
823 if (size().IsEmpty()) | 823 if (size().IsEmpty()) |
824 return; | 824 return; |
825 | 825 |
826 gfx::Vector2d offset_to_parent; | 826 gfx::Vector2d offset_to_parent; |
827 if (!layer()) { | 827 if (!layer()) { |
828 // If the View has a layer() then it is a paint root. Otherwise, we need to | 828 // If the View has a layer() then it is a paint root. Otherwise, we need to |
829 // add the offset from the parent into the total offset from the paint root. | 829 // add the offset from the parent into the total offset from the paint root. |
830 DCHECK(parent() || bounds().origin() == gfx::Point()); | 830 DCHECK(parent() || origin() == gfx::Point()); |
831 offset_to_parent = GetMirroredPosition().OffsetFromOrigin(); | 831 offset_to_parent = GetMirroredPosition().OffsetFromOrigin(); |
832 } | 832 } |
833 ui::PaintContext context(parent_context, offset_to_parent); | 833 ui::PaintContext context(parent_context, offset_to_parent); |
834 | 834 |
835 bool is_invalidated = true; | 835 bool is_invalidated = true; |
836 if (context.CanCheckInvalid()) { | 836 if (context.CanCheckInvalid()) { |
837 #if DCHECK_IS_ON() | 837 #if DCHECK_IS_ON() |
838 gfx::Vector2d offset; | 838 gfx::Vector2d offset; |
839 context.Visited(this); | 839 context.Visited(this); |
840 View* view = this; | 840 View* view = this; |
(...skipping 1689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2530 // Message the RootView to do the drag and drop. That way if we're removed | 2530 // Message the RootView to do the drag and drop. That way if we're removed |
2531 // the RootView can detect it and avoid calling us back. | 2531 // the RootView can detect it and avoid calling us back. |
2532 gfx::Point widget_location(event.location()); | 2532 gfx::Point widget_location(event.location()); |
2533 ConvertPointToWidget(this, &widget_location); | 2533 ConvertPointToWidget(this, &widget_location); |
2534 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2534 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
2535 // WARNING: we may have been deleted. | 2535 // WARNING: we may have been deleted. |
2536 return true; | 2536 return true; |
2537 } | 2537 } |
2538 | 2538 |
2539 } // namespace views | 2539 } // namespace views |
OLD | NEW |