From a74cadff8369ab5779877af6f1b030e1cc40e961 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Fri, 23 Oct 2020 16:05:31 +0300 Subject: SL-14149 FIXED The text is displayed black after double-clicking on it --- indra/llui/lltextbase.cpp | 6 ++++++ indra/llui/lltextbase.h | 2 +- indra/llui/lltextbox.cpp | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index ff72417867..d92f10bdbb 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -184,6 +184,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mFontShadow(p.font_shadow), mPopupMenuHandle(), mReadOnly(p.read_only), + mSkipTripleClick(false), mSkipLinkUnderline(p.skip_link_underline), mSpellCheck(p.spellcheck), mSpellCheckStart(-1), @@ -1017,6 +1018,11 @@ BOOL LLTextBase::handleMouseDown(S32 x, S32 y, MASK mask) // handle triple click if (!mTripleClickTimer.hasExpired()) { + if (mSkipTripleClick) + { + return TRUE; + } + S32 real_line = getLineNumFromDocIndex(mCursorPos, false); S32 line_start = -1; S32 line_end = -1; diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 4e966b7cef..2e2e1b9833 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -699,7 +699,7 @@ protected: bool mPlainText; // didn't use Image or Icon segments bool mAutoIndent; S32 mMaxTextByteLength; // Maximum length mText is allowed to be in bytes - + bool mSkipTripleClick; bool mSkipLinkUnderline; // support widgets diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp index 0afd32f332..4dc2a6a597 100644 --- a/indra/llui/lltextbox.cpp +++ b/indra/llui/lltextbox.cpp @@ -45,7 +45,9 @@ LLTextBox::LLTextBox(const LLTextBox::Params& p) : LLTextBase(p), mClickedCallback(NULL), mShowCursorHand(true) -{} +{ + mSkipTripleClick = true; +} LLTextBox::~LLTextBox() {} -- cgit v1.2.3 From 03921adb1211c6def0ce5c791e2455643142a92a Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Mon, 11 Jan 2021 17:07:03 +0200 Subject: SL-2202 Add exception handling around boost::regex_match() calls in the viewer --- indra/llui/llurlentry.cpp | 3 ++- indra/llui/llurlregistry.cpp | 12 ++---------- 2 files changed, 4 insertions(+), 11 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index e6835f73fb..ff742a9530 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -35,6 +35,7 @@ #include "llavatarnamecache.h" #include "llcachename.h" +#include "llregex.h" #include "lltrans.h" #include "lluicolortable.h" #include "message.h" @@ -1388,7 +1389,7 @@ std::string LLUrlEntryIcon::getIcon(const std::string &url) // Grep icon info between ... tags // matches[1] contains the icon name/path boost::match_results matches; - mIcon = (boost::regex_match(url, matches, mPattern) && matches[1].matched) + mIcon = (ll_regex_match(url, matches, mPattern) && matches[1].matched) ? matches[1] : LLStringUtil::null; LLStringUtil::trim(mIcon); diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index ba6fa1e2e9..5f44475bd7 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -26,10 +26,10 @@ */ #include "linden_common.h" +#include "llregex.h" #include "llurlregistry.h" #include "lluriparser.h" -#include // default dummy callback that ignores any label updates from the server void LLUrlRegistryNullCallback(const std::string &url, const std::string &label, const std::string& icon) @@ -107,15 +107,7 @@ static bool matchRegex(const char *text, boost::regex regex, U32 &start, U32 &en boost::cmatch result; bool found; - // regex_search can potentially throw an exception, so check for it - try - { - found = boost::regex_search(text, result, regex); - } - catch (std::runtime_error &) - { - return false; - } + found = ll_regex_search(text, result, regex); if (! found) { -- cgit v1.2.3 From 26fb5d7af70f20c9a125575e1d93f7ff4bcd4f3c Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 7 May 2021 20:32:04 -0400 Subject: SL-15241: Tweak viewer sources to permit compiling on Mac with C++17. --- indra/llui/lldockablefloater.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h index 89c9852f4a..1110342f08 100644 --- a/indra/llui/lldockablefloater.h +++ b/indra/llui/lldockablefloater.h @@ -108,7 +108,7 @@ public: * * By default returns false. */ - virtual bool overlapsScreenChannel() { return mOverlapsScreenChannel && getVisible() && isDocked(); } + virtual bool overlapsScreenChannel() const { return mOverlapsScreenChannel && getVisible() && isDocked(); } virtual void setOverlapsScreenChannel(bool overlaps) { mOverlapsScreenChannel = overlaps; } bool getUniqueDocking() { return mUniqueDocking; } @@ -131,7 +131,7 @@ protected: boost::function mIsDockedStateForcedCallback; private: - std::auto_ptr mDockControl; + std::unique_ptr mDockControl; LLUIImagePtr mDockTongue; static LLHandle sInstanceHandle; /** -- cgit v1.2.3 From e75519ef0e0a3b3aebf7761830b1e93163e3c673 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 31 May 2021 17:19:37 +0300 Subject: SL-15093 Crash nanov2_free_to_block #2 Mostly converted some boost pointers to std ones Made ~LLNotificationChannelBase() more explicit to get a bit more data on location of another crash that likely happens when cleaning mItems --- indra/llui/llnotificationptr.h | 3 +-- indra/llui/llnotifications.h | 21 +++++++++++++-------- indra/llui/llnotificationslistener.h | 3 +-- indra/llui/llnotificationtemplate.h | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llnotificationptr.h b/indra/llui/llnotificationptr.h index acc047527f..580f353c7d 100644 --- a/indra/llui/llnotificationptr.h +++ b/indra/llui/llnotificationptr.h @@ -27,9 +27,8 @@ // Many classes just store a single LLNotificationPtr // and llnotifications.h is very large, so define this ligher header. -#include class LLNotification; -typedef boost::shared_ptr LLNotificationPtr; +typedef std::shared_ptr LLNotificationPtr; #endif diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 2f4578da17..4287bff059 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -84,8 +84,6 @@ #include #include -#include -#include #include #include #include @@ -132,7 +130,7 @@ public: typedef boost::function LLNotificationResponder; -typedef boost::shared_ptr LLNotificationResponderPtr; +typedef std::shared_ptr LLNotificationResponderPtr; typedef LLFunctorRegistry LLNotificationFunctorRegistry; typedef LLFunctorRegistration LLNotificationFunctorRegistration; @@ -276,19 +274,19 @@ private: bool mInvertSetting; }; -typedef boost::shared_ptr LLNotificationFormPtr; +typedef std::shared_ptr LLNotificationFormPtr; struct LLNotificationTemplate; // we want to keep a map of these by name, and it's best to manage them // with smart pointers -typedef boost::shared_ptr LLNotificationTemplatePtr; +typedef std::shared_ptr LLNotificationTemplatePtr; struct LLNotificationVisibilityRule; -typedef boost::shared_ptr LLNotificationVisibilityRulePtr; +typedef std::shared_ptr LLNotificationVisibilityRulePtr; /** * @class LLNotification @@ -304,7 +302,7 @@ typedef boost::shared_ptr LLNotificationVisibility */ class LLNotification : boost::noncopyable, - public boost::enable_shared_from_this + public std::enable_shared_from_this { LOG_CLASS(LLNotification); friend class LLNotifications; @@ -743,7 +741,14 @@ public: : mFilter(filter), mItems() {} - virtual ~LLNotificationChannelBase() {} + virtual ~LLNotificationChannelBase() + { + // explicit cleanup for easier issue detection + mChanged.disconnect_all_slots(); + mPassedFilter.disconnect_all_slots(); + mFailedFilter.disconnect_all_slots(); + mItems.clear(); + } // you can also connect to a Channel, so you can be notified of // changes to this channel LLBoundListener connectChanged(const LLEventListener& slot) diff --git a/indra/llui/llnotificationslistener.h b/indra/llui/llnotificationslistener.h index f9f7641de6..4bab377626 100644 --- a/indra/llui/llnotificationslistener.h +++ b/indra/llui/llnotificationslistener.h @@ -31,7 +31,6 @@ #include "lleventapi.h" #include "llnotificationptr.h" -#include #include #include @@ -61,7 +60,7 @@ private: static LLSD asLLSD(LLNotificationPtr); class Forwarder; - typedef std::map > ForwarderMap; + typedef std::map > ForwarderMap; ForwarderMap mForwarders; LLNotifications & mNotifications; }; diff --git a/indra/llui/llnotificationtemplate.h b/indra/llui/llnotificationtemplate.h index 20cbc89ede..a8902486e4 100644 --- a/indra/llui/llnotificationtemplate.h +++ b/indra/llui/llnotificationtemplate.h @@ -31,7 +31,7 @@ #include "llinitparam.h" #include "llnotifications.h" -typedef boost::shared_ptr LLNotificationFormPtr; +typedef std::shared_ptr LLNotificationFormPtr; // This is the class of object read from the XML file (notifications.xml, // from the appropriate local language directory). -- cgit v1.2.3 From b6ac642db2213cf4207dddc47a1fe1490de0cc6e Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 2 Jun 2021 23:26:48 +0300 Subject: SL-15243 Unicode URL validation --- indra/llui/llurlentry.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++----- indra/llui/llurlentry.h | 2 +- 2 files changed, 46 insertions(+), 6 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 20dda54771..29a6e86819 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -181,11 +181,51 @@ bool LLUrlEntryBase::isLinkDisabled() const return globally_disabled; } -bool LLUrlEntryBase::isWikiLinkCorrect(std::string url) -{ - LLWString label = utf8str_to_wstring(getLabelFromWikiLink(url)); - label.erase(std::remove(label.begin(), label.end(), L'\u200B'), label.end()); - return (LLUrlRegistry::instance().hasUrl(wstring_to_utf8str(label))) ? false : true; +bool LLUrlEntryBase::isWikiLinkCorrect(const std::string &labeled_url) const +{ + LLWString wlabel = utf8str_to_wstring(getLabelFromWikiLink(labeled_url)); + wlabel.erase(std::remove(wlabel.begin(), wlabel.end(), L'\u200B'), wlabel.end()); + + // Unicode URL validation, see SL-15243 + std::replace_if(wlabel.begin(), + wlabel.end(), + [](const llwchar &chr) + { + return (chr == L'\u2024') // "One Dot Leader" + || (chr == L'\uFE52') // "Small Full Stop" + || (chr == L'\uFF0E') // "Fullwidth Full Stop" + // Not a decomposition, but suficiently similar + || (chr == L'\u05C5'); // "Hebrew Mark Lower Dot" + }, + L'\u002E'); // Dot "Full Stop" + + std::replace_if(wlabel.begin(), + wlabel.end(), + [](const llwchar &chr) + { + return (chr == L'\u02D0') // "Modifier Letter Colon" + || (chr == L'\uFF1A') // "Fullwidth Colon" + || (chr == L'\uFE55'); // "Small Colon" + }, + L'\u003A'); // Colon + + std::replace_if(wlabel.begin(), + wlabel.end(), + [](const llwchar &chr) + { + return (chr == L'\uFF0F'); // "Fullwidth Solidus" + }, + L'\u002F'); // Solidus + + std::string label = wstring_to_utf8str(wlabel); + if ((label.find(".com") != std::string::npos + || label.find("www.") != std::string::npos) + && label.find("://") == std::string::npos) + { + label = "http://" + label; + } + + return (LLUrlRegistry::instance().hasUrl(label)) ? false : true; } std::string LLUrlEntryBase::urlToLabelWithGreyQuery(const std::string &url) const diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index 4af1ab5096..102e0a4fd9 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -105,7 +105,7 @@ public: bool isLinkDisabled() const; - bool isWikiLinkCorrect(std::string url); + bool isWikiLinkCorrect(const std::string &url) const; virtual bool isSLURLvalid(const std::string &url) const { return TRUE; }; -- cgit v1.2.3 From 7a6b5a598487c6162c56246561bae205824c892b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 1 Jul 2021 23:02:08 +0300 Subject: SL-15383 Fix combobox's search highlights --- indra/llui/llcombobox.cpp | 37 +++++++++++++++++++++++++++++++++++++ indra/llui/llcombobox.h | 7 ++++++- 2 files changed, 43 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 52dc908655..bcc653a602 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -1037,6 +1037,43 @@ void LLComboBox::prearrangeList(std::string filter) } } + +//============================================================================ +// ll::ui::SearchableControl functions + +//virtual +std::string LLComboBox::_getSearchText() const +{ + std::string res; + if (mList) + { + // getAllData returns a full copy of content, might be a + // better option to implement an mList->getSearchText(column) + std::vector data = mList->getAllData(); + std::vector::iterator iter = data.begin(); + while (iter != data.end()) + { + LLScrollListCell* cell = (*iter)->getColumn(0); + if (cell) + { + std::string whitelist_url = cell->getValue().asString(); + res += cell->getValue().asString(); + } + iter++; + } + } + return res + getToolTip(); +} + +//virtual +void LLComboBox::onSetHighlight() const +{ + if (mButton) + { + mButton->ll::ui::SearchableControl::setHighlighted(ll::ui::SearchableControl::getHighlighted()); + } +} + //============================================================================ // LLCtrlListInterface functions diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 4af3313162..e17d6cdfb4 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -44,7 +44,9 @@ class LLFontGL; class LLViewBorder; class LLComboBox -: public LLUICtrl, public LLCtrlListInterface +: public LLUICtrl +, public LLCtrlListInterface +, public ll::ui::SearchableControl { public: typedef enum e_preferred_position @@ -100,6 +102,9 @@ protected: void initFromParams(const Params&); void prearrangeList(std::string filter = ""); + virtual std::string _getSearchText() const; + virtual void onSetHighlight() const; + public: // LLView interface virtual void onFocusLost(); -- cgit v1.2.3 From adcd08fbf4d96f8f52cef81895bda202c9e45896 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Tue, 28 Sep 2021 19:07:48 +0300 Subject: Revert "Merge branch 'c++17' into DRTVWR-522-maint" This reverts commit 203ea3a70a775a09cbbffb1740ab7c58f1780baa, reversing changes made to 8e3f0778863a5aa337d1148a243ea91d238a8ac5. # Conflicts: # indra/newview/llmachineid.cpp --- indra/llui/lldockablefloater.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h index 1110342f08..89c9852f4a 100644 --- a/indra/llui/lldockablefloater.h +++ b/indra/llui/lldockablefloater.h @@ -108,7 +108,7 @@ public: * * By default returns false. */ - virtual bool overlapsScreenChannel() const { return mOverlapsScreenChannel && getVisible() && isDocked(); } + virtual bool overlapsScreenChannel() { return mOverlapsScreenChannel && getVisible() && isDocked(); } virtual void setOverlapsScreenChannel(bool overlaps) { mOverlapsScreenChannel = overlaps; } bool getUniqueDocking() { return mUniqueDocking; } @@ -131,7 +131,7 @@ protected: boost::function mIsDockedStateForcedCallback; private: - std::unique_ptr mDockControl; + std::auto_ptr mDockControl; LLUIImagePtr mDockTongue; static LLHandle sInstanceHandle; /** -- cgit v1.2.3