diff --git a/a.diff b/a.diff new file mode 100644 index 0000000000000000000000000000000000000000..77dfbb2ea8021d6986b81778319501c24686677c --- /dev/null +++ b/a.diff @@ -0,0 +1,541 @@ +diff --git a/frameworks/bridge/declarative_frontend/jsview/js_view_measure_layout.cpp b/frameworks/bridge/declarative_frontend/jsview/js_view_measure_layout.cpp +index d476a6d77a..c8f84d7b49 100644 +--- a/frameworks/bridge/declarative_frontend/jsview/js_view_measure_layout.cpp ++++ b/frameworks/bridge/declarative_frontend/jsview/js_view_measure_layout.cpp +@@ -254,7 +254,9 @@ void FillSubComponentProperty( + { + info->SetProperty("name", layoutWrapper->GetHostNode()->GetTag()); + info->SetProperty("id", std::to_string(layoutWrapper->GetHostNode()->GetId())); +- info->SetPropertyObject("constraint", GenConstraint(layoutWrapper->GetLayoutProperty()->GetLayoutConstraint())); ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ info->SetPropertyObject("constraint", GenConstraint(layoutProperty->GetLayoutConstraint())); + info->SetPropertyObject("borderInfo", GenBorderInfo(layoutWrapper)); + info->SetPropertyObject("position", GenPositionInfo(layoutWrapper)); + } +diff --git a/frameworks/core/components_ng/pattern/custom/custom_measure_layout_param.cpp b/frameworks/core/components_ng/pattern/custom/custom_measure_layout_param.cpp +index 03e4b3c886..8f215e9d57 100644 +--- a/frameworks/core/components_ng/pattern/custom/custom_measure_layout_param.cpp ++++ b/frameworks/core/components_ng/pattern/custom/custom_measure_layout_param.cpp +@@ -59,7 +59,9 @@ RefPtr MeasureLayoutParam::GetOrCreateChildByIndex(int32_t index) + + LayoutConstraintF MeasureLayoutParam::CreateChildConstraint() const + { +- return layoutWrapper_->GetLayoutProperty()->CreateChildConstraint(); ++ const auto& layoutProperty = layoutWrapper_->GetLayoutProperty(); ++ CHECK_NULL_RETURN(layoutProperty, {}); ++ return layoutProperty->CreateChildConstraint(); + } + + void MeasureLayoutParam::Update(LayoutWrapper* layoutWrapper) +diff --git a/frameworks/core/components_ng/pattern/flex/flex_layout_algorithm.cpp b/frameworks/core/components_ng/pattern/flex/flex_layout_algorithm.cpp +index dd131f0a2e..ceb27e1be2 100644 +--- a/frameworks/core/components_ng/pattern/flex/flex_layout_algorithm.cpp ++++ b/frameworks/core/components_ng/pattern/flex/flex_layout_algorithm.cpp +@@ -107,15 +107,17 @@ bool IsHorizontal(FlexDirection direction) + void UpdateChildLayoutConstrainByFlexBasis( + FlexDirection direction, const RefPtr& child, LayoutConstraintF& layoutConstraint) + { +- const auto& flexItemProperty = child->GetLayoutProperty()->GetFlexItemProperty(); ++ auto childLayoutProperty = child->GetLayoutProperty(); ++ CHECK_NULL_VOID(childLayoutProperty); ++ auto& flexItemProperty = childLayoutProperty->GetFlexItemProperty(); + CHECK_NULL_VOID(flexItemProperty); + const auto& flexBasis = flexItemProperty->GetFlexBasis(); + CHECK_NULL_VOID(flexBasis); + if (flexBasis->Unit() == DimensionUnit::AUTO || !flexBasis->IsValid()) { + return; + } +- if (child->GetLayoutProperty()->GetCalcLayoutConstraint()) { +- auto selfIdealSize = child->GetLayoutProperty()->GetCalcLayoutConstraint()->selfIdealSize; ++ if (childLayoutProperty->GetCalcLayoutConstraint()) { ++ auto selfIdealSize = childLayoutProperty->GetCalcLayoutConstraint()->selfIdealSize; + if (child->GetHostTag() == V2::BLANK_ETS_TAG && selfIdealSize.has_value()) { + if (IsHorizontal(direction) && selfIdealSize->Width().has_value() && + selfIdealSize->Width()->GetDimension().ConvertToPx() > flexBasis->ConvertToPx()) { +@@ -265,6 +267,7 @@ void FlexLayoutAlgorithm::TravelChildrenFlexProps(LayoutWrapper* layoutWrapper) + magicNodeWeights_.clear(); + childrenHasAlignSelfBaseLine_ = false; + const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); + const auto& children = layoutWrapper->GetAllChildrenWithBuild(); + auto childLayoutConstraint = layoutProperty->CreateChildConstraint(); + for (const auto& child : children) { +@@ -332,7 +335,9 @@ void FlexLayoutAlgorithm::UpdateAllocatedSize(const RefPtr& child + + void FlexLayoutAlgorithm::MeasureOutOfLayoutChildren(LayoutWrapper* layoutWrapper) + { +- const auto& layoutConstraint = layoutWrapper->GetLayoutProperty()->CreateChildConstraint(); ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ const auto& layoutConstraint = layoutProperty->CreateChildConstraint(); + for (const auto& child : outOfLayoutChildren_) { + child->Measure(layoutConstraint); + } +@@ -340,11 +345,13 @@ void FlexLayoutAlgorithm::MeasureOutOfLayoutChildren(LayoutWrapper* layoutWrappe + + void FlexLayoutAlgorithm::MeasureAdaptiveLayoutChildren(LayoutWrapper* layoutWrapper, SizeF& realSize) + { +- auto layoutConstraint = layoutWrapper->GetLayoutProperty()->CreateChildConstraint(); ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ auto layoutConstraint = layoutProperty->CreateChildConstraint(); + auto host = layoutWrapper->GetHostNode(); + CHECK_NULL_VOID(host); + if (host->GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_TWENTY) || host->GetTag() == V2::FLEX_ETS_TAG) { +- auto padding = layoutWrapper->GetLayoutProperty()->CreatePaddingAndBorder(); ++ auto padding = layoutProperty->CreatePaddingAndBorder(); + MinusPaddingToNonNegativeSize(padding, realSize); + } + layoutConstraint.parentIdealSize.SetSize(realSize); +@@ -382,7 +389,11 @@ std::map>::reverse_iterator FlexLayoutAlgori + } + const auto& childLayoutWrapper = child.layoutWrapper; + float childLayoutWeight = 0.0f; +- const auto& childMagicItemProperty = childLayoutWrapper->GetLayoutProperty()->GetMagicItemProperty(); ++ auto childLayoutProperty = childLayoutWrapper->GetLayoutProperty(); ++ if (!childLayoutProperty) { ++ continue; ++ } ++ const auto& childMagicItemProperty = childLayoutProperty->GetMagicItemProperty(); + childLayoutWeight = childMagicItemProperty.GetLayoutWeight().value_or(0.0f); + if (GreatNotEqual(childLayoutWeight, 0.0f)) { + allocatedSize_ += space_; +@@ -435,7 +446,11 @@ void FlexLayoutAlgorithm::SecondMeasureInWeightMode( + auto childLayoutWrapper = child.layoutWrapper; + auto& childConstraint = child.layoutConstraint; + float childLayoutWeight = 0.0f; +- const auto& childMagicItemProperty = childLayoutWrapper->GetLayoutProperty()->GetMagicItemProperty(); ++ auto childLayoutProperty = childLayoutWrapper->GetLayoutProperty(); ++ if (!childLayoutProperty) { ++ continue; ++ } ++ const auto& childMagicItemProperty = childLayoutProperty->GetMagicItemProperty(); + childLayoutWeight = childMagicItemProperty.GetLayoutWeight().value_or(0.0f); + if (LessOrEqual(childLayoutWeight, 0.0)) { + continue; +@@ -481,7 +496,11 @@ void FlexLayoutAlgorithm::FinalMeasureInWeightMode() + continue; + } + float childLayoutWeight = 0.0f; +- const auto& childMagicItemProperty = childLayoutWrapper->GetLayoutProperty()->GetMagicItemProperty(); ++ auto childLayoutProperty = childLayoutWrapper->GetLayoutProperty(); ++ if (!childLayoutProperty) { ++ continue; ++ } ++ const auto& childMagicItemProperty = childLayoutProperty->GetMagicItemProperty(); + childLayoutWeight = childMagicItemProperty.GetLayoutWeight().value_or(0.0f); + secondaryMeasureList_.emplace_back(child); + if (LessOrEqual(childLayoutWeight, 0.0)) { +@@ -535,13 +554,17 @@ void FlexLayoutAlgorithm::MeasureInPriorityMode(FlexItemProperties& flexItemProp + float crossAxisSize = crossAxisSize_; + for (auto& child : childList) { + const auto& childLayoutWrapper = child.layoutWrapper; +- childLayoutWrapper->GetLayoutProperty()->UpdatePropertyChangeFlag(PROPERTY_UPDATE_MEASURE); ++ const auto& childLayoutProperty = childLayoutWrapper->GetLayoutProperty(); ++ if (!childLayoutProperty) { ++ continue; ++ } ++ childLayoutProperty->UpdatePropertyChangeFlag(PROPERTY_UPDATE_MEASURE); + UpdateChildLayoutConstrainByFlexBasis(direction_, childLayoutWrapper, child.layoutConstraint); + childLayoutWrapper->Measure(child.layoutConstraint); + UpdateAllocatedSize(childLayoutWrapper, crossAxisSize); + CheckSizeValidity(childLayoutWrapper); + CheckBaselineProperties(childLayoutWrapper); +- const auto& flexItemProperty = childLayoutWrapper->GetLayoutProperty()->GetFlexItemProperty(); ++ const auto& flexItemProperty = childLayoutProperty->GetFlexItemProperty(); + if (flexItemProperty && GreatNotEqual(flexItemProperty->GetFlexGrow().value_or(0.0f), 0.0f)) { + flexItemProperties.totalGrow += flexItemProperty->GetFlexGrow().value_or(0.0f); + } +@@ -660,7 +683,9 @@ bool FlexLayoutAlgorithm::HandleBlankFirstTimeMeasure( + void FlexLayoutAlgorithm::UpdateFlexProperties( + FlexItemProperties& flexItemProperties, const RefPtr& layoutWrapper) + { +- const auto& flexItemProperty = layoutWrapper->GetLayoutProperty()->GetFlexItemProperty(); ++ auto layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ const auto& flexItemProperty = layoutProperty->GetFlexItemProperty(); + float flexShrink = isLinearLayoutFeature_ ? 0.0f : 1.0f; + float flexGrow = 0.0f; + if (flexItemProperty) { +@@ -730,7 +755,9 @@ void FlexLayoutAlgorithm::SecondaryMeasureByProperty( + /** + * get the real cross axis size. + */ +- auto padding = layoutWrapper->GetLayoutProperty()->CreatePaddingAndBorder(); ++ auto layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ auto padding = layoutProperty->CreatePaddingAndBorder(); + auto paddingLeft = padding.left.value_or(0.0f); + auto paddingRight = padding.right.value_or(0.0f); + auto paddingTop = padding.top.value_or(0.0f); +@@ -962,7 +989,9 @@ void FlexLayoutAlgorithm::CheckMainAxisSizeAuto( + + void FlexLayoutAlgorithm::SetInitMainAxisSize(LayoutWrapper* layoutWrapper) + { +- const auto& layoutConstraint = layoutWrapper->GetLayoutProperty()->GetLayoutConstraint(); ++ auto layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ const auto& layoutConstraint = layoutProperty->GetLayoutConstraint(); + bool mainAxisInf = GreaterOrEqualToInfinity(IsHorizontal(direction_) ? layoutConstraint->maxSize.Width() + : layoutConstraint->maxSize.Height()) && + NearEqual(mainAxisSize_, -1.0f); +@@ -994,14 +1023,16 @@ void FlexLayoutAlgorithm::SetInitMainAxisSize(LayoutWrapper* layoutWrapper) + void FlexLayoutAlgorithm::SetFinalRealSize( + LayoutWrapper* layoutWrapper, SizeF& realSize, std::optional layoutPolicy) + { +- const auto& layoutConstraint = layoutWrapper->GetLayoutProperty()->GetLayoutConstraint(); ++ auto layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ const auto& layoutConstraint = layoutProperty->GetLayoutConstraint(); + auto widthLayoutPolicy = LayoutCalPolicy::NO_MATCH; + auto heightLayoutPolicy = LayoutCalPolicy::NO_MATCH; + if (layoutPolicy.has_value()) { + widthLayoutPolicy = layoutPolicy.value().widthLayoutPolicy_.value_or(LayoutCalPolicy::NO_MATCH); + heightLayoutPolicy = layoutPolicy.value().heightLayoutPolicy_.value_or(LayoutCalPolicy::NO_MATCH); + } +- auto padding = layoutWrapper->GetLayoutProperty()->CreatePaddingAndBorder(); ++ auto padding = layoutProperty->CreatePaddingAndBorder(); + auto horizontalPadding = padding.left.value_or(0.0f) + padding.right.value_or(0.0f); + auto verticalPadding = padding.top.value_or(0.0f) + padding.bottom.value_or(0.0f); + auto finalMainAxisSize = mainAxisSize_; +@@ -1049,16 +1080,18 @@ void FlexLayoutAlgorithm::SetFinalRealSize( + void FlexLayoutAlgorithm::Measure(LayoutWrapper* layoutWrapper) + { + const auto& children = layoutWrapper->GetAllChildrenWithBuild(); +- const auto& layoutConstraint = layoutWrapper->GetLayoutProperty()->GetLayoutConstraint(); +- const auto& calcConstraint = layoutWrapper->GetLayoutProperty()->GetCalcLayoutConstraint(); ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ const auto& layoutConstraint = layoutProperty->GetLayoutConstraint(); ++ const auto& calcConstraint = layoutProperty->GetCalcLayoutConstraint(); + bool needToConstraint = CheckSetConstraint(calcConstraint) && children.empty(); +- const auto& measureType = layoutWrapper->GetLayoutProperty()->GetMeasureType(); ++ const auto& measureType = layoutProperty->GetMeasureType(); + InitFlexProperties(layoutWrapper); + Axis axis = (IsHorizontal(direction_)) ? Axis::HORIZONTAL : Axis::VERTICAL; + auto realSize = + CreateIdealSizeByPercentRef(layoutConstraint.value(), axis, measureType, needToConstraint, calcConstraint) + .ConvertToSizeT(); +- auto layoutPolicy = layoutWrapper->GetLayoutProperty()->GetLayoutPolicyProperty(); ++ auto layoutPolicy = layoutProperty->GetLayoutPolicyProperty(); + if (layoutPolicy.has_value()) { + auto widthLayoutPolicy = layoutPolicy.value().widthLayoutPolicy_; + auto heightLayoutPolicy = layoutPolicy.value().heightLayoutPolicy_; +@@ -1421,8 +1454,10 @@ bool FlexLayoutAlgorithm::CheckReCalcMainExpand(const FlexAlign& crossAlign) + + FlexAlign FlexLayoutAlgorithm::GetSelfAlign(const RefPtr& layoutWrapper) const + { +- const auto& flexItemProperty = layoutWrapper->GetLayoutProperty()->GetFlexItemProperty(); + FlexAlign crossAxisAlign = (crossAxisAlign_ == FlexAlign::AUTO) ? FlexAlign::FLEX_START : crossAxisAlign_; ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_RETURN(layoutProperty, crossAxisAlign); ++ const auto& flexItemProperty = layoutProperty->GetFlexItemProperty(); + if (!flexItemProperty || !flexItemProperty->GetAlignSelf().has_value() || + flexItemProperty->GetAlignSelf().value_or(crossAxisAlign_) == FlexAlign::AUTO) { + return crossAxisAlign; +diff --git a/frameworks/core/components_ng/pattern/flex/wrap_layout_algorithm.cpp b/frameworks/core/components_ng/pattern/flex/wrap_layout_algorithm.cpp +index b20805391a..a382baae5b 100644 +--- a/frameworks/core/components_ng/pattern/flex/wrap_layout_algorithm.cpp ++++ b/frameworks/core/components_ng/pattern/flex/wrap_layout_algorithm.cpp +@@ -205,7 +205,9 @@ void WrapLayoutAlgorithm::StretchItemsInContent(LayoutWrapper* layoutWrapper, co + if (crossAlignment_ != WrapAlignment::STRETCH) { + return; + } +- auto childLayoutConstraint = layoutWrapper->GetLayoutProperty()->CreateChildConstraint(); ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ auto childLayoutConstraint = layoutProperty->CreateChildConstraint(); + for (const auto& item : content.itemList) { + auto itemCrossAxisLength = GetItemCrossAxisLength(item->GetGeometryNode()); + // if content cross axis size is larger than item cross axis size, +diff --git a/frameworks/core/components_ng/pattern/folder_stack/folder_stack_layout_algorithm.cpp b/frameworks/core/components_ng/pattern/folder_stack/folder_stack_layout_algorithm.cpp +index a984b6ebce..bb8c3b5f54 100644 +--- a/frameworks/core/components_ng/pattern/folder_stack/folder_stack_layout_algorithm.cpp ++++ b/frameworks/core/components_ng/pattern/folder_stack/folder_stack_layout_algorithm.cpp +@@ -55,8 +55,10 @@ void FolderStackLayoutAlgorithm::LayoutHoverStack(LayoutWrapper* layoutWrapper, + { + auto folderStackGeometryNode = layoutWrapper->GetGeometryNode(); + auto size = folderStackGeometryNode->GetFrameSize(); +- const auto& padding = layoutWrapper->GetLayoutProperty()->CreatePaddingAndBorder(); +- auto layoutDirection = layoutWrapper->GetLayoutProperty()->GetLayoutDirection(); ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ const auto& padding = layoutProperty->CreatePaddingAndBorder(); ++ auto layoutDirection = layoutProperty->GetLayoutDirection(); + if (layoutDirection == TextDirection::AUTO) { + layoutDirection = AceApplicationInfo::GetInstance().IsRightToLeft() ? TextDirection::RTL : TextDirection::LTR; + } +@@ -91,7 +93,9 @@ void FolderStackLayoutAlgorithm::LayoutControlPartsStack(LayoutWrapper* layoutWr + const RefPtr& hostNode, const RefPtr& folderStackLayoutProperty) + { + auto folderStackGeometryNode = layoutWrapper->GetGeometryNode(); +- auto layoutDirection = layoutWrapper->GetLayoutProperty()->GetLayoutDirection(); ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ auto layoutDirection = layoutProperty->GetLayoutDirection(); + if (layoutDirection == TextDirection::AUTO) { + layoutDirection = AceApplicationInfo::GetInstance().IsRightToLeft() ? TextDirection::RTL : TextDirection::LTR; + } +diff --git a/frameworks/core/components_ng/pattern/linear_split/linear_split_layout_algorithm.cpp b/frameworks/core/components_ng/pattern/linear_split/linear_split_layout_algorithm.cpp +index e7d4947baf..7c7510227e 100644 +--- a/frameworks/core/components_ng/pattern/linear_split/linear_split_layout_algorithm.cpp ++++ b/frameworks/core/components_ng/pattern/linear_split/linear_split_layout_algorithm.cpp +@@ -34,7 +34,9 @@ void LinearSplitLayoutAlgorithm::Measure(LayoutWrapper* layoutWrapper) + return; + } + layoutPolicyChildren_.clear(); +- const auto& layoutConstraint = layoutWrapper->GetLayoutProperty()->GetLayoutConstraint(); ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ const auto& layoutConstraint = layoutProperty->GetLayoutConstraint(); + const auto& minSize = layoutConstraint->minSize; + const auto& maxSize = layoutConstraint->maxSize; + visibleChildCount_ = GetVisibleChildCount(layoutWrapper); +@@ -46,7 +48,7 @@ void LinearSplitLayoutAlgorithm::Measure(LayoutWrapper* layoutWrapper) + break; + } + +- if (layoutWrapper->GetLayoutProperty()->GetMeasureType() == MeasureType::MATCH_PARENT) { ++ if (layoutProperty->GetMeasureType() == MeasureType::MATCH_PARENT) { + realSize.UpdateIllegalSizeWithCheck(layoutConstraint->parentIdealSize); + } + } while (false); +@@ -89,12 +91,14 @@ void LinearSplitLayoutAlgorithm::Measure(LayoutWrapper* layoutWrapper) + + void LinearSplitLayoutAlgorithm::MeasureBeforeAPI10(LayoutWrapper* layoutWrapper) + { +- const auto& layoutConstraint = layoutWrapper->GetLayoutProperty()->GetLayoutConstraint(); ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ const auto& layoutConstraint = layoutProperty->GetLayoutConstraint(); + const auto& minSize = layoutConstraint->minSize; + const auto& maxSize = layoutConstraint->maxSize; + const auto& parentIdeaSize = layoutConstraint->parentIdealSize; +- auto padding = layoutWrapper->GetLayoutProperty()->CreatePaddingAndBorder(); +- auto measureType = layoutWrapper->GetLayoutProperty()->GetMeasureType(); ++ auto padding = layoutProperty->CreatePaddingAndBorder(); ++ auto measureType = layoutProperty->GetMeasureType(); + OptionalSizeF realSize; + do { + // Use idea size first if it is valid. +@@ -137,7 +141,9 @@ void LinearSplitLayoutAlgorithm::MeasureBeforeAPI10(LayoutWrapper* layoutWrapper + + std::pair LinearSplitLayoutAlgorithm::MeasureChildren(LayoutWrapper* layoutWrapper) + { +- auto padding = layoutWrapper->GetLayoutProperty()->CreatePaddingAndBorder(); ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_RETURN(layoutProperty, {}); ++ auto padding = layoutProperty->CreatePaddingAndBorder(); + // Get Max Size for children. + float allocatedSize = 0.0f; + float crossSize = 0.0f; +@@ -186,7 +192,9 @@ SizeF LinearSplitLayoutAlgorithm::MeasureChildrenBeforeAPI10(LayoutWrapper* layo + { + const auto& layoutConstraint = layoutWrapper->GetLayoutProperty()->GetLayoutConstraint(); + const auto& maxSize = layoutConstraint->maxSize; +- auto padding = layoutWrapper->GetLayoutProperty()->CreatePaddingAndBorder(); ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_RETURN(layoutProperty, {}); ++ auto padding = layoutProperty->CreatePaddingAndBorder(); + // Get Max Size for children. + OptionalSizeF optionalMaxSize; + optionalMaxSize.UpdateIllegalSizeWithCheck(maxSize); +@@ -195,7 +203,7 @@ SizeF LinearSplitLayoutAlgorithm::MeasureChildrenBeforeAPI10(LayoutWrapper* layo + + const auto& childrenWrappers = layoutWrapper->GetAllChildrenWithBuild(); + +- auto childConstraint = layoutWrapper->GetLayoutProperty()->CreateChildConstraint(); ++ auto childConstraint = layoutProperty->CreateChildConstraint(); + childConstraint.maxSize = layoutConstraint->selfIdealSize.ConvertToSizeT(); + if (childConstraint.maxSize.Height() < 0.0) { + childConstraint.maxSize.SetHeight(maxSize.Height()); +@@ -248,7 +256,9 @@ void LinearSplitLayoutAlgorithm::Layout(LayoutWrapper* layoutWrapper) + LayoutBeforeAPI10(layoutWrapper); + return; + } +- auto padding = layoutWrapper->GetLayoutProperty()->CreatePaddingAndBorder(); ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ auto padding = layoutProperty->CreatePaddingAndBorder(); + float childTotalWidth = 0.0f; + float childTotalHeight = 0.0f; + visibleChildCount_ = GetVisibleChildCount(layoutWrapper); +@@ -307,7 +317,9 @@ void LinearSplitLayoutAlgorithm::UpdateChildPositionWidthIgnoreLayoutSafeArea( + void LinearSplitLayoutAlgorithm::LayoutRowSplit( + LayoutWrapper* layoutWrapper, float childOffsetMain, float childOffsetCross) + { +- auto padding = layoutWrapper->GetLayoutProperty()->CreatePaddingAndBorder(); ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ auto padding = layoutProperty->CreatePaddingAndBorder(); + auto parentHeight = layoutWrapper->GetGeometryNode()->GetFrameSize().Height() - padding.Height(); + bool isFirstSetPos = false; + if (childrenDragPos_.empty()) { +@@ -359,7 +371,9 @@ void LinearSplitLayoutAlgorithm::LayoutColumnSplit( + LayoutWrapper* layoutWrapper, float childOffsetMain, float childOffsetCross) + { + const auto [startMargin, endMargin] = GetDividerMargin(layoutWrapper); +- auto padding = layoutWrapper->GetLayoutProperty()->CreatePaddingAndBorder(); ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ auto padding = layoutProperty->CreatePaddingAndBorder(); + auto parentWidth = layoutWrapper->GetGeometryNode()->GetFrameSize().Width() - padding.Width(); + bool isFirstSetPos = false; + if (childrenDragPos_.empty()) { +@@ -415,7 +429,9 @@ void LinearSplitLayoutAlgorithm::ColumnSplitChildConstrain( + return; + } + const auto [startMargin, endMargin] = GetDividerMargin(layoutWrapper); +- auto childMargin = item->GetLayoutProperty()->CreateMargin(); ++ const auto& layoutProperty = item->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ auto childMargin = layoutProperty->CreateMargin(); + float marginHeight = childMargin.top.value_or(0.f) + childMargin.bottom.value_or(0.f); + childrenConstrains_[index] = GetItemMinSize(item, layoutWrapper) + marginHeight; + if (index == 0) { +@@ -456,7 +472,8 @@ int32_t LinearSplitLayoutAlgorithm::GetVisibleChildCount(LayoutWrapper* layoutWr + { + int32_t visibleChildCount = 0; + for (const auto& child : layoutWrapper->GetAllChildrenWithBuild()) { +- if (child->GetLayoutProperty()->GetVisibilityValue(VisibleType::VISIBLE) != VisibleType::GONE) { ++ const auto& childLayoutProperty = child->GetLayoutProperty(); ++ if (childLayoutProperty && childLayoutProperty->GetVisibilityValue(VisibleType::VISIBLE) != VisibleType::GONE) { + visibleChildCount++; + } + } +@@ -465,7 +482,9 @@ int32_t LinearSplitLayoutAlgorithm::GetVisibleChildCount(LayoutWrapper* layoutWr + + void LinearSplitLayoutAlgorithm::LayoutBeforeAPI10(LayoutWrapper* layoutWrapper) + { +- auto padding = layoutWrapper->GetLayoutProperty()->CreatePaddingAndBorder(); ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ auto padding = layoutProperty->CreatePaddingAndBorder(); + int32_t index = 0; + float childOffsetMain = 0.0f; + float childOffsetCross = 0.0f; +@@ -515,7 +534,9 @@ void LinearSplitLayoutAlgorithm::LayoutBeforeAPI10(LayoutWrapper* layoutWrapper) + void LinearSplitLayoutAlgorithm::LayoutRowSplitBeforeAPI10( + LayoutWrapper* layoutWrapper, float childOffsetMain, float childOffsetCross, float childTotalOffsetMain) + { +- auto padding = layoutWrapper->GetLayoutProperty()->CreatePaddingAndBorder(); ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ auto padding = layoutProperty->CreatePaddingAndBorder(); + auto parentWidth = layoutWrapper->GetGeometryNode()->GetFrameSize().Width() - padding.Width(); + auto parentHeight = layoutWrapper->GetGeometryNode()->GetFrameSize().Height() - padding.Height(); + +@@ -546,7 +567,9 @@ void LinearSplitLayoutAlgorithm::LayoutRowSplitBeforeAPI10( + void LinearSplitLayoutAlgorithm::LayoutColumnSplitBeforeAPI10( + LayoutWrapper* layoutWrapper, float childOffsetMain, float childOffsetCross, float childTotalOffsetCross) + { +- auto padding = layoutWrapper->GetLayoutProperty()->CreatePaddingAndBorder(); ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ auto padding = layoutProperty->CreatePaddingAndBorder(); + auto parentWidth = layoutWrapper->GetGeometryNode()->GetFrameSize().Width() - padding.Width(); + auto parentHeight = layoutWrapper->GetGeometryNode()->GetFrameSize().Height() - padding.Height(); + +@@ -576,10 +599,10 @@ void LinearSplitLayoutAlgorithm::LayoutColumnSplitBeforeAPI10( + + float LinearSplitLayoutAlgorithm::GetItemMinSize(const RefPtr& item, LayoutWrapper* layoutWrapper) const + { +- const auto& calcConstraint = item->GetLayoutProperty()->GetCalcLayoutConstraint(); + const auto& layoutProperty = item->GetLayoutProperty(); + const auto& minSizeTheme = GetLinearSplitChildMinSize(layoutWrapper); + CHECK_NULL_RETURN(layoutProperty, minSizeTheme); ++ const auto& calcConstraint = layoutProperty->GetCalcLayoutConstraint(); + + float minSizeF = 0.0f; + if (calcConstraint && calcConstraint->minSize.has_value()) { +@@ -627,7 +650,9 @@ OptionalSizeF LinearSplitLayoutAlgorithm::MeasureSelfByLayoutPolicy(LayoutWrappe + + void LinearSplitLayoutAlgorithm::MeasureAdaptiveLayoutChildren(LayoutWrapper* layoutWrapper, SizeF realSize) + { +- auto padding = layoutWrapper->GetLayoutProperty()->CreatePaddingAndBorder(); ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ auto padding = layoutProperty->CreatePaddingAndBorder(); + MinusPaddingToNonNegativeSize(padding, realSize); + auto host = layoutWrapper->GetHostNode(); + IgnoreLayoutSafeAreaBundle bundle; +diff --git a/frameworks/core/components_ng/pattern/relative_container/relative_container_layout_algorithm.cpp b/frameworks/core/components_ng/pattern/relative_container/relative_container_layout_algorithm.cpp +index 243f073093..8ea8a13294 100644 +--- a/frameworks/core/components_ng/pattern/relative_container/relative_container_layout_algorithm.cpp ++++ b/frameworks/core/components_ng/pattern/relative_container/relative_container_layout_algorithm.cpp +@@ -1413,7 +1413,11 @@ void RelativeContainerLayoutAlgorithm::GetDependencyRelationship() + for (const auto& mapItem : idNodeMap_) { + auto childWrapper = mapItem.second.layoutWrapper; + auto childId = mapItem.second.id; +- const auto& flexItem = childWrapper->GetLayoutProperty()->GetFlexItemProperty(); ++ const auto& childLayoutProperty = childWrapper->GetLayoutProperty(); ++ if (!childLayoutProperty) { ++ continue; ++ } ++ const auto& flexItem = childLayoutProperty->GetFlexItemProperty(); + if (!flexItem || !flexItem->HasAlignRules()) { + continue; + } +@@ -1449,6 +1453,9 @@ void RelativeContainerLayoutAlgorithm::GetDependencyRelationship() + if (!AceApplicationInfo::GetInstance().GreatOrEqualTargetAPIVersion(PlatformVersion::VERSION_TWELVE)) { + auto anchorChildWrapper = it->second.layoutWrapper; + auto anchorChildLayoutProp = anchorChildWrapper->GetLayoutProperty(); ++ if (!anchorChildLayoutProp) { ++ continue; ++ } + auto anchorChildVisibility = anchorChildLayoutProp->GetVisibility(); + if (anchorChildVisibility == VisibleType::GONE) { + childWrapper->SetActive(false); +@@ -1578,7 +1585,11 @@ void RelativeContainerLayoutAlgorithm::TopologicalSort(std::list& r + for (const auto& mapItem : idNodeMap_) { + auto childWrapper = mapItem.second.layoutWrapper; + auto childHostNode = childWrapper->GetHostNode(); +- const auto& flexItem = childWrapper->GetLayoutProperty()->GetFlexItemProperty(); ++ const auto& childLayoutProperty = childWrapper->GetLayoutProperty(); ++ if (!childLayoutProperty) { ++ continue; ++ } ++ const auto& flexItem = childLayoutProperty->GetFlexItemProperty(); + if (!flexItem || incomingDegreeMap_[mapItem.second.id] == 0) { + layoutQueue.push(mapItem.second.id); + } +@@ -1726,7 +1737,9 @@ void RelativeContainerLayoutAlgorithm::CalcSizeParam(LayoutWrapper* layoutWrappe + void RelativeContainerLayoutAlgorithm::CalcOffsetParam(LayoutWrapper* layoutWrapper, const std::string& nodeName) + { + auto childWrapper = idNodeMap_[nodeName].layoutWrapper; +- auto alignRules = childWrapper->GetLayoutProperty()->GetFlexItemProperty()->GetAlignRulesValue(); ++ const auto& childLayoutProperty = childWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(childLayoutProperty); ++ auto alignRules = childLayoutProperty->GetFlexItemProperty()->GetAlignRulesValue(); + float offsetX = 0.0f; + bool offsetXCalculated = false; + float offsetY = 0.0f; +@@ -2232,7 +2245,9 @@ BarrierDirection RelativeContainerLayoutAlgorithm::BarrierDirectionRtl(BarrierDi + + void RelativeContainerLayoutAlgorithm::AdjustOffsetRtl(LayoutWrapper* layoutWrapper) + { +- auto textDirection = layoutWrapper->GetLayoutProperty()->GetNonAutoLayoutDirection(); ++ const auto& layoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ auto textDirection = layoutProperty->GetNonAutoLayoutDirection(); + if (textDirection != TextDirection::RTL) { + return; + } +diff --git a/frameworks/core/components_ng/pattern/stack/stack_layout_algorithm.cpp b/frameworks/core/components_ng/pattern/stack/stack_layout_algorithm.cpp +index 94e7d53dec..edb12a47bc 100644 +--- a/frameworks/core/components_ng/pattern/stack/stack_layout_algorithm.cpp ++++ b/frameworks/core/components_ng/pattern/stack/stack_layout_algorithm.cpp +@@ -35,8 +35,10 @@ void StackLayoutAlgorithm::PerformLayout(LayoutWrapper* layoutWrapper) + { + // update child position. + auto frameSize = layoutWrapper->GetGeometryNode()->GetFrameSize(); +- const auto& padding = layoutWrapper->GetLayoutProperty()->CreatePaddingAndBorder(); +- auto layoutDirection = layoutWrapper->GetLayoutProperty()->GetLayoutDirection(); ++ const auto& stackLayoutProperty = layoutWrapper->GetLayoutProperty(); ++ CHECK_NULL_VOID(stackLayoutProperty); ++ const auto& padding = stackLayoutProperty->CreatePaddingAndBorder(); ++ auto layoutDirection = stackLayoutProperty->GetLayoutDirection(); + if (layoutDirection == TextDirection::AUTO) { + layoutDirection = AceApplicationInfo::GetInstance().IsRightToLeft() ? TextDirection::RTL : TextDirection::LTR; + } diff --git a/a.patch b/a.patch new file mode 100644 index 0000000000000000000000000000000000000000..bcdce3344b27211235f3545f84dd41d058e23922 --- /dev/null +++ b/a.patch @@ -0,0 +1,1770 @@ +From e8a2d12d01d844c971056c31a506c0402d51e2ee Mon Sep 17 00:00:00 2001 +From: bizhenhang +Date: Sat, 28 Jun 2025 18:15:31 +0800 +Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=BE=A7static=E4=BE=B5?= + =?UTF-8?q?=E5=85=A5=E5=BC=8F=E5=9B=9E=E9=80=80?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: bizhenhang +--- + .../jsview/models/flex_model_impl.h | 2 - + .../components/common/layout/position_param.h | 8 ++ + .../core/components_ng/pattern/BUILD.gn | 8 ++ + .../pattern/divider/divider_model_ng.cpp | 24 ++--- + .../pattern/divider/divider_model_ng.h | 6 +- + .../divider/divider_model_ng_static.cpp | 47 ++++++++++ + .../pattern/divider/divider_model_ng_static.h | 32 +++++++ + .../pattern/flex/flex_layout_property.h | 3 - + .../pattern/flex/flex_layout_styles.h | 2 - + .../components_ng/pattern/flex/flex_model.h | 2 - + .../pattern/flex/flex_model_ng.cpp | 89 ------------------- + .../pattern/flex/flex_model_ng.h | 10 --- + .../pattern/flex/flex_model_ng_static.cpp | 81 +++++++++++++++++ + .../pattern/flex/flex_model_ng_static.h | 35 ++++++++ + .../folder_stack/folder_stack_model_ng.cpp | 53 ++--------- + .../folder_stack/folder_stack_model_ng.h | 3 - + .../folder_stack_model_ng_static.cpp | 62 +++++++++++++ + .../folder_stack_model_ng_static.h | 32 +++++++ + .../grid_col/grid_col_model_ng_static.cpp | 43 +++++++++ + .../grid_col/grid_col_model_ng_static.h | 32 +++++++ + .../grid_row/grid_row_model_ng_static.cpp | 41 +++++++++ + .../grid_row/grid_row_model_ng_static.h | 31 +++++++ + .../pattern/linear_layout/column_model_ng.cpp | 21 ++--- + .../pattern/linear_layout/column_model_ng.h | 4 +- + .../linear_layout/column_model_ng_static.cpp | 49 ++++++++++ + .../linear_layout/column_model_ng_static.h | 33 +++++++ + .../pattern/linear_layout/row_model_ng.cpp | 26 ++---- + .../pattern/linear_layout/row_model_ng.h | 6 +- + .../linear_layout/row_model_ng_static.cpp | 52 +++++++++++ + .../linear_layout/row_model_ng_static.h | 32 +++++++ + .../linear_split_model_ng_static.cpp | 41 +++++++++ + .../linear_split_model_ng_static.h | 33 +++++++ + .../relative_container_layout_property.h | 84 ----------------- + .../native/implementation/column_modifier.cpp | 5 +- + .../implementation/divider_modifier.cpp | 7 +- + .../native/implementation/flex_modifier.cpp | 15 ++-- + .../implementation/folder_stack_modifier.cpp | 7 +- + .../native/implementation/row_modifier.cpp | 5 +- + 38 files changed, 750 insertions(+), 316 deletions(-) + create mode 100644 frameworks/core/components_ng/pattern/divider/divider_model_ng_static.cpp + create mode 100644 frameworks/core/components_ng/pattern/divider/divider_model_ng_static.h + create mode 100644 frameworks/core/components_ng/pattern/flex/flex_model_ng_static.cpp + create mode 100644 frameworks/core/components_ng/pattern/flex/flex_model_ng_static.h + create mode 100644 frameworks/core/components_ng/pattern/folder_stack/folder_stack_model_ng_static.cpp + create mode 100644 frameworks/core/components_ng/pattern/folder_stack/folder_stack_model_ng_static.h + create mode 100644 frameworks/core/components_ng/pattern/grid_col/grid_col_model_ng_static.cpp + create mode 100644 frameworks/core/components_ng/pattern/grid_col/grid_col_model_ng_static.h + create mode 100644 frameworks/core/components_ng/pattern/grid_row/grid_row_model_ng_static.cpp + create mode 100644 frameworks/core/components_ng/pattern/grid_row/grid_row_model_ng_static.h + create mode 100644 frameworks/core/components_ng/pattern/linear_layout/column_model_ng_static.cpp + create mode 100644 frameworks/core/components_ng/pattern/linear_layout/column_model_ng_static.h + create mode 100644 frameworks/core/components_ng/pattern/linear_layout/row_model_ng_static.cpp + create mode 100644 frameworks/core/components_ng/pattern/linear_layout/row_model_ng_static.h + create mode 100644 frameworks/core/components_ng/pattern/linear_split/linear_split_model_ng_static.cpp + create mode 100644 frameworks/core/components_ng/pattern/linear_split/linear_split_model_ng_static.h + +diff --git a/frameworks/bridge/declarative_frontend/jsview/models/flex_model_impl.h b/frameworks/bridge/declarative_frontend/jsview/models/flex_model_impl.h +index 3a00ff1a0b4..93af8388943 100644 +--- a/frameworks/bridge/declarative_frontend/jsview/models/flex_model_impl.h ++++ b/frameworks/bridge/declarative_frontend/jsview/models/flex_model_impl.h +@@ -48,8 +48,6 @@ public: + void SetAlignContent(int32_t value) override; + void SetMainSpace(const std::optional& space) override {}; + void SetCrossSpace(const std::optional& space) override {}; +- void SetWidthLayoutPolicy(uint8_t widthLayoutPolicy) override {}; +- void SetHeightLayoutPolicy(uint8_t heightLayoutPolicy) override {}; + }; + + } // namespace OHOS::Ace::Framework +diff --git a/frameworks/core/components/common/layout/position_param.h b/frameworks/core/components/common/layout/position_param.h +index e71d46920af..e413f5230bd 100644 +--- a/frameworks/core/components/common/layout/position_param.h ++++ b/frameworks/core/components/common/layout/position_param.h +@@ -216,6 +216,14 @@ struct BarrierInfo { + (this->referencedId == right.referencedId)); + } + }; ++ ++struct LocalizedBarrierInfo : public BarrierInfo { ++ LocalizedBarrierInfo() ++ { ++ direction = BarrierDirection::START; ++ } ++}; ++ + } // namespace OHOS::Ace + + #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_BASE_LAYOUT_POSITION_PARAM_H +diff --git a/frameworks/core/components_ng/pattern/BUILD.gn b/frameworks/core/components_ng/pattern/BUILD.gn +index 6abe246273c..a07d2a5e7e0 100644 +--- a/frameworks/core/components_ng/pattern/BUILD.gn ++++ b/frameworks/core/components_ng/pattern/BUILD.gn +@@ -118,12 +118,14 @@ build_component_ng("pattern_ng") { + "dialog/dialog_view.cpp", + "divider/divider_layout_algorithm.cpp", + "divider/divider_model_ng.cpp", ++ "divider/divider_model_ng_static.cpp", + "divider/divider_modifier.cpp", + "divider/divider_pattern.cpp", + "effect_component/effect_component_model_ng.cpp", + "effect_component/effect_component_pattern.cpp", + "flex/flex_layout_algorithm.cpp", + "flex/flex_model_ng.cpp", ++ "flex/flex_model_ng_static.cpp", + "flex/wrap_layout_algorithm.cpp", + "form_link/form_link_model_ng.cpp", + "form_link/form_link_pattern.cpp", +@@ -161,12 +163,14 @@ build_component_ng("pattern_ng") { + "grid_col/grid_col_layout_algorithm.cpp", + "grid_col/grid_col_layout_property.cpp", + "grid_col/grid_col_model_ng.cpp", ++ "grid_col/grid_col_model_ng_static.cpp", + "grid_container/grid_container_layout_property.cpp", + "grid_container/grid_container_model_ng.cpp", + "grid_row/grid_row_layout_algorithm.cpp", + "grid_row/grid_row_layout_pattern.cpp", + "grid_row/grid_row_layout_property.cpp", + "grid_row/grid_row_model_ng.cpp", ++ "grid_row/grid_row_model_ng_static.cpp", + "hyperlink/hyperlink_model_ng.cpp", + "hyperlink/hyperlink_model_static.cpp", + "hyperlink/hyperlink_pattern.cpp", +@@ -199,10 +203,13 @@ build_component_ng("pattern_ng") { + "linear_indicator/linear_indicator_model_ng.cpp", + "linear_indicator/linear_indicator_pattern.cpp", + "linear_layout/column_model_ng.cpp", ++ "linear_layout/column_model_ng_static.cpp", + "linear_layout/linear_layout_utils.cpp", + "linear_layout/row_model_ng.cpp", ++ "linear_layout/row_model_ng_static.cpp", + "linear_split/linear_split_layout_algorithm.cpp", + "linear_split/linear_split_model_ng.cpp", ++ "linear_split/linear_split_model_ng_static.cpp", + "linear_split/linear_split_paint_method.cpp", + "linear_split/linear_split_pattern.cpp", + "list/list_accessibility_property.cpp", +@@ -647,6 +654,7 @@ build_component_ng("pattern_ng") { + "folder_stack/folder_stack_group_node.cpp", + "folder_stack/folder_stack_layout_algorithm.cpp", + "folder_stack/folder_stack_model_ng.cpp", ++ "folder_stack/folder_stack_model_ng_static.cpp", + "folder_stack/folder_stack_pattern.cpp", + "folder_stack/hover_stack_node.cpp", + "picker/datepicker_dialog_view.cpp", +diff --git a/frameworks/core/components_ng/pattern/divider/divider_model_ng.cpp b/frameworks/core/components_ng/pattern/divider/divider_model_ng.cpp +index c3cafa7b13f..572c045eb2c 100644 +--- a/frameworks/core/components_ng/pattern/divider/divider_model_ng.cpp ++++ b/frameworks/core/components_ng/pattern/divider/divider_model_ng.cpp +@@ -101,31 +101,19 @@ void DividerModelNG::LineCap(const Ace::LineCap& value) + ACE_UPDATE_PAINT_PROPERTY(DividerRenderProperty, LineCap, value); + } + +-void DividerModelNG::StrokeWidth(FrameNode* frameNode, std::optional valueOpt) ++void DividerModelNG::StrokeWidth(FrameNode* frameNode, const Dimension& value) + { +- if (valueOpt) { +- ACE_UPDATE_NODE_LAYOUT_PROPERTY(DividerLayoutProperty, StrokeWidth, valueOpt.value(), frameNode); +- } else { +- ACE_RESET_NODE_LAYOUT_PROPERTY(DividerLayoutProperty, StrokeWidth, frameNode); +- } ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(DividerLayoutProperty, StrokeWidth, value, frameNode); + } + +-void DividerModelNG::LineCap(FrameNode* frameNode, const std::optional valueOpt) ++void DividerModelNG::LineCap(FrameNode* frameNode, const Ace::LineCap& value) + { +- if (valueOpt) { +- ACE_UPDATE_NODE_PAINT_PROPERTY(DividerRenderProperty, LineCap, valueOpt.value(), frameNode); +- } else { +- ACE_RESET_NODE_PAINT_PROPERTY(DividerRenderProperty, LineCap, frameNode); +- } ++ ACE_UPDATE_NODE_PAINT_PROPERTY(DividerRenderProperty, LineCap, value, frameNode); + } + +-void DividerModelNG::SetDividerColor(FrameNode* frameNode, std::optional colorOpt, bool isSetByTheme) ++void DividerModelNG::SetDividerColor(FrameNode* frameNode, const Color& color, bool isSetByTheme) + { +- if (colorOpt) { +- ACE_UPDATE_NODE_PAINT_PROPERTY(DividerRenderProperty, DividerColor, colorOpt.value(), frameNode); +- } else { +- ACE_RESET_NODE_PAINT_PROPERTY(DividerRenderProperty, DividerColor, frameNode); +- } ++ ACE_UPDATE_NODE_PAINT_PROPERTY(DividerRenderProperty, DividerColor, color, frameNode); + if (SystemProperties::ConfigChangePerform()) { + ACE_UPDATE_NODE_PAINT_PROPERTY(DividerRenderProperty, DividerColorSetByTheme, isSetByTheme, frameNode); + } +diff --git a/frameworks/core/components_ng/pattern/divider/divider_model_ng.h b/frameworks/core/components_ng/pattern/divider/divider_model_ng.h +index 00372bab4bd..45aedebd5d7 100644 +--- a/frameworks/core/components_ng/pattern/divider/divider_model_ng.h ++++ b/frameworks/core/components_ng/pattern/divider/divider_model_ng.h +@@ -32,9 +32,9 @@ public: + void ResetDividerColor() override; + void ResetResObj(const std::string& key) override; + static RefPtr CreateFrameNode(int32_t nodeId); +- static void StrokeWidth(FrameNode* frameNode, std::optional valueOpt); +- static void LineCap(FrameNode* frameNode, std::optional valueOpt); +- static void SetDividerColor(FrameNode* frameNode, std::optional colorOpt, bool isSetByUser); ++ static void StrokeWidth(FrameNode* frameNode, const Dimension& value); ++ static void LineCap(FrameNode* frameNode, const enum LineCap& value); ++ static void SetDividerColor(FrameNode* frameNode, const Color& color, bool isSetByUser); + static void SetDividerColor(FrameNode* frameNode, const RefPtr& resObj, bool isSetByUser); + static void SetVertical(FrameNode* frameNode, const bool& value); + static void ResetResObj(FrameNode* frameNode, const std::string& key); +diff --git a/frameworks/core/components_ng/pattern/divider/divider_model_ng_static.cpp b/frameworks/core/components_ng/pattern/divider/divider_model_ng_static.cpp +new file mode 100644 +index 00000000000..68596ee2261 +--- /dev/null ++++ b/frameworks/core/components_ng/pattern/divider/divider_model_ng_static.cpp +@@ -0,0 +1,47 @@ ++/* ++ * Copyright (c) 2025 Huawei Device Co., Ltd. ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include "core/components_ng/pattern/divider/divider_model_ng_static.h" ++#include "core/components_ng/pattern/divider/divider_pattern.h" ++ ++namespace OHOS::Ace::NG { ++ ++void DividerModelNGStatic::StrokeWidth(FrameNode* frameNode, std::optional valueOpt) ++{ ++ if (valueOpt) { ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(DividerLayoutProperty, StrokeWidth, valueOpt.value(), frameNode); ++ } else { ++ ACE_RESET_NODE_LAYOUT_PROPERTY(DividerLayoutProperty, StrokeWidth, frameNode); ++ } ++} ++ ++void DividerModelNGStatic::LineCap(FrameNode* frameNode, const std::optional valueOpt) ++{ ++ if (valueOpt) { ++ ACE_UPDATE_NODE_PAINT_PROPERTY(DividerRenderProperty, LineCap, valueOpt.value(), frameNode); ++ } else { ++ ACE_RESET_NODE_PAINT_PROPERTY(DividerRenderProperty, LineCap, frameNode); ++ } ++} ++ ++void DividerModelNGStatic::SetDividerColor(FrameNode* frameNode, std::optional colorOpt) ++{ ++ if (colorOpt) { ++ ACE_UPDATE_NODE_PAINT_PROPERTY(DividerRenderProperty, DividerColor, colorOpt.value(), frameNode); ++ } else { ++ ACE_RESET_NODE_PAINT_PROPERTY(DividerRenderProperty, DividerColor, frameNode); ++ } ++} ++} +\ No newline at end of file +diff --git a/frameworks/core/components_ng/pattern/divider/divider_model_ng_static.h b/frameworks/core/components_ng/pattern/divider/divider_model_ng_static.h +new file mode 100644 +index 00000000000..1196148fbc3 +--- /dev/null ++++ b/frameworks/core/components_ng/pattern/divider/divider_model_ng_static.h +@@ -0,0 +1,32 @@ ++/* ++ * Copyright (c) 2025 Huawei Device Co., Ltd. ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_DIVIDER_DIVIDER_MODEL_NG_STATIC_H ++#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_DIVIDER_DIVIDER_MODEL_NG_STATIC_H ++ ++#include "core/components_ng/base/frame_node.h" ++#include "core/components_ng/pattern/divider/divider_model.h" ++ ++namespace OHOS::Ace::NG { ++ ++class ACE_EXPORT DividerModelNGStatic : public DividerModel { ++public: ++ static void StrokeWidth(FrameNode* frameNode, std::optional valueOpt); ++ static void LineCap(FrameNode* frameNode, std::optional valueOpt); ++ static void SetDividerColor(FrameNode* frameNode, std::optional colorOpt); ++}; ++} // namespace OHOS::Ace::NG ++ ++#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_DIVIDER_DIVIDER_MODEL_NG_STATIC_H +\ No newline at end of file +diff --git a/frameworks/core/components_ng/pattern/flex/flex_layout_property.h b/frameworks/core/components_ng/pattern/flex/flex_layout_property.h +index ae1282cd60a..6586b4df239 100644 +--- a/frameworks/core/components_ng/pattern/flex/flex_layout_property.h ++++ b/frameworks/core/components_ng/pattern/flex/flex_layout_property.h +@@ -78,9 +78,6 @@ public: + ACE_DEFINE_PROPERTY_ITEM_WITH_GROUP(FlexLayoutAttribute, CrossAxisAlign, FlexAlign, PROPERTY_UPDATE_MEASURE); + ACE_DEFINE_PROPERTY_ITEM_WITH_GROUP(FlexLayoutAttribute, Space, Dimension, PROPERTY_UPDATE_MEASURE); + ACE_DEFINE_PROPERTY_ITEM_WITH_GROUP(FlexLayoutAttribute, IsReverse, bool, PROPERTY_UPDATE_MEASURE); +- ACE_DEFINE_PROPERTY_ITEM_WITH_GROUP(FlexLayoutAttribute, WidthLayoutPolicy, uint8_t, PROPERTY_UPDATE_MEASURE); +- ACE_DEFINE_PROPERTY_ITEM_WITH_GROUP( +- FlexLayoutAttribute, HeightLayoutPolicy, uint8_t, PROPERTY_UPDATE_MEASURE); + + ACE_DEFINE_PROPERTY_GROUP(WrapLayoutAttribute, WrapLayoutAttribute); + ACE_DEFINE_PROPERTY_ITEM_WITH_GROUP(WrapLayoutAttribute, WrapDirection, WrapDirection, PROPERTY_UPDATE_MEASURE); +diff --git a/frameworks/core/components_ng/pattern/flex/flex_layout_styles.h b/frameworks/core/components_ng/pattern/flex/flex_layout_styles.h +index caf992b6cb5..aac3549cd9f 100644 +--- a/frameworks/core/components_ng/pattern/flex/flex_layout_styles.h ++++ b/frameworks/core/components_ng/pattern/flex/flex_layout_styles.h +@@ -26,8 +26,6 @@ struct FlexLayoutAttribute { + ACE_DEFINE_PROPERTY_GROUP_ITEM(CrossAxisAlign, FlexAlign); + ACE_DEFINE_PROPERTY_GROUP_ITEM(Space, Dimension); + ACE_DEFINE_PROPERTY_GROUP_ITEM(IsReverse, bool); +- ACE_DEFINE_PROPERTY_GROUP_ITEM(WidthLayoutPolicy, uint8_t); +- ACE_DEFINE_PROPERTY_GROUP_ITEM(HeightLayoutPolicy, uint8_t); + }; + + struct WrapLayoutAttribute { +diff --git a/frameworks/core/components_ng/pattern/flex/flex_model.h b/frameworks/core/components_ng/pattern/flex/flex_model.h +index c58eed5c743..207067d1956 100644 +--- a/frameworks/core/components_ng/pattern/flex/flex_model.h ++++ b/frameworks/core/components_ng/pattern/flex/flex_model.h +@@ -73,8 +73,6 @@ public: + virtual void SetAlignContent(int32_t value) = 0; + virtual void SetMainSpace(const std::optional& space) = 0; + virtual void SetCrossSpace(const std::optional& space) = 0; +- virtual void SetWidthLayoutPolicy(uint8_t widthLayoutPolicy) = 0; +- virtual void SetHeightLayoutPolicy(uint8_t heightLayoutPolicy) = 0; + }; + } // namespace OHOS::Ace + #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_FLEX_FLEX_MODEL_H +diff --git a/frameworks/core/components_ng/pattern/flex/flex_model_ng.cpp b/frameworks/core/components_ng/pattern/flex/flex_model_ng.cpp +index 498f3ede52d..2fb0eca101a 100644 +--- a/frameworks/core/components_ng/pattern/flex/flex_model_ng.cpp ++++ b/frameworks/core/components_ng/pattern/flex/flex_model_ng.cpp +@@ -102,46 +102,16 @@ void FlexModelNG::SetMainAxisAlign(FlexAlign align) + ACE_UPDATE_LAYOUT_PROPERTY(FlexLayoutProperty, MainAxisAlign, align); + } + +-void FlexModelNG::SetMainAxisAlign(FrameNode* frameNode, std::optional& align) +-{ +- CHECK_NULL_VOID(frameNode); +- if (align.has_value()) { +- ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, MainAxisAlign, align.value(), frameNode); +- } else { +- ACE_RESET_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, MainAxisAlign, frameNode); +- } +-} +- + void FlexModelNG::SetWrapMainAlignment(WrapAlignment value) + { + ACE_UPDATE_LAYOUT_PROPERTY(FlexLayoutProperty, MainAlignment, value); + } + +-void FlexModelNG::SetWrapMainAlignment(FrameNode* frameNode, std::optional& align) +-{ +- CHECK_NULL_VOID(frameNode); +- if (align.has_value()) { +- ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, MainAlignment, align.value(), frameNode); +- } else { +- ACE_RESET_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, MainAlignment, frameNode); +- } +-} +- + void FlexModelNG::SetCrossAxisAlign(FlexAlign align) + { + ACE_UPDATE_LAYOUT_PROPERTY(FlexLayoutProperty, CrossAxisAlign, align); + } + +-void FlexModelNG::SetWrapCrossAlignment(FrameNode* frameNode, std::optional& align) +-{ +- CHECK_NULL_VOID(frameNode); +- if (align.has_value()) { +- ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, CrossAlignment, align.value(), frameNode); +- } else { +- ACE_RESET_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, CrossAlignment, frameNode); +- } +-} +- + void FlexModelNG::SetWrapCrossAlignment(WrapAlignment value) + { + ACE_UPDATE_LAYOUT_PROPERTY(FlexLayoutProperty, CrossAlignment, value); +@@ -189,7 +159,6 @@ void FlexModelNG::SetAlignContent(int32_t value) + + void FlexModelNG::SetFlexRow(FrameNode* frameNode) + { +- CHECK_NULL_VOID(frameNode); + ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, FlexDirection, FlexDirection::ROW, frameNode); + ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, MainAxisAlign, FlexAlign::FLEX_START, frameNode); + ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, CrossAxisAlign, FlexAlign::FLEX_START, frameNode); +@@ -200,7 +169,6 @@ void FlexModelNG::SetFlexRow(FrameNode* frameNode) + + void FlexModelNG::SetFlexWrap(FrameNode* frameNode) + { +- CHECK_NULL_VOID(frameNode); + ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, WrapDirection, WrapDirection::HORIZONTAL, frameNode); + ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, Alignment, WrapAlignment::START, frameNode); + ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, MainAlignment, WrapAlignment::START, frameNode); +@@ -212,29 +180,16 @@ void FlexModelNG::SetFlexWrap(FrameNode* frameNode) + + void FlexModelNG::SetFlexDirection(FrameNode* frameNode, FlexDirection value) + { +- CHECK_NULL_VOID(frameNode); + ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, FlexDirection, value, frameNode); + } + +-void FlexModelNG::SetFlexDirection(FrameNode* frameNode, std::optional& layoutDirection) +-{ +- CHECK_NULL_VOID(frameNode); +- if (layoutDirection) { +- ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, FlexDirection, layoutDirection.value(), frameNode); +- } else { +- ACE_RESET_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, FlexDirection, frameNode); +- } +-} +- + void FlexModelNG::SetFlexWrapDirection(FrameNode* frameNode, WrapDirection value) + { +- CHECK_NULL_VOID(frameNode); + ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, WrapDirection, value, frameNode); + } + + void FlexModelNG::SetFlexJustifyContent(FrameNode* frameNode, int32_t value) + { +- CHECK_NULL_VOID(frameNode); + auto pattern = frameNode->GetPattern(); + if (!pattern->GetIsWrap()) { + ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, MainAxisAlign, static_cast(value), frameNode); +@@ -243,19 +198,8 @@ void FlexModelNG::SetFlexJustifyContent(FrameNode* frameNode, int32_t value) + ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, MainAlignment, static_cast(value), frameNode); + } + +-void FlexModelNG::SetCrossAxisAlign(FrameNode* frameNode, std::optional& align) +-{ +- CHECK_NULL_VOID(frameNode); +- if (align.has_value()) { +- ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, CrossAxisAlign, align.value(), frameNode); +- } else { +- ACE_RESET_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, CrossAxisAlign, frameNode); +- } +-} +- + void FlexModelNG::SetFlexAlignItems(FrameNode* frameNode, int32_t value) + { +- CHECK_NULL_VOID(frameNode); + auto pattern = frameNode->GetPattern(); + if (!pattern->GetIsWrap()) { + ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, CrossAxisAlign, static_cast(value), frameNode); +@@ -266,7 +210,6 @@ void FlexModelNG::SetFlexAlignItems(FrameNode* frameNode, int32_t value) + + void FlexModelNG::SetFlexAlignContent(FrameNode* frameNode, int32_t value) + { +- CHECK_NULL_VOID(frameNode); + auto pattern = frameNode->GetPattern(); + if (!pattern->GetIsWrap()) { + return; +@@ -274,36 +217,6 @@ void FlexModelNG::SetFlexAlignContent(FrameNode* frameNode, int32_t value) + ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, Alignment, static_cast(value), frameNode); + } + +-void FlexModelNG::SetFlexAlignContent(FrameNode* frameNode, std::optional& align) +-{ +- CHECK_NULL_VOID(frameNode); +- if (align.has_value()) { +- ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, Alignment, align.value(), frameNode); +- } else { +- ACE_RESET_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, Alignment, frameNode); +- } +-} +- +-void FlexModelNG::SetWidthLayoutPolicy(uint8_t widthLayoutPolicy) +-{ +- ACE_UPDATE_LAYOUT_PROPERTY(FlexLayoutProperty, WidthLayoutPolicy, widthLayoutPolicy); +-} +- +-void FlexModelNG::SetWidthLayoutPolicy(FrameNode* frameNode, uint8_t widthLayoutPolicy) +-{ +- ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, WidthLayoutPolicy, widthLayoutPolicy, frameNode); +-} +- +-void FlexModelNG::SetHeightLayoutPolicy(uint8_t heightLayoutPolicy) +-{ +- ACE_UPDATE_LAYOUT_PROPERTY(FlexLayoutProperty, HeightLayoutPolicy, heightLayoutPolicy); +-} +- +-void FlexModelNG::SetHeightLayoutPolicy(FrameNode* frameNode, uint8_t heightLayoutPolicy) +-{ +- ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, HeightLayoutPolicy, heightLayoutPolicy, frameNode); +-} +- + int FlexModelNG::GetFlexWrap(FrameNode* frameNode) + { + int value = 0; +@@ -386,7 +299,6 @@ void FlexModelNG::SetCrossSpace(const std::optional& space) + + void FlexModelNG::SetMainSpace(FrameNode* frameNode, const std::optional& space) + { +- CHECK_NULL_VOID(frameNode); + CHECK_NULL_VOID(space); + if (GreatOrEqual(space->Value(), 0.0)) { + ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, Space, space.value(), frameNode); +@@ -395,7 +307,6 @@ void FlexModelNG::SetMainSpace(FrameNode* frameNode, const std::optional& space) + { +- CHECK_NULL_VOID(frameNode); + CHECK_NULL_VOID(space); + if (GreatOrEqual(space->Value(), 0.0)) { + ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, CrossSpace, space.value(), frameNode); +diff --git a/frameworks/core/components_ng/pattern/flex/flex_model_ng.h b/frameworks/core/components_ng/pattern/flex/flex_model_ng.h +index 247e60a2d45..13277f4079e 100644 +--- a/frameworks/core/components_ng/pattern/flex/flex_model_ng.h ++++ b/frameworks/core/components_ng/pattern/flex/flex_model_ng.h +@@ -49,25 +49,15 @@ public: + void SetJustifyContent(int32_t value) override; + + void SetAlignContent(int32_t value) override; +- void SetWidthLayoutPolicy(uint8_t widthLayoutPolicy) override; +- void SetHeightLayoutPolicy(uint8_t heightLayoutPolicy) override; + + static RefPtr CreateFrameNode(int32_t nodeId); + static void SetFlexRow(FrameNode* frameNode); + static void SetFlexWrap(FrameNode* frameNode); + static void SetFlexDirection(FrameNode* frameNode, FlexDirection value); +- static void SetFlexDirection(FrameNode* frameNode, std::optional& value); + static void SetFlexWrapDirection(FrameNode* frameNode, WrapDirection value); +- static void SetCrossAxisAlign(FrameNode* frameNode, std::optional& align); +- static void SetMainAxisAlign(FrameNode* frameNode, std::optional&); + static void SetFlexJustifyContent(FrameNode* frameNode, int32_t value); +- static void SetWrapMainAlignment(FrameNode* frameNode, std::optional&); +- static void SetWrapCrossAlignment(FrameNode* frameNode, std::optional&); + static void SetFlexAlignItems(FrameNode* frameNode, int32_t value); + static void SetFlexAlignContent(FrameNode* frameNode, int32_t value); +- static void SetFlexAlignContent(FrameNode* frameNode, std::optional& alignContent); +- static void SetWidthLayoutPolicy(FrameNode* frameNode, uint8_t widthLayoutPolicy); +- static void SetHeightLayoutPolicy(FrameNode* frameNode, uint8_t heightLayoutPolicy); + + static int GetFlexWrap(FrameNode* frameNode); + static int GetFlexDirection(FrameNode* frameNode); +diff --git a/frameworks/core/components_ng/pattern/flex/flex_model_ng_static.cpp b/frameworks/core/components_ng/pattern/flex/flex_model_ng_static.cpp +new file mode 100644 +index 00000000000..d662b6baa6f +--- /dev/null ++++ b/frameworks/core/components_ng/pattern/flex/flex_model_ng_static.cpp +@@ -0,0 +1,81 @@ ++/* ++ * Copyright (c) 2025 Huawei Device Co., Ltd. ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include "core/components_ng/pattern/flex/flex_model_ng_static.h" ++#include "core/components_ng/pattern/flex/flex_layout_pattern.h" ++ ++namespace OHOS::Ace::NG { ++ ++void FlexModelNGStatic::SetMainAxisAlign(FrameNode* frameNode, std::optional& align) ++{ ++ CHECK_NULL_VOID(frameNode); ++ if (align.has_value()) { ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, MainAxisAlign, align.value(), frameNode); ++ } else { ++ ACE_RESET_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, MainAxisAlign, frameNode); ++ } ++} ++ ++void FlexModelNGStatic::SetWrapMainAlignment(FrameNode* frameNode, std::optional& align) ++{ ++ CHECK_NULL_VOID(frameNode); ++ if (align.has_value()) { ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, MainAlignment, align.value(), frameNode); ++ } else { ++ ACE_RESET_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, MainAlignment, frameNode); ++ } ++} ++ ++void FlexModelNGStatic::SetWrapCrossAlignment(FrameNode* frameNode, std::optional& align) ++{ ++ CHECK_NULL_VOID(frameNode); ++ if (align.has_value()) { ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, CrossAlignment, align.value(), frameNode); ++ } else { ++ ACE_RESET_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, CrossAlignment, frameNode); ++ } ++} ++ ++void FlexModelNGStatic::SetFlexDirection(FrameNode* frameNode, std::optional& layoutDirection) ++{ ++ CHECK_NULL_VOID(frameNode); ++ if (layoutDirection) { ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, FlexDirection, layoutDirection.value(), frameNode); ++ } else { ++ ACE_RESET_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, FlexDirection, frameNode); ++ } ++} ++ ++void FlexModelNGStatic::SetCrossAxisAlign(FrameNode* frameNode, std::optional& align) ++{ ++ CHECK_NULL_VOID(frameNode); ++ if (align.has_value()) { ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, CrossAxisAlign, align.value(), frameNode); ++ } else { ++ ACE_RESET_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, CrossAxisAlign, frameNode); ++ } ++} ++ ++void FlexModelNGStatic::SetFlexAlignContent(FrameNode* frameNode, std::optional& align) ++{ ++ CHECK_NULL_VOID(frameNode); ++ if (align.has_value()) { ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, Alignment, align.value(), frameNode); ++ } else { ++ ACE_RESET_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, Alignment, frameNode); ++ } ++} ++ ++} // namespace OHOS::Ace::NG +\ No newline at end of file +diff --git a/frameworks/core/components_ng/pattern/flex/flex_model_ng_static.h b/frameworks/core/components_ng/pattern/flex/flex_model_ng_static.h +new file mode 100644 +index 00000000000..adcb4554f89 +--- /dev/null ++++ b/frameworks/core/components_ng/pattern/flex/flex_model_ng_static.h +@@ -0,0 +1,35 @@ ++/* ++ * Copyright (c) 2025 Huawei Device Co., Ltd. ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_FLEX_FLEX_MODEL_NG_STATIC_H ++#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_FLEX_FLEX_MODEL_NG_STATIC_H ++ ++#include "core/components_ng/pattern/flex/flex_model.h" ++#include "core/components_ng/base/frame_node.h" ++ ++namespace OHOS::Ace::NG { ++ ++class ACE_EXPORT FlexModelNGStatic : public FlexModel { ++public: ++ static void SetCrossAxisAlign(FrameNode* frameNode, std::optional& align); ++ static void SetMainAxisAlign(FrameNode* frameNode, std::optional&); ++ static void SetWrapMainAlignment(FrameNode* frameNode, std::optional&); ++ static void SetWrapCrossAlignment(FrameNode* frameNode, std::optional&); ++ static void SetFlexAlignContent(FrameNode* frameNode, std::optional& alignContent); ++ static void SetFlexDirection(FrameNode* frameNode, std::optional& layoutDirection); ++}; ++} ++ ++#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_FLEX_FLEX_MODEL_NG_STATIC_H +diff --git a/frameworks/core/components_ng/pattern/folder_stack/folder_stack_model_ng.cpp b/frameworks/core/components_ng/pattern/folder_stack/folder_stack_model_ng.cpp +index ef6e73dbafd..2f21a92d708 100644 +--- a/frameworks/core/components_ng/pattern/folder_stack/folder_stack_model_ng.cpp ++++ b/frameworks/core/components_ng/pattern/folder_stack/folder_stack_model_ng.cpp +@@ -18,7 +18,6 @@ + #include "core/components_ng/pattern/folder_stack/control_parts_stack_node.h" + #include "core/components_ng/pattern/folder_stack/folder_stack_pattern.h" + #include "core/components_ng/pattern/folder_stack/hover_stack_node.h" +-#include "folder_stack_model_ng.h" + + namespace OHOS::Ace::NG { + void FolderStackModelNG::Create() +@@ -51,41 +50,6 @@ void FolderStackModelNG::Create(const std::vector& itemId) + ACE_UPDATE_LAYOUT_PROPERTY(FolderStackLayoutProperty, UpperItems, itemId); + } + +-RefPtr FolderStackModelNG::CreateFrameNode(int32_t nodeId) +-{ +- auto folderStackGroupNode = FolderStackGroupNode::GetOrCreateGroupNode( +- V2::FOLDER_STACK_ETS_TAG, nodeId, []() { return AceType::MakeRefPtr(); }); +- if (!folderStackGroupNode->GetHoverNode()) { +- int32_t hoverId = ElementRegister::GetInstance()->MakeUniqueId(); +- auto hoverStackNode = HoverStackNode::GetOrCreateHoverStackNode( +- V2::HOVER_STACK_ETS_TAG, hoverId, []() { return AceType::MakeRefPtr(); }); +- folderStackGroupNode->AddChild(hoverStackNode); +- folderStackGroupNode->SetHoverNode(hoverStackNode); +- } +- if (!folderStackGroupNode->GetControlPartsStackNode()) { +- int32_t controlPartsId = ElementRegister::GetInstance()->MakeUniqueId(); +- auto controlPartsNode = ControlPartsStackNode::GetOrCreateControlPartsStackNode(V2::CONTROL_PARTS_STACK_ETS_TAG, +- controlPartsId, []() { return AceType::MakeRefPtr(); }); +- folderStackGroupNode->AddChild(controlPartsNode); +- folderStackGroupNode->SetControlPartsStackNode(controlPartsNode); +- } +- std::vector itemId; +- SetUpdateUpperItems(folderStackGroupNode.GetRawPtr(), itemId); +- return folderStackGroupNode; +-} +- +-void FolderStackModelNG::SetUpdateUpperItems(FrameNode* frameNode, const std::vector& itemId) +-{ +- auto folderStackGroupNode = AceType::DynamicCast(frameNode); +- folderStackGroupNode->SetItemId(itemId); +- ACE_UPDATE_NODE_LAYOUT_PROPERTY(FolderStackLayoutProperty, UpperItems, itemId, frameNode); +-} +- +-void FolderStackModelNG::SetAlignment(FrameNode* frameNode, const std::optional& valueOpt) +-{ +- ACE_UPDATE_NODE_LAYOUT_PROPERTY(LayoutProperty, Alignment, valueOpt.value_or(Alignment::CENTER), frameNode); +-} +- + void FolderStackModelNG::SetAlignment(Alignment alignment) + { + ACE_UPDATE_LAYOUT_PROPERTY(LayoutProperty, Alignment, alignment); +@@ -112,8 +76,9 @@ void FolderStackModelNG::SetAutoHalfFold(bool IsAutoHalfFold) + } + + void FolderStackModelNG::SetOnFolderStateChange( +- FrameNode* frameNode, std::function&& onChange) ++ std::function&& onChange) + { ++ auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); + CHECK_NULL_VOID(frameNode); + auto eventHub = frameNode->GetEventHub(); + CHECK_NULL_VOID(eventHub); +@@ -121,18 +86,18 @@ void FolderStackModelNG::SetOnFolderStateChange( + } + + void FolderStackModelNG::SetOnFolderStateChange( +- std::function&& onChange) ++ FrameNode* frameNode, std::function&& onChange) + { +- auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); + CHECK_NULL_VOID(frameNode); +- auto eventHub = frameNode->GetOrCreateEventHub(); ++ auto eventHub = frameNode->GetEventHub(); + CHECK_NULL_VOID(eventHub); + eventHub->SetOnFolderStateChange(std::move(onChange)); + } + + void FolderStackModelNG::SetOnHoverStatusChange( +- FrameNode* frameNode, std::function&& onChange) ++ std::function&& onChange) + { ++ auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); + CHECK_NULL_VOID(frameNode); + auto eventHub = frameNode->GetEventHub(); + CHECK_NULL_VOID(eventHub); +@@ -140,12 +105,12 @@ void FolderStackModelNG::SetOnHoverStatusChange( + } + + void FolderStackModelNG::SetOnHoverStatusChange( +- std::function&& onChange) ++ FrameNode* frameNode, std::function&& onChange) + { +- auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); + CHECK_NULL_VOID(frameNode); +- auto eventHub = frameNode->GetOrCreateEventHub(); ++ auto eventHub = frameNode->GetEventHub(); + CHECK_NULL_VOID(eventHub); + eventHub->SetOnHoverStatusChange(std::move(onChange)); + } ++ + } // namespace OHOS::Ace::NG +diff --git a/frameworks/core/components_ng/pattern/folder_stack/folder_stack_model_ng.h b/frameworks/core/components_ng/pattern/folder_stack/folder_stack_model_ng.h +index e37b05b992c..d0eb5e46052 100644 +--- a/frameworks/core/components_ng/pattern/folder_stack/folder_stack_model_ng.h ++++ b/frameworks/core/components_ng/pattern/folder_stack/folder_stack_model_ng.h +@@ -24,9 +24,6 @@ namespace OHOS::Ace::NG { + class ACE_EXPORT FolderStackModelNG : public FolderStackModel { + public: + void Create(const std::vector& itemId) override; +- static RefPtr CreateFrameNode(int32_t nodeId); +- static void SetUpdateUpperItems(FrameNode* frameNode, const std::vector& itemId); +- static void SetAlignment(FrameNode* frameNode, const std::optional& valueOpt); + void SetAlignment(Alignment alignment) override; + static void SetOnFolderStateChange( + FrameNode* frameNode, std::function&& onChange); +diff --git a/frameworks/core/components_ng/pattern/folder_stack/folder_stack_model_ng_static.cpp b/frameworks/core/components_ng/pattern/folder_stack/folder_stack_model_ng_static.cpp +new file mode 100644 +index 00000000000..86f1cae6b63 +--- /dev/null ++++ b/frameworks/core/components_ng/pattern/folder_stack/folder_stack_model_ng_static.cpp +@@ -0,0 +1,62 @@ ++/* ++ * Copyright (c) 2025 Huawei Device Co., Ltd. ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include "core/components_ng/pattern/folder_stack/folder_stack_model_ng_static.h" ++ ++#include "core/components_ng/base/view_stack_processor.h" ++#include "core/components_ng/pattern/folder_stack/control_parts_stack_node.h" ++#include "core/components_ng/pattern/folder_stack/folder_stack_pattern.h" ++#include "core/components_ng/pattern/folder_stack/hover_stack_node.h" ++#include "folder_stack_model_ng.h" ++ ++ ++namespace OHOS::Ace::NG { ++ ++RefPtr FolderStackModelNGStatic::CreateFrameNode(int32_t nodeId) ++{ ++ auto folderStackGroupNode = FolderStackGroupNode::GetOrCreateGroupNode( ++ V2::FOLDER_STACK_ETS_TAG, nodeId, []() { return AceType::MakeRefPtr(); }); ++ if (!folderStackGroupNode->GetHoverNode()) { ++ int32_t hoverId = ElementRegister::GetInstance()->MakeUniqueId(); ++ auto hoverStackNode = HoverStackNode::GetOrCreateHoverStackNode( ++ V2::HOVER_STACK_ETS_TAG, hoverId, []() { return AceType::MakeRefPtr(); }); ++ folderStackGroupNode->AddChild(hoverStackNode); ++ folderStackGroupNode->SetHoverNode(hoverStackNode); ++ } ++ if (!folderStackGroupNode->GetControlPartsStackNode()) { ++ int32_t controlPartsId = ElementRegister::GetInstance()->MakeUniqueId(); ++ auto controlPartsNode = ControlPartsStackNode::GetOrCreateControlPartsStackNode(V2::CONTROL_PARTS_STACK_ETS_TAG, ++ controlPartsId, []() { return AceType::MakeRefPtr(); }); ++ folderStackGroupNode->AddChild(controlPartsNode); ++ folderStackGroupNode->SetControlPartsStackNode(controlPartsNode); ++ } ++ std::vector itemId; ++ SetUpdateUpperItems(folderStackGroupNode.GetRawPtr(), itemId); ++ return folderStackGroupNode; ++} ++ ++void FolderStackModelNGStatic::SetUpdateUpperItems(FrameNode* frameNode, const std::vector& itemId) ++{ ++ auto folderStackGroupNode = AceType::DynamicCast(frameNode); ++ folderStackGroupNode->SetItemId(itemId); ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(FolderStackLayoutProperty, UpperItems, itemId, frameNode); ++} ++ ++void FolderStackModelNGStatic::SetAlignment(FrameNode* frameNode, const std::optional& valueOpt) ++{ ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(LayoutProperty, Alignment, valueOpt.value_or(Alignment::CENTER), frameNode); ++} ++ ++} +diff --git a/frameworks/core/components_ng/pattern/folder_stack/folder_stack_model_ng_static.h b/frameworks/core/components_ng/pattern/folder_stack/folder_stack_model_ng_static.h +new file mode 100644 +index 00000000000..44aba02c6e6 +--- /dev/null ++++ b/frameworks/core/components_ng/pattern/folder_stack/folder_stack_model_ng_static.h +@@ -0,0 +1,32 @@ ++/* ++ * Copyright (c) 2025 Huawei Device Co., Ltd. ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_FOLDER_STACK_MODEL_NG_STATIC_H ++#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_FOLDER_STACK_MODEL_NG_STATIC_H ++ ++#include "base/utils/macros.h" ++#include "core/components_ng/base/frame_node.h" ++#include "core/components_ng/pattern/folder_stack/folder_stack_model.h" ++ ++namespace OHOS::Ace::NG { ++class ACE_EXPORT FolderStackModelNGStatic : public FolderStackModel { ++public: ++ static RefPtr CreateFrameNode(int32_t nodeId); ++ static void SetUpdateUpperItems(FrameNode* frameNode, const std::vector& itemId); ++ static void SetAlignment(FrameNode* frameNode, const std::optional& valueOpt); ++}; ++} ++ ++#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_FOLDER_STACK_MODEL_NG_STATIC_H +diff --git a/frameworks/core/components_ng/pattern/grid_col/grid_col_model_ng_static.cpp b/frameworks/core/components_ng/pattern/grid_col/grid_col_model_ng_static.cpp +new file mode 100644 +index 00000000000..1ea0608819c +--- /dev/null ++++ b/frameworks/core/components_ng/pattern/grid_col/grid_col_model_ng_static.cpp +@@ -0,0 +1,43 @@ ++/* ++ * Copyright (c) 2025 Huawei Device Co., Ltd. ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include "core/components_ng/pattern/grid_col/grid_col_model_ng_static.h" ++ ++#include "core/components_ng/base/view_stack_processor.h" ++#include "core/components_ng/pattern/grid_col/grid_col_layout_pattern.h" ++ ++namespace OHOS::Ace::NG { ++ ++void GridColModelNGStatic::SetSpan(FrameNode *frameNode, const std::optional& span) ++{ ++ int32_t defaultValue {1}; ++ V2::GridContainerSize gcSizeValue = (span.has_value()) ? span.value() : V2::GridContainerSize(defaultValue); ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(GridColLayoutProperty, Span, gcSizeValue, frameNode); ++} ++ ++void GridColModelNGStatic::SetOffset(FrameNode *frameNode, const std::optional& offset) ++{ ++ int32_t defaultValue {0}; ++ V2::GridContainerSize gcSizeValue = (offset.has_value()) ? offset.value() : V2::GridContainerSize(defaultValue); ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(GridColLayoutProperty, Offset, gcSizeValue, frameNode); ++} ++ ++void GridColModelNGStatic::SetOrder(FrameNode *frameNode, const std::optional& order) ++{ ++ int32_t defaultValue {0}; ++ V2::GridContainerSize gcSizeValue = (order.has_value()) ? order.value() : V2::GridContainerSize(defaultValue); ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(GridColLayoutProperty, Order, gcSizeValue, frameNode); ++} ++} +\ No newline at end of file +diff --git a/frameworks/core/components_ng/pattern/grid_col/grid_col_model_ng_static.h b/frameworks/core/components_ng/pattern/grid_col/grid_col_model_ng_static.h +new file mode 100644 +index 00000000000..4db7b306a53 +--- /dev/null ++++ b/frameworks/core/components_ng/pattern/grid_col/grid_col_model_ng_static.h +@@ -0,0 +1,32 @@ ++/* ++ * Copyright (c) 2025 Huawei Device Co., Ltd. ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_GRID_COL_MODEL_NG_STATIC_H ++#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_GRID_COL_MODEL_NG_STATIC_H ++ ++#include "core/components_ng/pattern/grid_col/grid_col_model.h" ++#include "core/components_ng/base/frame_node.h" ++ ++namespace OHOS::Ace::NG { ++ ++class ACE_EXPORT GridColModelNGStatic : public GridColModel { ++public: ++ static void SetSpan(FrameNode* frameNode, const std::optional& span); ++ static void SetOffset(FrameNode* frameNode, const std::optional& offset); ++ static void SetOrder(FrameNode* frameNode, const std::optional& order); ++}; ++} // namespace OHOS::Ace::NG ++ ++#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_GRID_COL_MODEL_NG_STATIC_H +\ No newline at end of file +diff --git a/frameworks/core/components_ng/pattern/grid_row/grid_row_model_ng_static.cpp b/frameworks/core/components_ng/pattern/grid_row/grid_row_model_ng_static.cpp +new file mode 100644 +index 00000000000..67d671db9cf +--- /dev/null ++++ b/frameworks/core/components_ng/pattern/grid_row/grid_row_model_ng_static.cpp +@@ -0,0 +1,41 @@ ++/* ++ * Copyright (c) 2025 Huawei Device Co., Ltd. ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include "grid_row_model_ng_static.h" ++ ++#include "grid_row_layout_pattern.h" ++ ++namespace OHOS::Ace::NG { ++ ++void GridRowModelNGStatic::SetAlignItems(FrameNode* frameNode, const std::optional& alignItem) ++{ ++ CHECK_NULL_VOID(frameNode); ++ if (alignItem.has_value()) { ++ auto layoutProperty = frameNode->GetLayoutProperty(); ++ CHECK_NULL_VOID(layoutProperty); ++ layoutProperty->UpdateAlignItems(alignItem.value()); ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(GridRowLayoutProperty, AlignItems, alignItem.value(), frameNode); ++ } else { ++ ACE_RESET_NODE_LAYOUT_PROPERTY(GridRowLayoutProperty, AlignItems, frameNode); ++ } ++} ++ ++void GridRowModelNGStatic::SetDirection(FrameNode* frameNode, const std::optional& direction) ++{ ++ CHECK_NULL_VOID(frameNode); ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(GridRowLayoutProperty, Direction, ++ direction.has_value()? direction.value(): V2::GridRowDirection::Row, frameNode); ++} ++} +\ No newline at end of file +diff --git a/frameworks/core/components_ng/pattern/grid_row/grid_row_model_ng_static.h b/frameworks/core/components_ng/pattern/grid_row/grid_row_model_ng_static.h +new file mode 100644 +index 00000000000..eea3b9125d5 +--- /dev/null ++++ b/frameworks/core/components_ng/pattern/grid_row/grid_row_model_ng_static.h +@@ -0,0 +1,31 @@ ++/* ++ * Copyright (c) 2025 Huawei Device Co., Ltd. ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_GRID_ROW_MODEL_NG_STATIC_H ++#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_GRID_ROW_MODEL_NG_STATIC_H ++ ++#include "core/components_ng/pattern/grid_row/grid_row_model.h" ++#include "core/components_ng/base/frame_node.h" ++ ++namespace OHOS::Ace::NG { ++ ++class ACE_EXPORT GridRowModelNGStatic : public GridRowModel { ++public: ++ static void SetAlignItems(FrameNode* frameNode, const std::optional& alignItem); ++ static void SetDirection(FrameNode* frameNode, const std::optional& direction); ++}; ++} // namespace OHOS::Ace::NG ++ ++#endif +\ No newline at end of file +diff --git a/frameworks/core/components_ng/pattern/linear_layout/column_model_ng.cpp b/frameworks/core/components_ng/pattern/linear_layout/column_model_ng.cpp +index 4ba10fa296c..a842fd3b480 100644 +--- a/frameworks/core/components_ng/pattern/linear_layout/column_model_ng.cpp ++++ b/frameworks/core/components_ng/pattern/linear_layout/column_model_ng.cpp +@@ -79,10 +79,11 @@ void ColumnModelNG::Create(const RefPtr& spaceResObj, AlignDecla + + void ColumnModelNG::SetSpace(FrameNode* frameNode, const std::optional& space) + { +- if (space && GreatOrEqual(space->Value(), 0.0)) { ++ CHECK_NULL_VOID(space); ++ if (GreatOrEqual(space->Value(), 0.0)) { + ACE_UPDATE_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, Space, space.value(), frameNode); + } else { +- ACE_RESET_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, Space, frameNode); ++ LOGE("Column: the space value is illegal due to space is less than zero"); + } + } + +@@ -161,22 +162,14 @@ void ColumnModelNG::SetIsReverse(FrameNode* frameNode, bool isReverse) + ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, IsReverse, isReverse, frameNode); + } + +-void ColumnModelNG::SetJustifyContent(FrameNode* frameNode, const std::optional& valueOpt) ++void ColumnModelNG::SetJustifyContent(FrameNode* frameNode, FlexAlign flexAlign) + { +- if (valueOpt) { +- ACE_UPDATE_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, MainAxisAlign, valueOpt.value(), frameNode); +- } else { +- ACE_RESET_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, MainAxisAlign, frameNode); +- } ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, MainAxisAlign, flexAlign, frameNode); + } + +-void ColumnModelNG::SetAlignItems(FrameNode* frameNode, const std::optional& valueOpt) ++void ColumnModelNG::SetAlignItems(FrameNode* frameNode, FlexAlign flexAlign) + { +- if (valueOpt) { +- ACE_UPDATE_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, CrossAxisAlign, valueOpt.value(), frameNode); +- } else { +- ACE_RESET_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, CrossAxisAlign, frameNode); +- } ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, CrossAxisAlign, flexAlign, frameNode); + } + + FlexAlign ColumnModelNG::GetJustifyContent(FrameNode* frameNode) +diff --git a/frameworks/core/components_ng/pattern/linear_layout/column_model_ng.h b/frameworks/core/components_ng/pattern/linear_layout/column_model_ng.h +index c351c4f541e..fae077cf6a1 100644 +--- a/frameworks/core/components_ng/pattern/linear_layout/column_model_ng.h ++++ b/frameworks/core/components_ng/pattern/linear_layout/column_model_ng.h +@@ -33,8 +33,8 @@ public: + void CreateWithWrap() override {} + static void SetSpace(FrameNode* frameNode, const std::optional& space); + static void SetSpace(FrameNode* frameNode, const RefPtr& spaceResObj); +- static void SetJustifyContent(FrameNode* frameNode, const std::optional& valueOpt); +- static void SetAlignItems(FrameNode* frameNode, const std::optional& valueOpt); ++ static void SetJustifyContent(FrameNode* frameNode, FlexAlign flexAlign); ++ static void SetAlignItems(FrameNode* frameNode, FlexAlign flexAlign); + static void SetIsReverse(FrameNode* frameNode, bool isReverse); + static RefPtr CreateFrameNode(int32_t nodeId); + static FlexAlign GetJustifyContent(FrameNode* frameNode); +diff --git a/frameworks/core/components_ng/pattern/linear_layout/column_model_ng_static.cpp b/frameworks/core/components_ng/pattern/linear_layout/column_model_ng_static.cpp +new file mode 100644 +index 00000000000..bb45c7d214a +--- /dev/null ++++ b/frameworks/core/components_ng/pattern/linear_layout/column_model_ng_static.cpp +@@ -0,0 +1,49 @@ ++/* ++ * Copyright (c) 2025 Huawei Device Co., Ltd. ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include "core/components_ng/pattern/linear_layout/column_model_ng_static.h" ++ ++#include "core/components_ng/base/view_stack_processor.h" ++#include "core/components_ng/pattern/linear_layout/linear_layout_pattern.h" ++ ++namespace OHOS::Ace::NG { ++ ++void ColumnModelNGStatic::SetSpace(FrameNode* frameNode, const std::optional& space) ++{ ++ if (space && GreatOrEqual(space->Value(), 0.0)) { ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, Space, space.value(), frameNode); ++ } else { ++ ACE_RESET_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, Space, frameNode); ++ } ++} ++ ++void ColumnModelNGStatic::SetJustifyContent(FrameNode* frameNode, const std::optional& valueOpt) ++{ ++ if (valueOpt) { ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, MainAxisAlign, valueOpt.value(), frameNode); ++ } else { ++ ACE_RESET_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, MainAxisAlign, frameNode); ++ } ++} ++ ++void ColumnModelNGStatic::SetAlignItems(FrameNode* frameNode, const std::optional& valueOpt) ++{ ++ if (valueOpt) { ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, CrossAxisAlign, valueOpt.value(), frameNode); ++ } else { ++ ACE_RESET_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, CrossAxisAlign, frameNode); ++ } ++} ++} // namespace OHOS::AceL::NG +diff --git a/frameworks/core/components_ng/pattern/linear_layout/column_model_ng_static.h b/frameworks/core/components_ng/pattern/linear_layout/column_model_ng_static.h +new file mode 100644 +index 00000000000..4653e152c32 +--- /dev/null ++++ b/frameworks/core/components_ng/pattern/linear_layout/column_model_ng_static.h +@@ -0,0 +1,33 @@ ++/* ++ * Copyright (c) 2025 Huawei Device Co., Ltd. ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_LINEAR_LAYOUT_COLUMN_MODEL_NG_STATIC_H ++#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_LINEAR_LAYOUT_COLUMN_MODEL_NG_STATIC_H ++ ++#include "base/utils/macros.h" ++#include "core/components_ng/base/frame_node.h" ++#include "core/components_ng/pattern/linear_layout/column_model.h" ++ ++namespace OHOS::Ace::NG { ++ ++class ACE_EXPORT ColumnModelNGStatic : public ColumnModel { ++public: ++ static void SetSpace(FrameNode* frameNode, const std::optional& space); ++ static void SetJustifyContent(FrameNode* frameNode, const std::optional& valueOpt); ++ static void SetAlignItems(FrameNode* frameNode, const std::optional& valueOpt); ++}; ++ ++} // namespace OHOS::Ace::NG ++#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_LINEAR_LAYOUT_COLUMN_MODEL_NG_H +diff --git a/frameworks/core/components_ng/pattern/linear_layout/row_model_ng.cpp b/frameworks/core/components_ng/pattern/linear_layout/row_model_ng.cpp +index defee5ccb71..05be4fdc086 100644 +--- a/frameworks/core/components_ng/pattern/linear_layout/row_model_ng.cpp ++++ b/frameworks/core/components_ng/pattern/linear_layout/row_model_ng.cpp +@@ -80,7 +80,6 @@ void RowModelNG::Create(const RefPtr& spaceResObj, AlignDeclarat + + void RowModelNG::SetSpace(FrameNode* frameNode, const std::optional& space) + { +- CHECK_NULL_VOID(frameNode); + CHECK_NULL_VOID(space); + if (GreatOrEqual(space->Value(), 0.0)) { + ACE_UPDATE_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, Space, space.value(), frameNode); +@@ -160,34 +159,21 @@ void RowModelNG::SetIsReverse(bool isReverse) + ACE_UPDATE_LAYOUT_PROPERTY(FlexLayoutProperty, IsReverse, isReverse); + } + +-void RowModelNG::SetIsReverse(FrameNode* frameNode, const std::optional isReverse) ++void RowModelNG::SetIsReverse(FrameNode* frameNode, bool isReverse) + { +- CHECK_NULL_VOID(frameNode); +- if (isReverse.has_value()) { +- ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, IsReverse, isReverse.value(), frameNode); +- } else { +- ACE_RESET_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, IsReverse, frameNode); +- } ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, IsReverse, isReverse, frameNode); + } + +-void RowModelNG::SetJustifyContent(FrameNode* frameNode, const std::optional& flexAlign) ++void RowModelNG::SetJustifyContent(FrameNode* frameNode, FlexAlign flexAlign) + { + CHECK_NULL_VOID(frameNode); +- if (flexAlign.has_value()) { +- ACE_UPDATE_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, MainAxisAlign, flexAlign.value(), frameNode); +- } else { +- ACE_RESET_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, MainAxisAlign, frameNode); +- } ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, MainAxisAlign, flexAlign, frameNode); + } + +-void RowModelNG::SetAlignItems(FrameNode* frameNode, const std::optional& flexAlign) ++void RowModelNG::SetAlignItems(FrameNode* frameNode, FlexAlign flexAlign) + { + CHECK_NULL_VOID(frameNode); +- if (flexAlign.has_value()) { +- ACE_UPDATE_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, CrossAxisAlign, flexAlign.value(), frameNode); +- } else { +- ACE_RESET_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, CrossAxisAlign, frameNode); +- } ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, CrossAxisAlign, flexAlign, frameNode); + } + + FlexAlign RowModelNG::GetJustifyContent(FrameNode* frameNode) +diff --git a/frameworks/core/components_ng/pattern/linear_layout/row_model_ng.h b/frameworks/core/components_ng/pattern/linear_layout/row_model_ng.h +index 822d4b1687f..49c0969dff5 100644 +--- a/frameworks/core/components_ng/pattern/linear_layout/row_model_ng.h ++++ b/frameworks/core/components_ng/pattern/linear_layout/row_model_ng.h +@@ -33,9 +33,9 @@ public: + void CreateWithWrap() override {} + static void SetSpace(FrameNode* frameNode, const std::optional& space); + static void SetSpace(FrameNode* frameNode, const RefPtr& spaceResObj); +- static void SetJustifyContent(FrameNode* frameNode, const std::optional& flexAlign); +- static void SetAlignItems(FrameNode* frameNode, const std::optional& flexAlign); +- static void SetIsReverse(FrameNode* frameNode, const std::optional isReverse); ++ static void SetJustifyContent(FrameNode* frameNode, FlexAlign flexAlign); ++ static void SetAlignItems(FrameNode* frameNode, FlexAlign flexAlign); ++ static void SetIsReverse(FrameNode* frameNode, bool isReverse); + static RefPtr CreateFrameNode(int32_t nodeId); + static FlexAlign GetJustifyContent(FrameNode* frameNode); + static FlexAlign GetAlignItems(FrameNode* frameNode); +diff --git a/frameworks/core/components_ng/pattern/linear_layout/row_model_ng_static.cpp b/frameworks/core/components_ng/pattern/linear_layout/row_model_ng_static.cpp +new file mode 100644 +index 00000000000..08ab7b076c6 +--- /dev/null ++++ b/frameworks/core/components_ng/pattern/linear_layout/row_model_ng_static.cpp +@@ -0,0 +1,52 @@ ++/* ++ * Copyright (c) 2025 Huawei Device Co., Ltd. ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include "core/components_ng/pattern/linear_layout/row_model_ng_static.h" ++ ++#include "core/components_ng/base/view_stack_processor.h" ++#include "core/components_ng/pattern/linear_layout/linear_layout_pattern.h" ++ ++namespace OHOS::Ace::NG { ++ ++void RowModelNGStatic::SetIsReverse(FrameNode* frameNode, const std::optional isReverse) ++{ ++ CHECK_NULL_VOID(frameNode); ++ if (isReverse.has_value()) { ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, IsReverse, isReverse.value(), frameNode); ++ } else { ++ ACE_RESET_NODE_LAYOUT_PROPERTY(FlexLayoutProperty, IsReverse, frameNode); ++ } ++} ++ ++void RowModelNGStatic::SetJustifyContent(FrameNode* frameNode, const std::optional& flexAlign) ++{ ++ CHECK_NULL_VOID(frameNode); ++ if (flexAlign.has_value()) { ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, MainAxisAlign, flexAlign.value(), frameNode); ++ } else { ++ ACE_RESET_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, MainAxisAlign, frameNode); ++ } ++} ++ ++void RowModelNGStatic::SetAlignItems(FrameNode* frameNode, const std::optional& flexAlign) ++{ ++ CHECK_NULL_VOID(frameNode); ++ if (flexAlign.has_value()) { ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, CrossAxisAlign, flexAlign.value(), frameNode); ++ } else { ++ ACE_RESET_NODE_LAYOUT_PROPERTY(LinearLayoutProperty, CrossAxisAlign, frameNode); ++ } ++} ++} +\ No newline at end of file +diff --git a/frameworks/core/components_ng/pattern/linear_layout/row_model_ng_static.h b/frameworks/core/components_ng/pattern/linear_layout/row_model_ng_static.h +new file mode 100644 +index 00000000000..8c079e66dd4 +--- /dev/null ++++ b/frameworks/core/components_ng/pattern/linear_layout/row_model_ng_static.h +@@ -0,0 +1,32 @@ ++/* ++ * Copyright (c) 2025 Huawei Device Co., Ltd. ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_LINEAR_LAYOUT_ROW_MODEL_NG_STATIC_H ++#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_LINEAR_LAYOUT_ROW_MODEL_NG_STATIC_H ++ ++#include "base/utils/macros.h" ++#include "core/components_ng/base/frame_node.h" ++#include "core/components_ng/pattern/linear_layout/row_model.h" ++ ++namespace OHOS::Ace::NG { ++ ++class ACE_EXPORT RowModelNGStatic : public RowModel { ++public: ++ static void SetJustifyContent(FrameNode* frameNode, const std::optional& flexAlign); ++ static void SetAlignItems(FrameNode* frameNode, const std::optional& flexAlign); ++ static void SetIsReverse(FrameNode* frameNode, const std::optional isReverse); ++}; ++} // namespace OHOS::Ace::NG ++#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_LINEAR_LAYOUT_ROW_MODEL_NG_STATIC_H +\ No newline at end of file +diff --git a/frameworks/core/components_ng/pattern/linear_split/linear_split_model_ng_static.cpp b/frameworks/core/components_ng/pattern/linear_split/linear_split_model_ng_static.cpp +new file mode 100644 +index 00000000000..285dd8ef518 +--- /dev/null ++++ b/frameworks/core/components_ng/pattern/linear_split/linear_split_model_ng_static.cpp +@@ -0,0 +1,41 @@ ++/* ++ * Copyright (c) 2025 Huawei Device Co., Ltd. ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#include "core/components_ng/pattern/linear_split/linear_split_model_ng_static.h" ++ ++#include "core/components_ng/base/view_stack_processor.h" ++#include "core/components_ng/pattern/linear_split/linear_split_pattern.h" ++ ++namespace OHOS::Ace::NG { ++ ++RefPtr LinearSplitModelNGStatic::CreateFrameNode(int32_t nodeId, SplitType splitType) ++{ ++ std::string tag = splitType == SplitType::ROW_SPLIT ? V2::ROW_SPLIT_ETS_TAG : V2::COLUMN_SPLIT_ETS_TAG; ++ auto frameNode = FrameNode::GetOrCreateFrameNode( ++ tag, nodeId, [splitType]() { return AceType::MakeRefPtr(splitType); }); ++ return frameNode; ++} ++ ++void LinearSplitModelNGStatic::SetDivider(FrameNode* frameNode, NG::SplitType splitType, ++ const std::optional& optDivider) ++{ ++ CHECK_NULL_VOID(frameNode); ++ if (optDivider) { ++ ACE_UPDATE_NODE_LAYOUT_PROPERTY(LinearSplitLayoutProperty, Divider, optDivider.value(), frameNode); ++ } else { ++ ACE_RESET_NODE_LAYOUT_PROPERTY(LinearSplitLayoutProperty, Divider, frameNode); ++ } ++} ++} +diff --git a/frameworks/core/components_ng/pattern/linear_split/linear_split_model_ng_static.h b/frameworks/core/components_ng/pattern/linear_split/linear_split_model_ng_static.h +new file mode 100644 +index 00000000000..4d11559542f +--- /dev/null ++++ b/frameworks/core/components_ng/pattern/linear_split/linear_split_model_ng_static.h +@@ -0,0 +1,33 @@ ++/* ++ * Copyright (c) 2025 Huawei Device Co., Ltd. ++ * Licensed under the Apache License, Version 2.0 (the "License"); ++ * you may not use this file except in compliance with the License. ++ * You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_LINEAR_SPLIT_LINEAR_SPLIT_MODEL_NG_STATIC_H ++#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_LINEAR_SPLIT_LINEAR_SPLIT_MODEL_NG_STATIC_H ++ ++#include "core/components_ng/base/frame_node.h" ++#include "core/components_ng/pattern/linear_split/linear_split_model.h" ++ ++namespace OHOS::Ace::NG { ++ ++class ACE_EXPORT LinearSplitModelNGStatic : public OHOS::Ace::LinearSplitModel { ++public: ++ static RefPtr CreateFrameNode(int32_t nodeId, SplitType splitType); ++ static void SetDivider(FrameNode* frameNode, NG::SplitType splitType, ++ const std::optional& optDivider); ++}; ++} // namespace OHOS::Ace::NG ++ ++#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_LINEAR_SPLIT_LINEAR_SPLIT_MODEL_NG_STATIC_H ++ +diff --git a/frameworks/core/components_ng/pattern/relative_container/relative_container_layout_property.h b/frameworks/core/components_ng/pattern/relative_container/relative_container_layout_property.h +index a60e8858de4..e9de10b0931 100644 +--- a/frameworks/core/components_ng/pattern/relative_container/relative_container_layout_property.h ++++ b/frameworks/core/components_ng/pattern/relative_container/relative_container_layout_property.h +@@ -49,90 +49,6 @@ public: + + ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(Barrier, std::vector, PROPERTY_UPDATE_MEASURE); + ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(Guideline, std::vector, PROPERTY_UPDATE_MEASURE); +- +- std::unique_ptr GuidelineInfoToJsonObject(GuidelineInfo& info) const +- { +- auto json = JsonUtil::Create(true); +- json->Put("id", info.id.c_str()); +- std::string direction; +- if (info.direction == LineDirection::VERTICAL) { +- direction = "Axis.Vertical"; +- } +- if (info.direction == LineDirection::HORIZONTAL) { +- direction = "Axis.Horizontal"; +- } +- json->Put("direction", direction.c_str()); +- auto jsonPos = JsonUtil::Create(true); +- jsonPos->Put("start", info.start->ToString().c_str()); +- jsonPos->Put("end", info.end->ToString().c_str()); +- json->Put("position", jsonPos); +- +- return json; +- } +- +- std::unique_ptr GuidelineToJsonObject() const +- { +- auto array = JsonUtil::CreateArray(); +- if (!HasGuideline()) { +- return array; +- } +- auto value = GetGuidelineValue(); +- for (int i = 0; i < value.size(); i++) +- { +- array->Put(GuidelineInfoToJsonObject(value[i])); +- } +- return array; +- } +- +- std::string BarrierDirectionToString(BarrierDirection value) const +- { +- switch (value) +- { +- case BarrierDirection::LEFT: return "BarrierDirection.LEFT"; +- case BarrierDirection::RIGHT: return "BarrierDirection.RIGHT"; +- case BarrierDirection::TOP: return "BarrierDirection.TOP"; +- case BarrierDirection::BOTTOM: return "BarrierDirection.BOTTOM"; +- case BarrierDirection::START: return "BarrierDirection.START"; +- case BarrierDirection::END: return "BarrierDirection.END"; +- } +- } +- +- std::unique_ptr BarrierInfoToJsonObject(const BarrierInfo& info) const +- { +- auto json = JsonUtil::Create(true); +- json->Put("id", info.id.c_str()); +- json->Put("direction", BarrierDirectionToString(info.direction).c_str()); +- auto array = JsonUtil::CreateArray(); +- for (int i = 0; i < info.referencedId.size(); i++) { +- array->Put(std::to_string(i).c_str(), info.referencedId[i].c_str()); +- } +- json->Put("referencedId", array); +- return json; +- } +- +- std::unique_ptr BarrierToJsonObject() const +- { +- auto array = JsonUtil::CreateArray(); +- if (!HasBarrier()) { +- return array; +- } +- auto value = GetBarrierValue(); +- for (int i = 0; i < value.size(); i++) { +- array->Put(BarrierInfoToJsonObject(value[i])); +- } +- return array; +- } +- +- void ToJsonValue(std::unique_ptr& json, const InspectorFilter& filter) const override +- { +- LayoutProperty::ToJsonValue(json, filter); +- /* no fixed attr below, just return */ +- if (filter.IsFastFilter()) { +- return; +- } +- json->Put("barrier", BarrierToJsonObject()); +- json->Put("guideLine", GuidelineToJsonObject()); +- } + }; + } // namespace OHOS::Ace::NG + +diff --git a/frameworks/core/interfaces/native/implementation/column_modifier.cpp b/frameworks/core/interfaces/native/implementation/column_modifier.cpp +index 809e9f56614..fff5a5b2629 100644 +--- a/frameworks/core/interfaces/native/implementation/column_modifier.cpp ++++ b/frameworks/core/interfaces/native/implementation/column_modifier.cpp +@@ -18,6 +18,7 @@ + #include "core/interfaces/native/utility/ace_engine_types.h" + #include "core/common/container.h" + #include "core/components_ng/pattern/linear_layout/column_model_ng.h" ++#include "core/components_ng/pattern/linear_layout/column_model_ng_static.h" + #include "core/components_ng/base/view_stack_processor.h" + #include "core/components_ng/base/view_abstract_model_ng.h" + +@@ -80,14 +81,14 @@ void AlignItemsImpl(Ark_NativePointer node, + { + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); +- ColumnModelNG::SetAlignItems(frameNode, Converter::OptConvert(value)); ++ ColumnModelNGStatic::SetAlignItems(frameNode, Converter::OptConvert(value)); + } + void JustifyContentImpl(Ark_NativePointer node, + Ark_FlexAlign value) + { + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); +- ColumnModelNG::SetJustifyContent(frameNode, Converter::OptConvert(value)); ++ ColumnModelNGStatic::SetJustifyContent(frameNode, Converter::OptConvert(value)); + } + void PointLightImpl(Ark_NativePointer node, + const Ark_PointLightStyle* value) +diff --git a/frameworks/core/interfaces/native/implementation/divider_modifier.cpp b/frameworks/core/interfaces/native/implementation/divider_modifier.cpp +index 726ac572adb..9713cf3e712 100644 +--- a/frameworks/core/interfaces/native/implementation/divider_modifier.cpp ++++ b/frameworks/core/interfaces/native/implementation/divider_modifier.cpp +@@ -16,6 +16,7 @@ + #include "core/interfaces/native/utility/converter.h" + #include "core/components/common/properties/color.h" + #include "core/components_ng/pattern/divider/divider_model_ng.h" ++#include "core/components_ng/pattern/divider/divider_model_ng_static.h" + #include "arkoala_api_generated.h" + + namespace OHOS::Ace::NG::GeneratedModifier { +@@ -50,7 +51,7 @@ void ColorImpl(Ark_NativePointer node, + { + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); +- DividerModelNG::SetDividerColor(frameNode, Converter::OptConvert(*value), false); ++ DividerModelNGStatic::SetDividerColor(frameNode, Converter::OptConvert(*value)); + } + + void StrokeWidthImpl(Ark_NativePointer node, +@@ -63,7 +64,7 @@ void StrokeWidthImpl(Ark_NativePointer node, + if (optValue && (optValue.value().Unit() == DimensionUnit::PERCENT)) { + optValue.reset(); + } +- DividerModelNG::StrokeWidth(frameNode, optValue); ++ DividerModelNGStatic::StrokeWidth(frameNode, optValue); + } + + void LineCapImpl(Ark_NativePointer node, +@@ -71,7 +72,7 @@ void LineCapImpl(Ark_NativePointer node, + { + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); +- DividerModelNG::LineCap(frameNode, Converter::OptConvert(value)); ++ DividerModelNGStatic::LineCap(frameNode, Converter::OptConvert(value)); + } + + } // DividerAttributeModifier +diff --git a/frameworks/core/interfaces/native/implementation/flex_modifier.cpp b/frameworks/core/interfaces/native/implementation/flex_modifier.cpp +index 6b210c99902..3aeaa8bdbce 100644 +--- a/frameworks/core/interfaces/native/implementation/flex_modifier.cpp ++++ b/frameworks/core/interfaces/native/implementation/flex_modifier.cpp +@@ -19,6 +19,7 @@ + #include "core/interfaces/native/generated/interface/node_api.h" + #include "core/interfaces/native/utility/ace_engine_types.h" + #include "core/components_ng/pattern/flex/flex_model_ng.h" ++#include "core/components_ng/pattern/flex/flex_model_ng_static.h" + #include "core/interfaces/native/utility/validators.h" + #include "core/components_ng/base/view_abstract_model_ng.h" + +@@ -134,15 +135,15 @@ void SetFlexOptionsImpl(Ark_NativePointer node, + + if (!options->wrap.has_value() || options->wrap.value() == FlexWrap::NO_WRAP) { + FlexModelNG::SetFlexRow(frameNode); +- FlexModelNG::SetFlexDirection(frameNode, options->direction); +- FlexModelNG::SetMainAxisAlign(frameNode, options->align); +- FlexModelNG::SetCrossAxisAlign(frameNode, options->alignItems); ++ FlexModelNGStatic::SetFlexDirection(frameNode, options->direction); ++ FlexModelNGStatic::SetMainAxisAlign(frameNode, options->align); ++ FlexModelNGStatic::SetCrossAxisAlign(frameNode, options->alignItems); + } else if (options->wrap.value() == FlexWrap::WRAP || options->wrap.value() == FlexWrap::WRAP_REVERSE) { + FlexModelNG::SetFlexWrap(frameNode); + int32_t wrap = static_cast(options->wrap.value()); + if (options->direction.has_value()) { + int32_t direction = static_cast(options->direction.value()); +- FlexModelNG::SetFlexDirection(frameNode, options->direction); ++ FlexModelNGStatic::SetFlexDirection(frameNode, options->direction); + // WrapReverse means wrapVal = 2. Wrap means wrapVal = 1. + direction <= 1 ? direction += NUM_2 * (wrap - NUM_1) : direction -= NUM_2 * (wrap - NUM_1); + FlexModelNG::SetFlexWrapDirection(frameNode, static_cast(direction)); +@@ -152,9 +153,9 @@ void SetFlexOptionsImpl(Ark_NativePointer node, + WrapDirection::HORIZONTAL_REVERSE : WrapDirection::HORIZONTAL; + FlexModelNG::SetFlexWrapDirection(frameNode, wrapDirection); + } +- FlexModelNG::SetWrapMainAlignment(frameNode, options->wrapAlignment); +- FlexModelNG::SetWrapCrossAlignment(frameNode, options->wrapAlignItems); +- FlexModelNG::SetFlexAlignContent(frameNode, options->alignContent); ++ FlexModelNGStatic::SetWrapMainAlignment(frameNode, options->wrapAlignment); ++ FlexModelNGStatic::SetWrapCrossAlignment(frameNode, options->wrapAlignItems); ++ FlexModelNGStatic::SetFlexAlignContent(frameNode, options->alignContent); + if (options->crossSpace) { + FlexModelNG::SetCrossSpace(frameNode, options->crossSpace); + } +diff --git a/frameworks/core/interfaces/native/implementation/folder_stack_modifier.cpp b/frameworks/core/interfaces/native/implementation/folder_stack_modifier.cpp +index 0dee56568b3..c2579bb1f4a 100644 +--- a/frameworks/core/interfaces/native/implementation/folder_stack_modifier.cpp ++++ b/frameworks/core/interfaces/native/implementation/folder_stack_modifier.cpp +@@ -18,6 +18,7 @@ + #include "core/interfaces/native/generated/interface/node_api.h" + #include "arkoala_api_generated.h" + #include "core/components_ng/pattern/folder_stack/folder_stack_model_ng.h" ++#include "core/components_ng/pattern/folder_stack/folder_stack_model_ng_static.h" + #include "core/interfaces/native/utility/validators.h" + #include "core/interfaces/native/utility/callback_helper.h" + +@@ -26,7 +27,7 @@ namespace FolderStackModifier { + Ark_NativePointer ConstructImpl(Ark_Int32 id, + Ark_Int32 flags) + { +- auto frameNode = FolderStackModelNG::CreateFrameNode(id); ++ auto frameNode = FolderStackModelNGStatic::CreateFrameNode(id); + CHECK_NULL_RETURN(frameNode, nullptr); + frameNode->IncRefCount(); + return AceType::RawPtr(frameNode); +@@ -43,7 +44,7 @@ void SetFolderStackOptionsImpl(Ark_NativePointer node, + if (arkOpts) { + auto list = Converter::OptConvert>(arkOpts->upperItems); + if (list) { +- FolderStackModelNG::SetUpdateUpperItems(frameNode, *list); ++ FolderStackModelNGStatic::SetUpdateUpperItems(frameNode, *list); + } + } + } +@@ -54,7 +55,7 @@ void AlignContentImpl(Ark_NativePointer node, + { + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); +- FolderStackModelNG::SetAlignment(frameNode, Converter::OptConvert(value)); ++ FolderStackModelNGStatic::SetAlignment(frameNode, Converter::OptConvert(value)); + } + void OnFolderStateChangeImpl(Ark_NativePointer node, + const OnFoldStatusChangeCallback* value) +diff --git a/frameworks/core/interfaces/native/implementation/row_modifier.cpp b/frameworks/core/interfaces/native/implementation/row_modifier.cpp +index 8a606d90f59..5c170420d09 100644 +--- a/frameworks/core/interfaces/native/implementation/row_modifier.cpp ++++ b/frameworks/core/interfaces/native/implementation/row_modifier.cpp +@@ -17,6 +17,7 @@ + #include "core/interfaces/native/utility/converter.h" + #include "core/common/container.h" + #include "core/components_ng/pattern/linear_layout/row_model_ng.h" ++#include "core/components_ng/pattern/linear_layout/row_model_ng_static.h" + #include "core/components_ng/base/view_stack_processor.h" + #include "core/interfaces/native/utility/validators.h" + #include "core/components_ng/base/view_abstract_model_ng.h" +@@ -69,7 +70,7 @@ void AlignItemsImpl(Ark_NativePointer node, + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + auto flexAlign = Converter::OptConvert(value); +- RowModelNG::SetAlignItems(frameNode, flexAlign); ++ RowModelNGStatic::SetAlignItems(frameNode, flexAlign); + } + void JustifyContentImpl(Ark_NativePointer node, + Ark_FlexAlign value) +@@ -77,7 +78,7 @@ void JustifyContentImpl(Ark_NativePointer node, + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + auto flexAlign = Converter::OptConvert(value); +- RowModelNG::SetJustifyContent(frameNode, flexAlign); ++ RowModelNGStatic::SetJustifyContent(frameNode, flexAlign); + } + void PointLightImpl(Ark_NativePointer node, + const Ark_PointLightStyle* value) +-- +Gitee diff --git a/frameworks/core/components_ng/layout/box_layout_algorithm.cpp b/frameworks/core/components_ng/layout/box_layout_algorithm.cpp index fc64e434ce9ea01163c4061d438ebdcd6dc18497..6d7fb7bd9f0289e69133d91a8ab906de9e4219f0 100644 --- a/frameworks/core/components_ng/layout/box_layout_algorithm.cpp +++ b/frameworks/core/components_ng/layout/box_layout_algorithm.cpp @@ -130,9 +130,18 @@ void BoxLayoutAlgorithm::PerformMeasureSelfWithChildList( auto margin = layoutProperty->CreateMargin(); CalcSingleSideMarginFrame(margin, singleSideFrame, maxWidth, maxHeight); } - auto childSize = layoutProperty->GetLayoutPolicyProperty()->IsMatch() + bool isMatch = layoutProperty->GetLayoutPolicyProperty()->IsMatch(); + auto childSize = isMatch ? SizeF() : child->GetGeometryNode()->GetMarginFrameSize(); + auto childNode = child->GetHostNode(); + if (childNode && isMatch) { + LOGI("bzh childNode %{public}s, %{public}d isMatch", childNode->GetTag().c_str(), childNode->GetId()); + } else if (childNode && !isMatch) { + LOGI("bzh childNode %{public}s, %{public}d is not Match", childNode->GetTag().c_str(), childNode->GetId()); + } else if (!childNode) { + LOGI("bzh has no childNode"); + } if (maxWidth < childSize.Width()) { maxWidth = childSize.Width(); }