NSView in an NSMenuItem rendered incorrectly if it has a subview in 10.10

Originator:amolloy
Number:rdar://20427729 Date Originated:4/4/2015
Status:Open Resolved:
Product:OS X Product Version:10.10
Classification:UI/Usability Reproducible:Always
 
Summary:
On OS X 10.10, if an NSView is embedded in an NSMenuItem, and a subview is added to that view, the view will render colors incorrectly. In particular, it appears as though as a color's brightness approaches full white, its alpha component drops off, with full white being fully transparent. This only happens if the view contains a subview, and it does NOT happen if the "Reduce transparency" option is enabled in the Accessibility pane of the System Preferences. This can be seen using the attached project, as well as the attached screenshot. In the screenshot, there are three pairs of views embedded in NSMenuItems (indicated by the red arrows). The view in each pair is drawn by simply filling the view's bounds a solid color, with the same color used in both views in the pair. The top view of each pair has no other subviews, the bottom has an additional subview. The only difference between the views in each pair is the top has no subviews, the bottom has a single subview.

Steps to Reproduce:
1. Load the attached project into Xcode 6.2
2. Run the main target on 10.10 with the Reduced transparency accessibility option turned OFF
3. When the application's window appears, right click anywhere in the application's window. 

Expected Results:
In the menu which appears, three pairs of menu items should appear. Within each pair, the background color should match exactly.

Actual Results:
In the menu which appears, the background colors of the views in each pair differ. This is most apparent in the top pair, which should both have a white background. 

Version:
OS X 10.10.2 and 10.10.3 (I have not tried it on earlier versions of 10.10). 

Notes:
As seen in the "SomeWhite.png" screenshot (taken from an app I am developing), in some situations some portion of the view does draw correctly, though I was unable to get this to happen in the attached demo app. In that screenshot, the entire blue image should be surrounded by a white square, but only the top-left quadrant is covered. Moving the subview (in this case an NSButton) causes the correctly drawn portion to move as well.

Configuration:
This occurs on OS X 10.10 in every version I've tried (10.10.2 and 10.10.3). This does not occur in OS X 10.9 or in 10.10 if the "Reduced transparency" accessibility option is turned ON. 

Attachments:
'NSMenuItemViewIssues.zip', 'Untitled.png' and 'SomeWhite.png' were successfully uploaded.

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!