mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 23:21:05 +00:00
!7985 Update gridContainerInfo while Measure.
Merge pull request !7985 from 刘永畅/master
This commit is contained in:
commit
5c0501398c
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user