From 34c599858bd64b7fbda767ff9c9f7d8bcd2c2c25 Mon Sep 17 00:00:00 2001
From: Seth ProductEngine <slitovchuk@productengine.com>
Date: Fri, 16 Mar 2012 01:08:20 +0200
Subject: CHUI-53 FIXED vertical scroll bar in inventory floater to appear when
 horizontal scroll bar hides last item in folder view. Added a scroll
 container which provides the information about the height of currently
 displayed folder view contents. It is used for updating vertical scroll bar
 visibility in inventory panel.

---
 indra/llui/llscrollcontainer.cpp | 15 +++++++++++----
 indra/llui/llscrollcontainer.h   |  6 ++++--
 2 files changed, 15 insertions(+), 6 deletions(-)

(limited to 'indra/llui')

diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp
index 20bed050ad..9b7e30bb04 100644
--- a/indra/llui/llscrollcontainer.cpp
+++ b/indra/llui/llscrollcontainer.cpp
@@ -389,10 +389,17 @@ void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height
 		{
 			*show_h_scrollbar = TRUE;
 			*visible_height -= scrollbar_size;
-			// Note: Do *not* recompute *show_v_scrollbar here because with
-			// the (- scrollbar_size) we just did we will always add a vertical scrollbar
-			// even if the height of the items is actually less than the visible size.
-			// Fear not though: there's enough calcVisibleSize() calls to add a vertical slider later.
+
+			// The view inside the scroll container should not be extended
+			// to container's full height to ensure the correct computation
+			// of *show_v_scrollbar after subtracting horizontal scrollbar_size.
+
+			// Must retest now that visible_height has changed
+			if( !*show_v_scrollbar && ((doc_height - *visible_height) > 1) )
+			{
+				*show_v_scrollbar = TRUE;
+				*visible_width -= scrollbar_size;
+			}
 		}
 	}
 }
diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h
index 3aa79cc255..d87c95b3d7 100644
--- a/indra/llui/llscrollcontainer.h
+++ b/indra/llui/llscrollcontainer.h
@@ -91,7 +91,7 @@ public:
 	void			setReserveScrollCorner( BOOL b ) { mReserveScrollCorner = b; }
 	LLRect			getVisibleContentRect();
 	LLRect			getContentWindowRect();
-	const LLRect&	getScrolledViewRect() const { return mScrolledView ? mScrolledView->getRect() : LLRect::null; }
+	virtual const LLRect	getScrolledViewRect() const { return mScrolledView ? mScrolledView->getRect() : LLRect::null; }
 	void			pageUp(S32 overlap = 0);
 	void			pageDown(S32 overlap = 0);
 	void			goToTop();
@@ -116,6 +116,9 @@ public:
 	
 	bool autoScroll(S32 x, S32 y);
 
+protected:
+	LLView*		mScrolledView;
+
 private:
 	// internal scrollbar handlers
 	virtual void scrollHorizontal( S32 new_pos );
@@ -124,7 +127,6 @@ private:
 	void calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const;
 
 	LLScrollbar* mScrollbar[SCROLLBAR_COUNT];
-	LLView*		mScrolledView;
 	S32			mSize;
 	BOOL		mIsOpaque;
 	LLUIColor	mBackgroundColor;
-- 
cgit v1.2.3