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/controls/tree/tree_view_views.h" | 5 #include "ui/views/controls/tree/tree_view_views.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 return true; | 333 return true; |
334 } | 334 } |
335 | 335 |
336 void TreeView::ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture) { | 336 void TreeView::ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture) { |
337 if (!model_) | 337 if (!model_) |
338 return; | 338 return; |
339 if (is_mouse_gesture) { | 339 if (is_mouse_gesture) { |
340 // Only invoke View's implementation (which notifies the | 340 // Only invoke View's implementation (which notifies the |
341 // ContextMenuController) if over a node. | 341 // ContextMenuController) if over a node. |
342 gfx::Point local_point(p); | 342 gfx::Point local_point(p); |
343 ConvertPointToView(NULL, this, &local_point); | 343 ConvertPointToTarget(NULL, this, &local_point); |
344 int row = (local_point.y() - kVerticalInset) / row_height_; | 344 int row = (local_point.y() - kVerticalInset) / row_height_; |
345 int depth; | 345 int depth; |
346 InternalNode* node = GetNodeByRow(row, &depth); | 346 InternalNode* node = GetNodeByRow(row, &depth); |
347 if (!node) | 347 if (!node) |
348 return; | 348 return; |
349 gfx::Rect bounds(GetBoundsForNodeImpl(node, row, depth)); | 349 gfx::Rect bounds(GetBoundsForNodeImpl(node, row, depth)); |
350 if (!bounds.Contains(local_point)) | 350 if (!bounds.Contains(local_point)) |
351 return; | 351 return; |
352 } | 352 } |
353 View::ShowContextMenu(p, is_mouse_gesture); | 353 View::ShowContextMenu(p, is_mouse_gesture); |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 if (!is_expanded_) | 902 if (!is_expanded_) |
903 return max_width; | 903 return max_width; |
904 for (int i = 0; i < child_count(); ++i) { | 904 for (int i = 0; i < child_count(); ++i) { |
905 max_width = std::max(max_width, | 905 max_width = std::max(max_width, |
906 GetChild(i)->GetMaxWidth(indent, depth + 1)); | 906 GetChild(i)->GetMaxWidth(indent, depth + 1)); |
907 } | 907 } |
908 return max_width; | 908 return max_width; |
909 } | 909 } |
910 | 910 |
911 } // namespace views | 911 } // namespace views |
OLD | NEW |