@@ -47,6 +47,8 @@ static constexpr F32 AUTO_SCROLL_RATE_ACCEL = 120.f;
4747
4848static LLDefaultChildRegistry::Register<LLAccordionCtrl> t2 (" accordion" );
4949
50+ std::set<LLAccordionCtrl*> LLAccordionCtrl::sPendingArrange ;
51+
5052LLAccordionCtrl::LLAccordionCtrl (const Params& params):LLPanel(params)
5153 , mFitParent(params.fit_parent)
5254 , mNoVisibleTabsOrigString(params.no_visible_tabs_text.initial_value().asString())
@@ -163,7 +165,11 @@ bool LLAccordionCtrl::postBuild()
163165// ---------------------------------------------------------------------------------
164166LLAccordionCtrl::~LLAccordionCtrl ()
165167{
166- mAccordionTabs .clear ();
168+ if (mArrangePending )
169+ {
170+ sPendingArrange .erase (this );
171+ }
172+ mAccordionTabs .clear ();
167173}
168174
169175// ---------------------------------------------------------------------------------
@@ -184,7 +190,7 @@ void LLAccordionCtrl::reshape(S32 width, S32 height, bool called_from_parent)
184190 // necessary text paddings can be set via h_pad and v_pad
185191 mNoVisibleTabsHelpText ->setRect (getLocalRect ());
186192
187- arrange ();
193+ scheduleArrange ();
188194}
189195
190196// ---------------------------------------------------------------------------------
@@ -328,7 +334,7 @@ void LLAccordionCtrl::addCollapsibleCtrl(LLAccordionCtrlTab* accordion_tab)
328334 mAccordionTabs .push_back (accordion_tab);
329335
330336 accordion_tab->setDropDownStateChangedCallback ( boost::bind (&LLAccordionCtrl::onCollapseCtrlCloseOpen, this , (S16)(mAccordionTabs .size () - 1 )) );
331- arrange ();
337+ scheduleArrange ();
332338}
333339
334340void LLAccordionCtrl::removeCollapsibleCtrl (LLAccordionCtrlTab* accordion_tab)
@@ -685,8 +691,9 @@ S32 LLAccordionCtrl::notifyParent(const LLSD& info)
685691 std::string str_action = info[" action" ];
686692 if (str_action == " size_changes" )
687693 {
688- //
689- arrange ();
694+ // Multiple children can request an arrange,
695+ // but only need to do it once so schedule it for later.
696+ scheduleArrange ();
690697 return 1 ;
691698 }
692699 if (str_action == " select_next" )
@@ -928,3 +935,25 @@ void LLAccordionCtrl::collapseAllTabs()
928935 arrange ();
929936 }
930937}
938+
939+ void LLAccordionCtrl::scheduleArrange ()
940+ {
941+ if (!mArrangePending )
942+ {
943+ mArrangePending = true ;
944+ sPendingArrange .insert (this );
945+ }
946+ }
947+
948+ void LLAccordionCtrl::updateClass ()
949+ {
950+ for (LLAccordionCtrl* inst : sPendingArrange )
951+ {
952+ if (inst)
953+ {
954+ inst->mArrangePending = false ;
955+ inst->arrange ();
956+ }
957+ }
958+ sPendingArrange .clear ();
959+ }
0 commit comments