summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2025-11-25 23:52:55 +0200
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2025-11-27 16:58:32 +0200
commit3cab5caa2169c1acc7b2f2ddba31e5926e14455b (patch)
tree9ea5579c4be5f2aae559ffb7f9713639885bab93
parentbc4492da8b4dd173356a7d68e85e14b2ca3fe9e6 (diff)
#5046 Fix accordion control's excessive rearranges #2
Since arrange is no longer part of LLInventoryItemsList::doIdle(), reduced time limit.
-rw-r--r--indra/llui/llaccordionctrl.cpp39
-rw-r--r--indra/llui/llaccordionctrl.h6
-rw-r--r--indra/newview/llinventoryitemslist.cpp3
-rw-r--r--indra/newview/llinventorylistitem.cpp2
-rw-r--r--indra/newview/lloutfitslist.cpp4
-rw-r--r--indra/newview/llviewerwindow.cpp3
6 files changed, 51 insertions, 6 deletions
diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp
index 1a64c2699d..8dcc809dfe 100644
--- a/indra/llui/llaccordionctrl.cpp
+++ b/indra/llui/llaccordionctrl.cpp
@@ -47,6 +47,8 @@ static constexpr F32 AUTO_SCROLL_RATE_ACCEL = 120.f;
static LLDefaultChildRegistry::Register<LLAccordionCtrl> t2("accordion");
+std::set<LLAccordionCtrl*> LLAccordionCtrl::sPendingArrange;
+
LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params)
, mFitParent(params.fit_parent)
, mNoVisibleTabsOrigString(params.no_visible_tabs_text.initial_value().asString())
@@ -163,7 +165,11 @@ bool LLAccordionCtrl::postBuild()
//---------------------------------------------------------------------------------
LLAccordionCtrl::~LLAccordionCtrl()
{
- mAccordionTabs.clear();
+ if (mArrangePending)
+ {
+ sPendingArrange.erase(this);
+ }
+ mAccordionTabs.clear();
}
//---------------------------------------------------------------------------------
@@ -184,7 +190,7 @@ void LLAccordionCtrl::reshape(S32 width, S32 height, bool called_from_parent)
// necessary text paddings can be set via h_pad and v_pad
mNoVisibleTabsHelpText->setRect(getLocalRect());
- arrange();
+ scheduleArrange();
}
//---------------------------------------------------------------------------------
@@ -328,7 +334,7 @@ void LLAccordionCtrl::addCollapsibleCtrl(LLAccordionCtrlTab* accordion_tab)
mAccordionTabs.push_back(accordion_tab);
accordion_tab->setDropDownStateChangedCallback( boost::bind(&LLAccordionCtrl::onCollapseCtrlCloseOpen, this, (S16)(mAccordionTabs.size() - 1)) );
- arrange();
+ scheduleArrange();
}
void LLAccordionCtrl::removeCollapsibleCtrl(LLAccordionCtrlTab* accordion_tab)
@@ -685,8 +691,9 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info)
std::string str_action = info["action"];
if (str_action == "size_changes")
{
- //
- arrange();
+ // Multiple children can request an arrange,
+ // but only need to do it once so schedule it for later.
+ scheduleArrange();
return 1;
}
if (str_action == "select_next")
@@ -928,3 +935,25 @@ void LLAccordionCtrl::collapseAllTabs()
arrange();
}
}
+
+void LLAccordionCtrl::scheduleArrange()
+{
+ if (!mArrangePending)
+ {
+ mArrangePending = true;
+ sPendingArrange.insert(this);
+ }
+}
+
+void LLAccordionCtrl::updateClass()
+{
+ for (LLAccordionCtrl* inst : sPendingArrange)
+ {
+ if (inst)
+ {
+ inst->mArrangePending = false;
+ inst->arrange();
+ }
+ }
+ sPendingArrange.clear();
+}
diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h
index 43a33a2b3c..c7bb8bc9ff 100644
--- a/indra/llui/llaccordionctrl.h
+++ b/indra/llui/llaccordionctrl.h
@@ -142,6 +142,9 @@ public:
void setSkipScrollToChild(bool skip) { mSkipScrollToChild = skip; }
+ void scheduleArrange();
+ static void updateClass();
+
private:
void initNoTabsWidget(const LLTextBox::Params& tb_params);
void updateNoTabsHelpTextVisibility();
@@ -188,12 +191,15 @@ private:
LLTextBox* mNoVisibleTabsHelpText = nullptr;
bool mSkipScrollToChild = false;
+ bool mArrangePending = false;
std::string mNoMatchedTabsOrigString;
std::string mNoVisibleTabsOrigString;
LLAccordionCtrlTab* mSelectedTab = nullptr;
const LLTabComparator* mTabComparator = nullptr;
+
+ static std::set<LLAccordionCtrl*> sPendingArrange;
};
diff --git a/indra/newview/llinventoryitemslist.cpp b/indra/newview/llinventoryitemslist.cpp
index d2ccfe5dfe..15735ebde3 100644
--- a/indra/newview/llinventoryitemslist.cpp
+++ b/indra/newview/llinventoryitemslist.cpp
@@ -145,6 +145,7 @@ void LLInventoryItemsList::updateSelection()
bool LLInventoryItemsList::doIdle()
{
if (mRefreshState == REFRESH_COMPLETE) return true; // done
+ LL_PROFILE_ZONE_SCOPED;
if (isInVisibleChain() || mForceRefresh || !getFilterSubString().empty())
{
@@ -166,7 +167,7 @@ void LLInventoryItemsList::idle(void* user_data)
using namespace std::chrono;
auto start = steady_clock::now();
- const milliseconds time_limit = milliseconds(3);
+ const milliseconds time_limit = milliseconds(2);
const auto end_time = start + time_limit;
S32 max_update_count = 50;
diff --git a/indra/newview/llinventorylistitem.cpp b/indra/newview/llinventorylistitem.cpp
index 5fb5b0f23f..a435a4f7c7 100644
--- a/indra/newview/llinventorylistitem.cpp
+++ b/indra/newview/llinventorylistitem.cpp
@@ -69,6 +69,7 @@ LLPanelInventoryListItemBase::Params::Params()
LLPanelInventoryListItemBase* LLPanelInventoryListItemBase::create(LLViewerInventoryItem* item)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
LLPanelInventoryListItemBase* list_item = NULL;
if (item)
{
@@ -189,6 +190,7 @@ void LLPanelInventoryListItemBase::setShowWidget(LLUICtrl* ctrl, bool show)
bool LLPanelInventoryListItemBase::postBuild()
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
LLViewerInventoryItem* inv_item = getItem();
if (inv_item)
{
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index 58cd9fab83..c153561d70 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -568,6 +568,10 @@ void LLOutfitsList::onRefreshComplete(LLUICtrl* ctrl)
if (!ctrl || getFilterSubString().empty())
return;
+ LL_PROFILE_ZONE_SCOPED;
+
+ // TODO: We are doing it multiple times per frame on init
+ // as multiple lists are refreshing. Needs improvements.
for (outfits_map_t::iterator
iter = mOutfitsMap.begin(),
iter_end = mOutfitsMap.end();
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 670a3b2939..74b34ceee6 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -86,6 +86,7 @@
#include "raytrace.h"
// newview includes
+#include "llaccordionctrl.h"
#include "llbox.h"
#include "llchicletbar.h"
#include "llconsole.h"
@@ -3440,6 +3441,8 @@ void LLViewerWindow::updateUI()
LLConsole::updateClass();
+ // execute postponed arrange calls
+ LLAccordionCtrl::updateClass();
// animate layout stacks so we have up to date rect for world view
LLLayoutStack::updateClass();