BScrollBar: Unify PreferredSize computations.

Reduces code duplication. This should not significantly affect
actually computed sizes.
This commit is contained in:
Augustin Cavalier 2020-07-04 19:48:42 -04:00
parent 9fe3529f3e
commit 9481a1ec39

View File

@ -1043,12 +1043,8 @@ BScrollBar::MaxSize()
BSize BSize
BScrollBar::PreferredSize() BScrollBar::PreferredSize()
{ {
BSize preferredSize = _MinSize(); BSize preferredSize;
if (fOrientation == B_HORIZONTAL) GetPreferredSize(&preferredSize.width, &preferredSize.height);
preferredSize.width *= 2;
else
preferredSize.height *= 2;
return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), preferredSize); return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), preferredSize);
} }