AppKit: Size vertical scrollers by scroller style in CPScrollView

CPScrollView's frame and content size calculations sized the vertical scroller with scrollerWidthForControlSize:, passing a scroller style, so it always took the legacy width.

* CPScrollView: Use scrollerWidthInStyle: for the vertical scroller in +contentSizeForFrameSize:… and +frameSizeForContentSize:….
* CPScrollViewTest: Add tests for both methods with a scroller whose widths differ by style.
This commit is contained in:
David Richardson committed 2026-10-22 12:36:32 -06:00
1 parent 99b47c9a29
commit 203bf38b21
2 files changed
+45 -2

No files matched your search

+2 -2
View File
@@ -207,7 +207,7 @@ var CPScrollerStyleGlobal = CPScrollerStyleOverlay,
bounds.size.height -= [horizontalScrollerClass scrollerWidthInStyle:scrollerStyle];
if (verticalScrollerClass)
bounds.size.width -= [verticalScrollerClass scrollerWidthForControlSize:scrollerStyle];
bounds.size.width -= [verticalScrollerClass scrollerWidthInStyle:scrollerStyle];
return bounds.size;
}
@@ -240,7 +240,7 @@ var CPScrollerStyleGlobal = CPScrollerStyleOverlay,
frameSize.height += [horizontalScrollerClass scrollerWidthInStyle:scrollerStyle];
if (verticalScrollerClass)
frameSize.width += [verticalScrollerClass scrollerWidthForControlSize:scrollerStyle];
frameSize.width += [verticalScrollerClass scrollerWidthInStyle:scrollerStyle];
return frameSize;
}