From 090ab82d2dc59fff22c2a3a49f06b6a10ff83c97 Mon Sep 17 00:00:00 2001 From: Shi Bofan Date: Sun, 17 Aug 2025 12:23:13 +0800 Subject: [PATCH] bugfix: flush ignore Signed-off-by: Shi Bofan --- .../core/components_ng/base/frame_node.cpp | 1 + .../core/pipeline_ng/ui_task_scheduler.cpp | 8 +++---- .../layout/layout_property_test_ng_two.cpp | 22 +++++++++++++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/frameworks/core/components_ng/base/frame_node.cpp b/frameworks/core/components_ng/base/frame_node.cpp index e624aa33ab8..3b2a7091fef 100755 --- a/frameworks/core/components_ng/base/frame_node.cpp +++ b/frameworks/core/components_ng/base/frame_node.cpp @@ -4790,6 +4790,7 @@ void FrameNode::TraverseSubtreeToPostBundle(std::vector>& subt auto property = child->GetLayoutProperty(); if (property && property->IsIgnoreOptsValid()) { subtreeCollection.emplace_back(child); + child->SetDelaySelfLayoutForIgnore(); } else { std::vector> effectedNodes; int recheckCount = 0; diff --git a/frameworks/core/pipeline_ng/ui_task_scheduler.cpp b/frameworks/core/pipeline_ng/ui_task_scheduler.cpp index c31f7442412..ef26d2de98e 100644 --- a/frameworks/core/pipeline_ng/ui_task_scheduler.cpp +++ b/frameworks/core/pipeline_ng/ui_task_scheduler.cpp @@ -162,15 +162,14 @@ void UITaskScheduler::FlushLayoutTask(bool forceUseMainThread) if (frameInfo_ != nullptr) { frameInfo_->AddTaskInfo(node->GetTag(), node->GetId(), time, FrameInfo::TaskType::LAYOUT); } + while (!ignoreLayoutSafeAreaBundles_.empty()) { + FlushPostponedLayoutTask(forceUseMainThread); + } #ifndef IS_RELEASE_VERSION duration += time; #endif } - while (!ignoreLayoutSafeAreaBundles_.empty()) { - FlushPostponedLayoutTask(forceUseMainThread); - } - FlushSyncGeometryNodeTasks(); #ifdef FFRT_EXISTS if (is64BitSystem_) { @@ -189,6 +188,7 @@ void UITaskScheduler::FlushLayoutTask(bool forceUseMainThread) void UITaskScheduler::FlushPostponedLayoutTask(bool forceUseMainThread) { + ACE_FUNCTION_TRACE_COMMERCIAL(); auto ignoreLayoutSafeAreaBundles = std::move(ignoreLayoutSafeAreaBundles_); for (auto&& bundle = ignoreLayoutSafeAreaBundles.rbegin(); bundle != ignoreLayoutSafeAreaBundles.rend(); ++bundle) { diff --git a/test/unittest/core/layout/layout_property_test_ng_two.cpp b/test/unittest/core/layout/layout_property_test_ng_two.cpp index f3d9601ed97..a7e1968781f 100644 --- a/test/unittest/core/layout/layout_property_test_ng_two.cpp +++ b/test/unittest/core/layout/layout_property_test_ng_two.cpp @@ -1033,6 +1033,28 @@ HWTEST_F(LayoutPropertyTestNgTwo, FromJson001, TestSize.Level0) EXPECT_EQ(layoutProperty->GetNonAutoLayoutDirection(), TextDirection::RTL); } +/** + * @tc.name: UpdateSafeAreaPadding001 + * @tc.desc: Test UpdateSafeAreaPadding + * @tc.type: FUNC + */ +HWTEST_F(LayoutPropertyTestNgTwo, UpdateSafeAreaPadding001, TestSize.Level0) +{ + auto layoutProperty = AceType::MakeRefPtr(); + auto frameNodeHost = FrameNode::CreateFrameNode("host", 1, AceType::MakeRefPtr(), true); + layoutProperty->SetHost(frameNodeHost); + + PaddingProperty paddingProperty; + layoutProperty->ResetSafeAreaPadding(); + layoutProperty->UpdateSafeAreaPadding(paddingProperty); + EXPECT_TRUE(layoutProperty->GetSafeAreaPaddingProperty()); + + paddingProperty.start = std::make_optional(5.0); + layoutProperty->UpdateSafeAreaPadding(paddingProperty); + layoutProperty->ResetSafeAreaPadding(); + EXPECT_FALSE(layoutProperty->GetSafeAreaPaddingProperty()); +} + /** * @tc.name: PixelRoundToJsonValue001 * @tc.desc: Test PixelRoundToJsonValue -- Gitee