!7985 Update gridContainerInfo while Measure.

Merge pull request !7985 from 刘永畅/master
This commit is contained in:
openharmony_ci 2022-12-05 04:12:32 +00:00 committed by Gitee
commit 5c0501398c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 13 additions and 40 deletions

View File

@ -93,10 +93,10 @@ public:
RefPtr<GridContainerInfo> containerInfo_;
};
GridContainerInfo(const GridContainerInfo& info)
{
*this = info;
}
DEFINE_COPY_CONSTRUCTOR_AND_COPY_OPERATOR_AND_COMPARE_OPERATOR_WITH_PROPERTIES(GridContainerInfo,
(templateType_)(currentSizeType_)(sizeType_)(columns_)(gutterWidth_)(marginLeft_)(marginRight_)\
(paddingLeft_)(paddingRight_)(containerWidth_)(columnWidth_)(columnType_));
~GridContainerInfo() override = default;
double GetColumnWidth() const
@ -119,38 +119,6 @@ public:
*/
void ACE_EXPORT BuildColumnWidth();
void BuildColumnWidth(double width);
bool operator==(const GridContainerInfo& info) const
{
if (&info == this) {
return true;
}
return ((templateType_ == info.templateType_) && (currentSizeType_ == info.currentSizeType_) &&
(sizeType_ == info.sizeType_) && (columns_ == info.columns_) && (gutterWidth_ == info.gutterWidth_) &&
(marginLeft_ == info.marginLeft_) && (marginRight_ == info.marginRight_) &&
(paddingLeft_ == info.paddingLeft_) && (paddingRight_ == info.paddingRight_) &&
(containerWidth_ == info.containerWidth_) && (columnWidth_ == info.columnWidth_) &&
(columnType_ == info.columnType_));
}
GridContainerInfo& operator=(const GridContainerInfo& info)
{
if (&info != this) {
templateType_ = info.templateType_;
currentSizeType_ = info.currentSizeType_;
sizeType_ = info.sizeType_;
columns_ = info.columns_;
gutterWidth_ = info.gutterWidth_;
marginLeft_ = info.marginLeft_;
marginRight_ = info.marginRight_;
paddingLeft_ = info.paddingLeft_;
paddingRight_ = info.paddingRight_;
containerWidth_ = info.containerWidth_;
columnWidth_ = info.columnWidth_;
columnType_ = info.columnType_;
}
return *this;
}
private:
GridContainerInfo() = default;

View File

@ -38,13 +38,18 @@ public:
CHECK_NULL_VOID(layoutProperty);
const auto& gridContainerLayoutProperty = DynamicCast<GridContainerLayoutProperty>(layoutProperty);
CHECK_NULL_VOID(gridContainerLayoutProperty);
float width = CreateIdealSize(
layoutProperty->GetLayoutConstraint().value(), Axis::VERTICAL, MeasureType::MATCH_PARENT, true)
.Width();
gridContainerLayoutProperty->BuildWidth(width);
auto layoutConstraint = layoutProperty->GetLayoutConstraint().value();
SizeF idealSize = CreateIdealSize(layoutConstraint, Axis::VERTICAL, MeasureType::MATCH_PARENT_CROSS_AXIS, true);
gridContainerLayoutProperty->BuildWidth(idealSize.Width());
OptionalSizeF optSize;
optSize.SetWidth(idealSize.Width());
layoutConstraint.UpdateIllegalSelfIdealSizeWithCheck(optSize);
layoutProperty->UpdateLayoutConstraint(layoutConstraint);
auto curLayoutProp = layoutWrapper->GetHostNode()->GetLayoutProperty<GridContainerLayoutProperty>();
curLayoutProp->SetReserveObj(gridContainerLayoutProperty);
curLayoutProp->UpdateContainerInfo(gridContainerLayoutProperty->GetContainerInfoValue());
LinearLayoutAlgorithm::Measure(layoutWrapper);
}
};