diff -r d32171ae1288 -r 684b6a483ff6 indra/newview/llexpandabletextbox.h --- a/indra/newview/llexpandabletextbox.h Thu Mar 17 10:18:03 2011 -0400 +++ b/indra/newview/llexpandabletextbox.h Tue Mar 15 18:23:20 2011 +0200 @@ -77,6 +77,12 @@ */ void hideExpandText(); + /** + * Shows the "More" link if the text is too high to be completely + * visible without expanding the text box. Hides that link otherwise. + */ + void hideOrShowExpandTextAsNeeded(); + protected: LLTextBoxEx(const Params& p); diff -r d32171ae1288 -r 684b6a483ff6 indra/newview/llexpandabletextbox.cpp --- a/indra/newview/llexpandabletextbox.cpp Thu Mar 17 10:18:03 2011 -0400 +++ b/indra/newview/llexpandabletextbox.cpp Tue Mar 15 18:23:20 2011 +0200 @@ -123,10 +123,7 @@ { LLTextEditor::reshape(width, height, called_from_parent); - if (getTextPixelHeight() > getRect().getHeight()) - { - showExpandText(); - } + hideOrShowExpandTextAsNeeded(); } void LLExpandableTextBox::LLTextBoxEx::setText(const LLStringExplicit& text,const LLStyle::Params& input_params) @@ -136,17 +133,7 @@ mExpanderVisible = false; LLTextEditor::setText(text, input_params); - // text contents have changed, segments are cleared out - // so hide the expander and determine if we need it - //mExpanderVisible = false; - if (getTextPixelHeight() > getRect().getHeight()) - { - showExpandText(); - } - else - { - hideExpandText(); - } + hideOrShowExpandTextAsNeeded(); } @@ -200,6 +187,22 @@ return getTextBoundingRect().getHeight(); } +void LLExpandableTextBox::LLTextBoxEx::hideOrShowExpandTextAsNeeded() +{ + // Restore the text box contents to calculate the text height properly, + // otherwise if a part of the text is hidden under "More" link + // getTextPixelHeight() returns only the height of currently visible text + // including the "More" link. See STORM-250. + hideExpandText(); + + // Show the expander a.k.a. "More" link if we need it, depending on text + // contents height. If not, keep it hidden. + if (getTextPixelHeight() > getRect().getHeight()) + { + showExpandText(); + } +} + ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////