NSScrollView does not invalidate NSScroller size

Originator:christian.tietze
Number:rdar://33196826 Date Originated:2017-07-08
Status:Open Resolved:
Product:AppKit Product Version:
Classification:Bug Reproducible:Always
 
Area:
AppKit

Summary:
NSScrollView asks its NSScrollers to `drawKnob()` when you scroll; it also queries `rect(for: .knob)`. But the actual drawing is not affected until you command-tab out of the app or scroll to the edges of the document to make the knobs shrink. This means there's no programmatic way to initiate a change in the drawing reliably as the scroll view seems to cache the drawing result, even though the reported rectangle changes.

Steps to Reproduce:
- add a text view inside a NSScrollView to the app
- create a custom NSScroller subclass and use it as the vertical scroller
- create a toggle that affects the style of the custom scroller, e.g. change the `rect(for: .knob)` size and draw something different than before in `drawKnob()`

See minimal sample project: https://github.com/DivineDominion/bugreport_NSScrollerKnob

Expected Results:
The knob changes its appearance and size the next time it becomes visible.

Observed Results:
The knob stays as it was until you command-tab out of the app or move the knob to the edges of the scroll view to make it shrink.

Version:
10.12.5 (16F73)

Notes:
Minimal sample project: https://github.com/DivineDominion/bugreport_NSScrollerKnob

Configuration:
Using a Magic Trackpad and having auto-hiding scrollers enabled.

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!