From 0e63f287384d3a9c08d183356072ba9e502a1762 Mon Sep 17 00:00:00 2001 From: liyi55 Date: Wed, 15 May 2024 16:17:08 +0800 Subject: [PATCH] measure tabcontent and children seperately Signed-off-by: liyi55 --- .../pattern/swiper/swiper_pattern.cpp | 1 + .../pattern/tabs/tab_content_pattern.h | 33 ++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/frameworks/core/components_ng/pattern/swiper/swiper_pattern.cpp b/frameworks/core/components_ng/pattern/swiper/swiper_pattern.cpp index c7a1bf23e75..46ae83e968c 100644 --- a/frameworks/core/components_ng/pattern/swiper/swiper_pattern.cpp +++ b/frameworks/core/components_ng/pattern/swiper/swiper_pattern.cpp @@ -2495,6 +2495,7 @@ void SwiperPattern::HandleDragEnd(double dragVelocity) } if (pipeline) { pipeline->FlushUITasks(); + pipeline->FlushMessages(); } isDragging_ = false; diff --git a/frameworks/core/components_ng/pattern/tabs/tab_content_pattern.h b/frameworks/core/components_ng/pattern/tabs/tab_content_pattern.h index 62af1615f25..4eebad13776 100644 --- a/frameworks/core/components_ng/pattern/tabs/tab_content_pattern.h +++ b/frameworks/core/components_ng/pattern/tabs/tab_content_pattern.h @@ -34,9 +34,24 @@ class ACE_EXPORT TabContentPattern : public Pattern { public: explicit TabContentPattern(const RefPtr& shallowBuilder) : shallowBuilder_(shallowBuilder), tabBarParam_(std::string(""), std::string(""), nullptr) - {} + { + if (shallowBuilder_) { + shallowBuilder_->MarkIsExecuteDeepRenderDone(true); + } + } ~TabContentPattern() override = default; + bool OnDirtyLayoutWrapperSwap(const RefPtr& dirty, const DirtySwapConfig& config) override + { + if (shallowBuilder_ && !shallowBuilder_->IsExecuteDeepRenderDone()) { + auto host = GetHost(); + CHECK_NULL_RETURN(host, false); + host->MarkDirtyNode(PROPERTY_UPDATE_MEASURE_SELF); + return true; + } + return false; + } + bool IsAtomicNode() const override { return false; @@ -65,6 +80,22 @@ public: if (shallowBuilder_ && !shallowBuilder_->IsExecuteDeepRenderDone()) { shallowBuilder_->ExecuteDeepRender(); shallowBuilder_.Reset(); + } else if (shallowBuilder_ && shallowBuilder_->IsExecuteDeepRenderDone()) { + auto pipeline = PipelineContext::GetCurrentContextSafely(); + if (!pipeline) { + shallowBuilder_->MarkIsExecuteDeepRenderDone(false); + return; + } + + pipeline->AddAfterRenderTask([weak = WeakClaim(this), shallowBuilder = shallowBuilder_]() { + CHECK_NULL_VOID(shallowBuilder); + shallowBuilder->MarkIsExecuteDeepRenderDone(false); + auto pattern = weak.Upgrade(); + CHECK_NULL_VOID(pattern); + auto host = pattern->GetHost(); + CHECK_NULL_VOID(host); + host->MarkDirtyNode(PROPERTY_UPDATE_MEASURE_SELF); + }); } } -- Gitee