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

Unified Diff: ui/base/cocoa/view_description.mm

Issue 16266010: Add -[NSView(CrDebugging) cr_recursiveDescription]. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/cocoa/view_description.h ('k') | ui/ui.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/cocoa/view_description.mm
diff --git a/ui/base/cocoa/view_description.mm b/ui/base/cocoa/view_description.mm
new file mode 100644
index 0000000000000000000000000000000000000000..1734f8817be9b774b9090835a6fa166017bcb9be
--- /dev/null
+++ b/ui/base/cocoa/view_description.mm
@@ -0,0 +1,31 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ui/base/cocoa/view_description.h"
+
+#if !NDEBUG
+
+@implementation NSView (CrDebugging)
+
+- (NSString*)cr_recursiveDescriptionWithPrefix:(NSString*)prefix {
+ NSString* description =
+ [NSString stringWithFormat:@"%@ <%@ %p, frame=%@, hidden=%d>\n",
+ prefix, [self class], self, NSStringFromRect([self frame]),
+ [self isHidden]];
+ prefix = [prefix stringByAppendingString:@"--"];
+
+ for (NSView* subview in [self subviews]) {
+ description = [description stringByAppendingString:
+ [subview cr_recursiveDescriptionWithPrefix:prefix]];
+ }
+ return description;
+}
+
+- (NSString*)cr_recursiveDescription {
+ return [self cr_recursiveDescriptionWithPrefix:@""];
+}
+
+@end
+
+#endif // !NDEBUG
« no previous file with comments | « ui/base/cocoa/view_description.h ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698