From 2cd7a7550991df90288aa4c7e2fbe2598cc3c296 Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Fri, 27 Jan 2012 18:40:23 -0800
Subject: EXP-1747, EXP-1152 : Fixed visual glitches in computation of visible
 width in inventory.

---
 indra/llui/llscrollcontainer.cpp   | 18 ++++++++----------
 indra/newview/llfolderview.cpp     | 12 ++++++------
 indra/newview/llfolderviewitem.cpp |  6 +++---
 indra/newview/llfolderviewitem.h   |  1 +
 4 files changed, 18 insertions(+), 19 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp
index ad4cc20d9a..20bed050ad 100644
--- a/indra/llui/llscrollcontainer.cpp
+++ b/indra/llui/llscrollcontainer.cpp
@@ -378,23 +378,21 @@ void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height
 
 	if (!mHideScrollbar)
 	{
-		if( *visible_height < doc_height )
+		// Note: 1 pixel change can happen on final animation and should not trigger 
+		// the display of sliders.
+		if ((doc_height - *visible_height) > 1)
 		{
 			*show_v_scrollbar = TRUE;
 			*visible_width -= scrollbar_size;
 		}
-
-		if( *visible_width < doc_width )
+		if ((doc_width - *visible_width) > 1)
 		{
 			*show_h_scrollbar = TRUE;
 			*visible_height -= scrollbar_size;
-
-			// Must retest now that visible_height has changed
-			if( !*show_v_scrollbar && (*visible_height < doc_height) )
-			{
-				*show_v_scrollbar = TRUE;
-				*visible_width -= 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.
 		}
 	}
 }
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index e0d7d67f7d..79c987fa37 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -388,7 +388,7 @@ void LLFolderView::setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse
 
 static LLFastTimer::DeclareTimer FTM_ARRANGE("Arrange");
 
-// This view grows and shinks to enclose all of its children items and folders.
+// This view grows and shrinks to enclose all of its children items and folders.
 S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_generation )
 {
 	if (getListener()->getUUID().notNull())
@@ -527,15 +527,15 @@ void LLFolderView::reshape(S32 width, S32 height, BOOL called_from_parent)
 		LLView::reshape(width, height, called_from_parent);
 		scroll_rect = mScrollContainer->getContentWindowRect();
 	}
-	width = llmax(mMinWidth, scroll_rect.getWidth());
+	width  = llmax(mMinWidth, scroll_rect.getWidth());
 	height = llmax(mRunningHeight, scroll_rect.getHeight());
 
-	// restrict width with scroll container's width
-	if (mUseEllipses)
+	// Restrict width within scroll container's width
+	if (mUseEllipses && mScrollContainer)
+	{
 		width = scroll_rect.getWidth();
-
+	}
 	LLView::reshape(width, height, called_from_parent);
-
 	mReshapeSignal(mSelectedItems, FALSE);
 }
 
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index 9944a9dd3d..734adbc648 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -410,8 +410,8 @@ BOOL LLFolderViewItem::addToFolder(LLFolderViewFolder* folder, LLFolderView* roo
 }
 
 
-// Finds width and height of this object and it's children.  Also
-// makes sure that this view and it's children are the right size.
+// Finds width and height of this object and its children.  Also
+// makes sure that this view and its children are the right size.
 S32 LLFolderViewItem::arrange( S32* width, S32* height, S32 filter_generation)
 {
 	const Params& p = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
@@ -423,7 +423,7 @@ S32 LLFolderViewItem::arrange( S32* width, S32* height, S32 filter_generation)
 		: 0;
 	if (mLabelWidthDirty)
 	{
-		mLabelWidth = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel) + getLabelFontForStyle(mLabelStyle)->getWidth(mLabelSuffix); 
+		mLabelWidth = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + getLabelFontForStyle(mLabelStyle)->getWidth(mLabel) + getLabelFontForStyle(mLabelStyle)->getWidth(mLabelSuffix) + TEXT_PAD_RIGHT; 
 		mLabelWidthDirty = false;
 	}
 
diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h
index 2fc79f5765..4e8dc2da16 100644
--- a/indra/newview/llfolderviewitem.h
+++ b/indra/newview/llfolderviewitem.h
@@ -114,6 +114,7 @@ public:
 	static const S32 ICON_PAD = 2;
 	static const S32 ICON_WIDTH = 16;
 	static const S32 TEXT_PAD = 1;
+	static const S32 TEXT_PAD_RIGHT = 4;
 	static const S32 ARROW_SIZE = 12;
 	static const S32 MAX_FOLDER_ITEM_OVERLAP = 2;
 	// animation parameters
-- 
cgit v1.2.3