summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rwxr-xr-xindra/llui/lliconctrl.cpp14
-rwxr-xr-xindra/llui/lliconctrl.h4
-rwxr-xr-xindra/llui/llurlentry.cpp2
-rwxr-xr-xindra/llui/tests/llurlentry_test.cpp8
4 files changed, 24 insertions, 4 deletions
diff --git a/indra/llui/lliconctrl.cpp b/indra/llui/lliconctrl.cpp
index 58b66f60ca..f841901801 100755
--- a/indra/llui/lliconctrl.cpp
+++ b/indra/llui/lliconctrl.cpp
@@ -54,7 +54,9 @@ LLIconCtrl::LLIconCtrl(const LLIconCtrl::Params& p)
mUseDrawContextAlpha(p.use_draw_context_alpha),
mPriority(0),
mMinWidth(p.min_width),
- mMinHeight(p.min_height)
+ mMinHeight(p.min_height),
+ mMaxWidth(0),
+ mMaxHeight(0)
{
if (mImagep.notNull())
{
@@ -104,7 +106,15 @@ void LLIconCtrl::setValue(const LLSD& value )
&& mMinWidth
&& mMinHeight)
{
- mImagep->getImage()->setKnownDrawSize(llmax(mMinWidth, mImagep->getWidth()), llmax(mMinHeight, mImagep->getHeight()));
+ S32 desired_draw_width = llmax(mMinWidth, mImagep->getWidth());
+ S32 desired_draw_height = llmax(mMinHeight, mImagep->getHeight());
+ if (mMaxWidth && mMaxHeight)
+ {
+ desired_draw_width = llmin(desired_draw_width, mMaxWidth);
+ desired_draw_height = llmin(desired_draw_height, mMaxHeight);
+ }
+
+ mImagep->getImage()->setKnownDrawSize(desired_draw_width, desired_draw_height);
}
}
diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h
index 8b1092df46..7971cd44d3 100755
--- a/indra/llui/lliconctrl.h
+++ b/indra/llui/lliconctrl.h
@@ -79,7 +79,9 @@ protected:
//the output size of the icon image if set.
S32 mMinWidth,
- mMinHeight;
+ mMinHeight,
+ mMaxWidth,
+ mMaxHeight;
// If set to true (default), use the draw context transparency.
// If false, will use transparency returned by getCurrentTransparency(). See STORM-698.
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index 576fff5fb2..57de35dfde 100755
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -229,7 +229,7 @@ static std::string getStringAfterToken(const std::string str, const std::string
LLUrlEntryHTTP::LLUrlEntryHTTP()
: LLUrlEntryBase()
{
- mPattern = boost::regex("https?://([-\\w\\.]+)+(:\\d+)?(:\\w+)?(@\\d+)?(@\\w+)?\\.[a-z](:\\d+)?(:\\w+)?(@\\d+)?(@\\w+)?/?\\S*",
+ mPattern = boost::regex("https?://([^\\s/?\\.#]+\\.?)+\\.\\w+(:\\d+)?(/\\S*)?",
boost::regex::perl|boost::regex::icase);
mMenuName = "menu_url_http.xml";
mTooltip = LLTrans::getString("TooltipHttpUrl");
diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp
index dde54c78c4..d41930a492 100755
--- a/indra/llui/tests/llurlentry_test.cpp
+++ b/indra/llui/tests/llurlentry_test.cpp
@@ -232,6 +232,14 @@ namespace tut
testRegex("http url with newlines", url,
"XX\nhttp://www.secondlife.com/\nXX",
"http://www.secondlife.com/");
+
+ testRegex("http url without tld shouldn't be decorated (1)", url,
+ "http://test",
+ "");
+
+ testRegex("http url without tld shouldn't be decorated (2)", url,
+ "http://test .com",
+ "");
}
template<> template<>