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 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 | 770 |
771 // If the View wasn't invalidated, don't waste time painting it, the output | 771 // If the View wasn't invalidated, don't waste time painting it, the output |
772 // would be culled. | 772 // would be culled. |
773 is_invalidated = context.IsRectInvalid(GetLocalBounds()); | 773 is_invalidated = context.IsRectInvalid(GetLocalBounds()); |
774 } | 774 } |
775 | 775 |
776 TRACE_EVENT1("views", "View::Paint", "class", GetClassName()); | 776 TRACE_EVENT1("views", "View::Paint", "class", GetClassName()); |
777 | 777 |
778 // If the view is backed by a layer, it should paint with itself as the origin | 778 // If the view is backed by a layer, it should paint with itself as the origin |
779 // rather than relative to its parent. | 779 // rather than relative to its parent. |
780 ui::ClipTransformRecorder clip_transform_recorder(context); | 780 ui::ClipTransformRecorder clip_transform_recorder(context, size()); |
781 if (!layer()) { | 781 if (!layer()) { |
782 // Set the clip rect to the bounds of this View. Note that the X (or left) | 782 // Set the clip rect to the bounds of this View. Note that the X (or left) |
783 // position we pass to ClipRect takes into consideration whether or not the | 783 // position we pass to ClipRect takes into consideration whether or not the |
784 // View uses a right-to-left layout so that we paint the View in its | 784 // View uses a right-to-left layout so that we paint the View in its |
785 // mirrored position if need be. | 785 // mirrored position if need be. |
786 gfx::Rect clip_rect_in_parent = bounds(); | 786 gfx::Rect clip_rect_in_parent = bounds(); |
787 clip_rect_in_parent.Inset(clip_insets_); | 787 clip_rect_in_parent.Inset(clip_insets_); |
788 if (parent_) | 788 if (parent_) |
789 clip_rect_in_parent.set_x( | 789 clip_rect_in_parent.set_x( |
790 parent_->GetMirroredXForRect(clip_rect_in_parent)); | 790 parent_->GetMirroredXForRect(clip_rect_in_parent)); |
(...skipping 1563 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 |