Expanding/collapsing sidebar next to NSTextView embedded in NSScrollView will result in many _NSClipOverhangView objects and incorrect layout

Originator:christian.tietze
Number:rdar://47044251 Date Originated:2019-01-04
Status:Open Resolved:
Product:macOS + SDK Product Version:
Classification:Bug Reproducible:Always
 
Area:
AppKit

Summary:

Collapsing & expanding NSSplitView sidebars rapidly breaks the layout of text in NSTextViews. (See screencapture.mp4) When it breaks, the view hierarchy contains many _NSClipOverhangViews (see screenshots "broken clip view" 1 and 2).

Steps to Reproduce:

- Open the example project from the .zip I attached.
- Trigger "Show Sidebar" from the menu rapidly using a keyboard shortcut (Cmd-Ctrl-S)

To set up a new project with the same problem from scratch:

- Use a NSSplitViewController in the Storyboard with the left item as "Sidebar", and the right view controller containing a scrollable text view; the scroll view is pinned to all 4 sides of its view controller's contentView
- Wire "View > Show Sidebar" to "First Responder"'s -toggleSidebar:
- Show a long text in the text view
- Trigger "Show Sidebar" rapidly


Expected Results:

The text view  layouts its contents to fit the width of the container at every stage of the animation and after the collapse/expansion is finished.

Actual Results:

The text view ends up displaying text too wide so you have to scroll horizontally; or it displays the text in too narrow a container.

Version/Build:

Xcode Version 10.1 (10B61)
macOS 10.14.2 (18C54)

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!