Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: ui/views/view.cc

Issue 2595163002: Add origin() method on View and use it to simplify some callers. (Closed)
Patch Set: Resync Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/view.h ('k') | ui/views/window/dialog_client_view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/views/view.h ('k') | ui/views/window/dialog_client_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698