diff --git a/frameworks/core/components_ng/base/frame_node.cpp b/frameworks/core/components_ng/base/frame_node.cpp index e624aa33ab8349eccdeead9d7b8ea2c1e5e576ba..3b2a7091fef50c43ec89253a58295fb0cc2686f0 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 c31f74424129fc6f9573fe69ba295ded7a1b6a55..ef26d2de98ea2fd2f0a2c0b8185a5c39dc51aabd 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 f3d9601ed97aef8297299821b93a92e7a72237d1..a7e1968781fe0b1f76073994a7973deeb06dd698 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