- add sources.
[platform/framework/web/crosswalk.git] / src / ui / base / cocoa / view_description.mm
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #import "ui/base/cocoa/view_description.h"
6
7 #if !NDEBUG
8
9 @implementation NSView (CrDebugging)
10
11 - (NSString*)cr_recursiveDescriptionWithPrefix:(NSString*)prefix {
12   NSString* description =
13       [NSString stringWithFormat:@"%@ <%@ %p, frame=%@, hidden=%d>\n",
14           prefix, [self class], self, NSStringFromRect([self frame]),
15           [self isHidden]];
16   prefix = [prefix stringByAppendingString:@"--"];
17
18   for (NSView* subview in [self subviews]) {
19     description = [description stringByAppendingString:
20         [subview cr_recursiveDescriptionWithPrefix:prefix]];
21   }
22   return description;
23 }
24
25 - (NSString*)cr_recursiveDescription {
26   return [self cr_recursiveDescriptionWithPrefix:@""];
27 }
28
29 @end
30
31 #endif  // !NDEBUG