summaryrefslogtreecommitdiff
path: root/indra/llui/lltextbase.cpp
diff options
context:
space:
mode:
authormaksymsproductengine <maksymsproductengine@lindenlab.com>2014-10-02 18:20:10 +0300
committermaksymsproductengine <maksymsproductengine@lindenlab.com>2014-10-02 18:20:10 +0300
commita25748e11ea59d72f8190373be5b8930288d4744 (patch)
treeddfebd4b4a738c7b636427b9ba469929b81627a5 /indra/llui/lltextbase.cpp
parentd95feec8dc38dad52f5265a9abc58175019c6d18 (diff)
MAINT-4119 FIXED Uniquely decorate links on Second Life or Linden Lab domains
Diffstat (limited to 'indra/llui/lltextbase.cpp')
-rwxr-xr-xindra/llui/lltextbase.cpp70
1 files changed, 8 insertions, 62 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 8395e74715..fee271b943 100755
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -44,8 +44,6 @@
#include "llwindow.h"
#include <boost/bind.hpp>
-#include "uriparser/Uri.h"
-
const F32 CURSOR_FLASH_DELAY = 1.0f; // in seconds
const S32 CURSOR_THICKNESS = 2;
const F32 TRIPLE_CLICK_INTERVAL = 0.3f; // delay between double and triple click.
@@ -2021,60 +2019,7 @@ static LLUIImagePtr image_from_icon_name(const std::string& icon_name)
static LLTrace::BlockTimerStatHandle FTM_PARSE_HTML("Parse HTML");
-S32 LLTextBase::normalizeUri(std::string& uri_string)
-{
- UriParserStateA state;
- UriUriA uri;
- state.uri = &uri;
-
- S32 res = uriParseUriA(&state, uri_string.c_str());
-
- if (!res)
- {
- if (uri.scheme.afterLast - uri.scheme.first > 0)
- {
- res = uriNormalizeSyntaxExA(&uri, URI_NORMALIZE_SCHEME | URI_NORMALIZE_HOST);
- if (!res)
- {
- S32 chars_required;
- res = uriToStringCharsRequiredA(&uri, &chars_required);
-
- if (!res)
- {
- chars_required++;
- std::vector<char> label_buf(chars_required);
- res = uriToStringA(&label_buf[0], &uri, chars_required, NULL);
-
- if (!res)
- {
- uri_string = &label_buf[0];
- }
- }
- }
- }
- else if (uri_string.find_first_of('.') != std::string::npos)
- {
- static bool recursive_call = false;
-
- // allow only single level recursive call
- if (!recursive_call)
- {
- recursive_call = true;
-
- // force uri to be with scheme and try to normalize
- std::string uri_with_scheme = "http://";
- uri_with_scheme += uri_string;
- normalizeUri(uri_with_scheme);
- uri_string = uri_with_scheme.substr(7);
- recursive_call = false;
- }
- }
- }
-
- uriFreeUriMembersA(&uri);
- return res;
-}
void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Params& input_params)
{
@@ -2113,8 +2058,11 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para
appendAndHighlightText(subtext, part, style_params);
}
+ // add icon before url if need
+ LLTextUtil::processUrlMatch(&match, this, isContentTrusted() || match.isTrusted());
+
std::string label = match.getLabel();
- normalizeUri(label);
+ LLTextUtil::normalizeUri(label);
// output the styled Url
appendAndHighlightTextImpl(label, part, link_params, match.underlineOnHoverOnly());
@@ -2124,14 +2072,12 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para
{
segment_set_t::iterator it = getSegIterContaining(getLength()-1);
if (it != mSegments.end())
- {
- LLTextSegmentPtr segment = *it;
- segment->setToolTip(match.getTooltip());
- }
+ {
+ LLTextSegmentPtr segment = *it;
+ segment->setToolTip(match.getTooltip());
+ }
}
- LLTextUtil::processUrlMatch(&match,this,isContentTrusted());
-
// move on to the rest of the text after the Url
if (end < (S32)text.length())
{