diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index d251544ee51ba7f6a48d5f57e3f036527c1533bb..6ae03adcb91a36ce25e4844c71ab7d55079ca247 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -258,20 +258,19 @@ BOOL LLFolderViewItem::passedFilter(S32 filter_generation) BOOL LLFolderViewItem::isPotentiallyVisible(S32 filter_generation) { - // Item should be visible if: - // 1. item passed current filter - // 2. item was updated (gen < 0) but has descendants that passed filter - // 3. item was recently updated and was visible before update - - LLFolderViewModelItem* model = getViewModelItem(); - if (model->getLastFilterGeneration() < 0 && !getFolderViewModel()->getFilter().isModified()) + if (filter_generation < 0) { - return model->descendantsPassedFilter(filter_generation) || getVisible(); + filter_generation = getFolderViewModel()->getFilter().getFirstSuccessGeneration(); } - else + LLFolderViewModelItem* model = getViewModelItem(); + BOOL visible = model->passedFilter(filter_generation); + if (model->getMarkedDirtyGeneration() >= filter_generation) { - return model->passedFilter(filter_generation); + // unsure visibility state + // retaining previous visibility until item is updated or filter generation changes + visible |= getVisible(); } + return visible; } void LLFolderViewItem::refresh() diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index 8d98363c5fd59c1e520abe6d0ae2b4906126a11e..cad3ca9d8dbfe8b403079c250bd67b1ddf6a69e9 100755 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -190,6 +190,7 @@ class LLFolderViewModelItem : public LLRefCount, public LLTrace::MemTrackable<LL virtual std::string::size_type getFilterStringSize() = 0; virtual S32 getLastFilterGeneration() const = 0; + virtual S32 getMarkedDirtyGeneration() const = 0; virtual bool hasChildren() const = 0; virtual void addChild(LLFolderViewModelItem* child) = 0; @@ -230,6 +231,7 @@ class LLFolderViewModelItemCommon : public LLFolderViewModelItem mFolderViewItem(NULL), mLastFilterGeneration(-1), mLastFolderFilterGeneration(-1), + mMarkedDirtyGeneration(-1), mMostFilteredDescendantGeneration(-1), mParent(NULL), mRootViewModel(root_view_model) @@ -243,8 +245,13 @@ class LLFolderViewModelItemCommon : public LLFolderViewModelItem S32 getLastFilterGeneration() const { return mLastFilterGeneration; } S32 getLastFolderFilterGeneration() const { return mLastFolderFilterGeneration; } + S32 getMarkedDirtyGeneration() const { return mMarkedDirtyGeneration; } void dirtyFilter() { + if(mMarkedDirtyGeneration < 0) + { + mMarkedDirtyGeneration = mLastFilterGeneration; + } mLastFilterGeneration = -1; mLastFolderFilterGeneration = -1; @@ -303,6 +310,7 @@ class LLFolderViewModelItemCommon : public LLFolderViewModelItem mLastFilterGeneration = filter_generation; mStringMatchOffsetFilter = string_offset; mStringFilterSize = string_size; + mMarkedDirtyGeneration = -1; } void setPassedFolderFilter(bool passed, S32 filter_generation) @@ -351,7 +359,8 @@ class LLFolderViewModelItemCommon : public LLFolderViewModelItem S32 mLastFilterGeneration, mLastFolderFilterGeneration, - mMostFilteredDescendantGeneration; + mMostFilteredDescendantGeneration, + mMarkedDirtyGeneration; child_list_t mChildren; LLFolderViewModelItem* mParent; diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index 7615c12043cbb27030aff394172d66ff5796bbb0..2eca2a8974825499cfefd32daed9842a43c0b989 100755 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -129,13 +129,18 @@ void LLFolderViewModelItemInventory::requestSort() void LLFolderViewModelItemInventory::setPassedFilter(bool passed, S32 filter_generation, std::string::size_type string_offset, std::string::size_type string_size) { + bool generation_skip = mMarkedDirtyGeneration >= 0 + && mPrevPassedAllFilters + && mMarkedDirtyGeneration < mRootViewModel.getFilter().getFirstSuccessGeneration(); LLFolderViewModelItemCommon::setPassedFilter(passed, filter_generation, string_offset, string_size); bool before = mPrevPassedAllFilters; mPrevPassedAllFilters = passedFilter(filter_generation); - if (before != mPrevPassedAllFilters) + if (before != mPrevPassedAllFilters || generation_skip) { - // Need to rearrange the folder if the filtered state of the item changed + // Need to rearrange the folder if the filtered state of the item changed, + // previously passed item skipped filter generation changes while being dirty + // or previously passed not yet filtered item was marked dirty LLFolderViewFolder* parent_folder = mFolderViewItem->getParentFolder(); if (parent_folder) {