summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-04-02 22:40:56 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-04-02 23:36:14 +0300
commit820ac72f8c4a07bc4310b9daac6966f2f2f2ee98 (patch)
tree264ba32e02eed86686957ef994cb91affb0260da
parent7d31436009b5578f75c862f970437bf583a97017 (diff)
SL-13182 Fix excessive resorting
-rw-r--r--indra/newview/llfolderviewmodelinventory.cpp23
-rw-r--r--indra/newview/llfolderviewmodelinventory.h1
2 files changed, 15 insertions, 9 deletions
diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp
index 117e2534cb..4544b083ed 100644
--- a/indra/newview/llfolderviewmodelinventory.cpp
+++ b/indra/newview/llfolderviewmodelinventory.cpp
@@ -140,15 +140,20 @@ void LLFolderViewModelItemInventory::requestSort()
{
folderp->requestArrange();
}
- if (static_cast<LLFolderViewModelInventory&>(mRootViewModel).getSorter().isByDate())
- {
- // sort by date potentially affects parent folders which use a date
- // derived from newest item in them
- if (mParent)
- {
- mParent->requestSort();
- }
- }
+ LLInventorySort sorter = static_cast<LLFolderViewModelInventory&>(mRootViewModel).getSorter();
+
+ if (sorter.isByDate())
+ {
+ // Sort by date potentially affects parent folders which use a date
+ // derived from newest item in them
+ //
+ // if this is an item, parent needs to be resorted (this case shouldn't happen)
+ // if this is a folder, check sort rules for folder first
+ if (mParent && (!folderp || !sorter.isFoldersByName()))
+ {
+ mParent->requestSort();
+ }
+ }
}
void LLFolderViewModelItemInventory::setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset, std::string::size_type string_size)
diff --git a/indra/newview/llfolderviewmodelinventory.h b/indra/newview/llfolderviewmodelinventory.h
index 06a908cccc..8ee3f75002 100644
--- a/indra/newview/llfolderviewmodelinventory.h
+++ b/indra/newview/llfolderviewmodelinventory.h
@@ -82,6 +82,7 @@ public:
}
bool isByDate() const { return mByDate; }
+ bool isFoldersByName() const { return (!mByDate || mFoldersByName) && !mFoldersByWeight; }
U32 getSortOrder() const { return mSortOrder; }
void toParams(Params& p) { p.order(mSortOrder);}
void fromParams(Params& p)