NSTextField Redrawing of Background With Layer-Backing

Number:rdar://13006140 Date Originated:Jan 14, 2013
Status:Open Resolved:
Product:Mac OS X Product Version:10.8.2
Classification:Other Bug Reproducible:Always

When used as subview of a view that has layer-backing turned on then making it wider causes the background color to not fill the entire area of the control.

I am seeing this bug in a scenario where I have a text field in an inspector panel that I can change in width via an NSSplitView. I attached a screen shot of the bug how it appears on an empty text field without the workaround mentioned below.

Steps to Reproduce:

- have an NSView that has layer-backing turned on
- add an NSTextField as a subview to that
- have layout constraints that fix the left and right margin between the text field and the superview
- enlarge the NSView

Expected Results:

- the background color of the control should be filled consistently
- the amount of text in the textfield seems to play a role. If it is empty then the unfilled background stays. If not then it might get filled once the user release the mouse button

Actual Results:

- only the part of the control that was visible before stays filled, the new space appearing on the right side does not have background filling


- only occurs in connection with layers.


As workaround I subclassed NSTextField and overwrite drawRect like this:

- (void)drawRect:(NSRect)dirtyRect
	[super drawRect:self.bounds];

This fixes the problem because the dirtyRect is too small.


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!