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 #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 Loading... |
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 Loading... |
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 |
OLD | NEW |