Our DNA is written in Swift

Radar: Horizontal Line Autolayout and Layer-Backing

There are apparently a great many views on Mac that don’t behave properly if you enable layer-backing. I recently reported a bug in drawing NSTextField backgrounds together with layer-backing, now here is a bug I found in NSBox.

Filed as rdar://13059657


An NSBox displaying a horizontal line as subview of a layer-backed NSView does not size correctly.

Steps to Reproduce

  • Have an NSView that you enable layer-backing on with setWantsLayer:YES
  • In Interface Builder add a “Horizontal Line” element to this view
  • Size it such that it goes the entire width of the superview and layout contraints are 0 px for left and right

Expected Results

  • The horizontal line should keep sizing together with the superview

Actual Results

  • The horizontal line only grows to around 1588px
  • If you disable layer backing on the superview the behavior returns to normal


  • Appears to be a problem with layer backing.


Possibly related to rdar://problem/13006140 where a text field background is not sized correctly in layer-backed mode.

Categories: Bug Reports

Leave a Comment

%d bloggers like this: