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

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

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: cc/ fixes Created 8 years, 1 month 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/layout/box_layout.cc ('k') | ui/views/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 #include "ui/views/view.h" 5 #include "ui/views/view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 329
330 while (view != NULL && !vis_bounds.IsEmpty()) { 330 while (view != NULL && !vis_bounds.IsEmpty()) {
331 transform.ConcatTransform(view->GetTransform()); 331 transform.ConcatTransform(view->GetTransform());
332 transform.ConcatTranslate(static_cast<float>(view->GetMirroredX()), 332 transform.ConcatTranslate(static_cast<float>(view->GetMirroredX()),
333 static_cast<float>(view->y())); 333 static_cast<float>(view->y()));
334 334
335 vis_bounds = view->ConvertRectToParent(vis_bounds); 335 vis_bounds = view->ConvertRectToParent(vis_bounds);
336 const View* ancestor = view->parent_; 336 const View* ancestor = view->parent_;
337 if (ancestor != NULL) { 337 if (ancestor != NULL) {
338 ancestor_bounds.SetRect(0, 0, ancestor->width(), ancestor->height()); 338 ancestor_bounds.SetRect(0, 0, ancestor->width(), ancestor->height());
339 vis_bounds = vis_bounds.Intersect(ancestor_bounds); 339 vis_bounds.Intersect(ancestor_bounds);
340 } else if (!view->GetWidget()) { 340 } else if (!view->GetWidget()) {
341 // If the view has no Widget, we're not visible. Return an empty rect. 341 // If the view has no Widget, we're not visible. Return an empty rect.
342 return gfx::Rect(); 342 return gfx::Rect();
343 } 343 }
344 view = ancestor; 344 view = ancestor;
345 } 345 }
346 if (vis_bounds.IsEmpty()) 346 if (vis_bounds.IsEmpty())
347 return vis_bounds; 347 return vis_bounds;
348 // Convert back to this views coordinate system. 348 // Convert back to this views coordinate system.
349 transform.TransformRectReverse(&vis_bounds); 349 transform.TransformRectReverse(&vis_bounds);
(...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 gfx::Point widget_location(event.location()); 2122 gfx::Point widget_location(event.location());
2123 ConvertPointToWidget(this, &widget_location); 2123 ConvertPointToWidget(this, &widget_location);
2124 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations); 2124 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations);
2125 return true; 2125 return true;
2126 #else 2126 #else
2127 return false; 2127 return false;
2128 #endif // !defined(OS_MACOSX) 2128 #endif // !defined(OS_MACOSX)
2129 } 2129 }
2130 2130
2131 } // namespace views 2131 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/layout/box_layout.cc ('k') | ui/views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698