From 2fb0d45ed7b709372e44c2c800960527b7ccee1d Mon Sep 17 00:00:00 2001 From: openharmony_ci <120357966@qq.com> Date: Fri, 21 Apr 2023 07:01:23 +0000 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20!12370?= =?UTF-8?q?=20:=20=E4=BF=AE=E5=A4=8DGirdItem=E8=AE=BE=E7=BD=AEvisibility?= =?UTF-8?q?=E4=B8=BANone=E6=97=B6=E4=BC=9Acrash=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frameworks/core/components_ng/base/frame_node.cpp | 4 ++-- .../pattern/grid/grid_layout/grid_layout_algorithm.cpp | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/frameworks/core/components_ng/base/frame_node.cpp b/frameworks/core/components_ng/base/frame_node.cpp index 85cc72459dc..9046999ae48 100644 --- a/frameworks/core/components_ng/base/frame_node.cpp +++ b/frameworks/core/components_ng/base/frame_node.cpp @@ -709,9 +709,9 @@ RefPtr FrameNode::UpdateLayoutWrapper( if (layoutProperty_->GetVisibility().value_or(VisibleType::VISIBLE) == VisibleType::GONE) { if (!layoutWrapper) { layoutWrapper = - MakeRefPtr(WeakClaim(this), geometryNode_->Clone(), layoutProperty_->Clone()); + MakeRefPtr(WeakClaim(this), MakeRefPtr(), MakeRefPtr()); } else { - layoutWrapper->Update(WeakClaim(this), geometryNode_->Clone(), layoutProperty_->Clone()); + layoutWrapper->Update(WeakClaim(this), MakeRefPtr(), MakeRefPtr()); } layoutWrapper->SetLayoutAlgorithm(MakeRefPtr(nullptr, true, true)); isLayoutDirtyMarked_ = false; diff --git a/frameworks/core/components_ng/pattern/grid/grid_layout/grid_layout_algorithm.cpp b/frameworks/core/components_ng/pattern/grid/grid_layout/grid_layout_algorithm.cpp index 86d89a09b28..8d39a4dc890 100644 --- a/frameworks/core/components_ng/pattern/grid/grid_layout/grid_layout_algorithm.cpp +++ b/frameworks/core/components_ng/pattern/grid/grid_layout/grid_layout_algorithm.cpp @@ -64,7 +64,7 @@ LayoutConstraintF GridLayoutAlgorithm::CreateChildConstraint(const SizeF& idealS layoutConstraint.maxSize = SizeF(colLen, rowLen); layoutConstraint.percentReference = SizeF(colLen, rowLen); - if (!childLayoutProperty || !childLayoutProperty->GetCalcLayoutConstraint()) { + if (!childLayoutProperty->GetCalcLayoutConstraint()) { layoutConstraint.selfIdealSize.UpdateIllegalSizeWithCheck(layoutConstraint.maxSize); } return layoutConstraint; @@ -197,11 +197,9 @@ OffsetF GridLayoutAlgorithm::ComputeItemPosition(LayoutWrapper* layoutWrapper, i } colLen += (colSpan - 1) * columnsGap_; - if (childLayoutProperty) { - auto layoutConstraint = childLayoutProperty->GetLayoutConstraint(); - if (layoutConstraint.has_value()) { - OffsetByAlign(layoutConstraint.value(), rowLen, colLen, positionX, positionY); - } + auto layoutConstraint = childLayoutProperty->GetLayoutConstraint(); + if (layoutConstraint.has_value()) { + OffsetByAlign(layoutConstraint.value(), rowLen, colLen, positionX, positionY); } // If RTL, place the item from right. -- Gitee