AppKit: Standard About panel does not center RTF/HTML credits with overlay scrollers
| Originator: | nriley | ||
| Number: | rdar://14829080 | Date Originated: | 24-Aug-2013 11:43 PM |
| Status: | Open | Resolved: | |
| Product: | OS X | Product Version: | 10.8.4/12E55 |
| Classification: | UI/Usability | Reproducible: | Always |
Summary:
With overlay scrollers enabled, the standard Cocoa About panel does not center RTF/HTML credits; instead they are offset to the left.
Steps to Reproduce:
1. Make sure overlay scrollers are enabled.
2. Open Preview (as an example of an Apple app with RTF credits).
Expected Results:
"Map imagery owned by NASA…" is horizontally centered in the panel.
Actual Results:
"Map imagery owned by NASA…" is horizontally offset to the left.
Regression:
This does not occur if overlay scrollers are disabled at the time the About panel is first displayed.
Notes:
The NSTextView width does not match that of the NSClipView.
The following is a relatively robust workaround which also contains some debug logging that demonstrates the problem:
- (IBAction)orderFrontAboutPanel:(id)sender;
{
// XXX work around bug in OS X 10.7 / 10.8 where the Credits text is not centered
NSSet *windowsBefore = [NSSet setWithArray:[NSApp windows]];
[NSApp orderFrontStandardAboutPanelWithOptions:nil];
for (NSWindow *window in [NSApp windows]) {
if ([windowsBefore containsObject:window])
continue;
for (NSView *view in [[window contentView] subviews]) {
if (![view isKindOfClass:[NSScrollView class]])
continue;
NSClipView *clipView = [(NSScrollView *)view contentView];
NSRect clipViewFrame = [clipView frame];
NSView *documentView = [clipView documentView];
NSRect documentViewFrame = [documentView frame];
if (clipViewFrame.size.height != documentViewFrame.size.height)
continue; // don't mess with a scrollable view
if (clipViewFrame.size.width != documentViewFrame.size.width) {
NSLog(@"%@", [view _subtreeDescription]);
documentViewFrame.size.width = clipViewFrame.size.width;
[documentView setFrame:documentViewFrame];
NSLog(@"%@", [view _subtreeDescription]);
break;
}
}
break;
}
}
Sample output:
2013-08-24 23:34:24.339 Shroud[99473:303] [ AF LU ] h=--- v=&-- NSScrollView 0x101a7d260 f=(12,40,260,36) b=(-) TIME drawRect: min/mean/max 0.00/0.00/0.00 ms
[ AF G LU ] h=--- v=--- NSClipView 0x101a7df30 f=(0,0,260,36) b=(15,0,-,-) TIME drawRect: min/mean/max 0.00/0.00/0.00 ms
[ AF G LU ] h=-&- v=-&- NSTextView 0x101a7f160 f=(0,0,275,36) b=(-) TIME drawRect: min/mean/max 0.00/0.00/0.00 ms
[ HAF LU#] h=--- v=--- NSScroller 0x101a83f10 f=(-100,-100,16,54) b=(-) TIME drawRect: min/mean/max 0.00/0.00/0.00 ms
[ HAF LU#] h=--- v=--- NSScroller 0x101a84230 f=(-100,-100,87,18) b=(-) TIME drawRect: min/mean/max 0.00/0.00/0.00 ms
A=autoresizesSubviews, C=canDrawConcurrently, D=needsDisplay, F=flipped, G=gstate, H=hidden (h=by ancestor), L=needsLayout (l=child needsLayout), U=needsUpdateConstraints (u=child needsUpdateConstraints), O=opaque, P=preservesContentDuringLiveResize, S=scaled/rotated, W=wantsLayer (w=ancestor wantsLayer), #=has surface
2013-08-24 23:34:24.340 Shroud[99473:303] [ D AF LU ] h=--- v=&-- NSScrollView 0x101a7d260 f=(12,40,260,36) b=(-) TIME drawRect: min/mean/max 0.00/0.00/0.00 ms
[ D AF G LU ] h=--- v=--- NSClipView 0x101a7df30 f=(0,0,260,36) b=(-) TIME drawRect: min/mean/max 0.00/0.00/0.00 ms
[ D AF G LU ] h=-&- v=-&- NSTextView 0x101a7f160 f=(0,0,260,36) b=(-) TIME drawRect: min/mean/max 0.00/0.00/0.00 ms
[ HAF LU#] h=--- v=--- NSScroller 0x101a83f10 f=(-100,-100,16,54) b=(-) TIME drawRect: min/mean/max 0.00/0.00/0.00 ms
[ HAF LU#] h=--- v=--- NSScroller 0x101a84230 f=(-100,-100,87,18) b=(-) TIME drawRect: min/mean/max 0.00/0.00/0.00 ms
A=autoresizesSubviews, C=canDrawConcurrently, D=needsDisplay, F=flipped, G=gstate, H=hidden (h=by ancestor), L=needsLayout (l=child needsLayout), U=needsUpdateConstraints (u=child needsUpdateConstraints), O=opaque, P=preservesContentDuringLiveResize, S=scaled/rotated, W=wantsLayer (w=ancestor wantsLayer), #=has surface
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Finally fixed in 10.13
See https://github.com/nriley/Pester/commit/ff8de300e1af8b6b7ce684450eb97581575593f1.
Still broken in 10.11 and 10.12
10.12 also breaks the workaround; will update this if I have a chance to update it.