| 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/debug_utils.h" | 5 #include "ui/views/debug_utils.h" |
| 6 | 6 |
| 7 #include <ostream> | 7 #include <ostream> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
| 11 | 11 |
| 12 namespace views { | 12 namespace views { |
| 13 namespace { | 13 namespace { |
| 14 void PrintViewHierarchyImp(const View* view, | 14 void PrintViewHierarchyImp(const View* view, |
| 15 int indent, | 15 int indent, |
| 16 std::ostringstream* out) { | 16 std::ostringstream* out) { |
| 17 int ind = indent; | 17 int ind = indent; |
| 18 while (ind-- > 0) | 18 while (ind-- > 0) |
| 19 *out << ' '; | 19 *out << ' '; |
| 20 *out << view->GetClassName(); | 20 *out << view->GetClassName(); |
| 21 *out << ' '; | 21 *out << ' '; |
| 22 *out << view->id(); | 22 *out << view->id(); |
| 23 *out << '/'; |
| 24 *out << view->GetGroup(); |
| 23 *out << ' '; | 25 *out << ' '; |
| 24 *out << view->x() << "," << view->y() << ","; | 26 *out << view->x() << "," << view->y() << " ("; |
| 25 *out << view->bounds().right() << "," << view->bounds().bottom(); | 27 *out << view->bounds().width() << "x" << view->bounds().height(); |
| 26 *out << ' '; | 28 *out << ") "; |
| 27 *out << view; | 29 *out << view; |
| 28 *out << '\n'; | 30 *out << '\n'; |
| 29 | 31 |
| 30 for (int i = 0, count = view->child_count(); i < count; ++i) | 32 for (int i = 0, count = view->child_count(); i < count; ++i) |
| 31 PrintViewHierarchyImp(view->child_at(i), indent + 2, out); | 33 PrintViewHierarchyImp(view->child_at(i), indent + 2, out); |
| 32 } | 34 } |
| 33 | 35 |
| 34 void PrintFocusHierarchyImp(const View* view, | 36 void PrintFocusHierarchyImp(const View* view, |
| 35 int indent, | 37 int indent, |
| 36 std::ostringstream* out) { | 38 std::ostringstream* out) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 65 | 67 |
| 66 void PrintFocusHierarchy(const View* view) { | 68 void PrintFocusHierarchy(const View* view) { |
| 67 std::ostringstream out; | 69 std::ostringstream out; |
| 68 out << "Focus hierarchy:\n"; | 70 out << "Focus hierarchy:\n"; |
| 69 PrintFocusHierarchyImp(view, 0, &out); | 71 PrintFocusHierarchyImp(view, 0, &out); |
| 70 // Error so users in the field can generate and upload logs. | 72 // Error so users in the field can generate and upload logs. |
| 71 LOG(ERROR) << out.str(); | 73 LOG(ERROR) << out.str(); |
| 72 } | 74 } |
| 73 | 75 |
| 74 } // namespace views | 76 } // namespace views |
| OLD | NEW |