1 /*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "core/components_ng/pattern/text_input/text_input_layout_algorithm.h"
17
18 #include "base/utils/utils.h"
19 #include "core/components_ng/pattern/text_field/text_field_pattern.h"
20
21 namespace OHOS::Ace::NG {
22 namespace {
23 constexpr Dimension ERROR_TEXT_UNDERLINE_MARGIN = 8.0_vp;
24 constexpr Dimension ERROR_TEXT_CAPSULE_MARGIN = 8.0_vp;
25 } // namespace
26
MeasureContent(const LayoutConstraintF & contentConstraint,LayoutWrapper * layoutWrapper)27 std::optional<SizeF> TextInputLayoutAlgorithm::MeasureContent(
28 const LayoutConstraintF& contentConstraint, LayoutWrapper* layoutWrapper)
29 {
30 auto frameNode = layoutWrapper->GetHostNode();
31 CHECK_NULL_RETURN(frameNode, std::nullopt);
32 auto textFieldLayoutProperty = DynamicCast<TextFieldLayoutProperty>(layoutWrapper->GetLayoutProperty());
33 auto pattern = frameNode->GetPattern<TextFieldPattern>();
34 CHECK_NULL_RETURN(pattern, std::nullopt);
35
36 // Construct text style.
37 TextStyle textStyle;
38 ConstructTextStyles(frameNode, textStyle, textContent_, showPlaceHolder_);
39 std::replace(textContent_.begin(), textContent_.end(), '\n', ' ');
40
41 auto isInlineStyle = pattern->IsNormalInlineState();
42
43 direction_ = textFieldLayoutProperty->GetLayoutDirection();
44
45 // Create paragraph.
46 pattern->SetAdaptFontSize(std::nullopt);
47 auto disableTextAlign = !pattern->IsTextArea() && !showPlaceHolder_ && !isInlineStyle;
48 textFieldContentConstraint_ = CalculateContentMaxSizeWithCalculateConstraint(contentConstraint, layoutWrapper);
49 auto contentConstraintWithoutResponseArea =
50 BuildLayoutConstraintWithoutResponseArea(textFieldContentConstraint_, layoutWrapper);
51 if (IsNeedAdaptFontSize(textStyle, textFieldLayoutProperty, textFieldContentConstraint_)) {
52 if (!AddAdaptFontSizeAndAnimations(
53 textStyle, textFieldLayoutProperty, contentConstraintWithoutResponseArea, layoutWrapper)) {
54 return std::nullopt;
55 }
56 pattern->SetAdaptFontSize(textStyle.GetFontSize());
57 } else {
58 CreateParagraphEx(textStyle, textContent_, contentConstraint, layoutWrapper);
59 }
60
61 autoWidth_ = textFieldLayoutProperty->GetWidthAutoValue(false);
62
63 if (textContent_.empty()) {
64 // Used for empty text.
65 preferredHeight_ = pattern->PreferredLineHeight(true);
66 }
67
68 // Paragraph layout.
69 if (isInlineStyle) {
70 auto fontSize = pattern->FontSizeConvertToPx(textStyle.GetFontSize());
71 auto paragraphData = CreateParagraphData { disableTextAlign, fontSize };
72 CreateInlineParagraph(textStyle, textContent_, false, pattern->GetNakedCharPosition(), paragraphData);
73 return InlineMeasureContent(contentConstraintWithoutResponseArea, layoutWrapper);
74 } else if (showPlaceHolder_) {
75 return PlaceHolderMeasureContent(contentConstraintWithoutResponseArea, layoutWrapper, 0);
76 } else {
77 return TextInputMeasureContent(contentConstraintWithoutResponseArea, layoutWrapper, 0);
78 }
79 }
80
Measure(LayoutWrapper * layoutWrapper)81 void TextInputLayoutAlgorithm::Measure(LayoutWrapper* layoutWrapper)
82 {
83 const auto& layoutConstraint = layoutWrapper->GetLayoutProperty()->GetLayoutConstraint();
84 OptionalSizeF frameSize;
85 const auto& content = layoutWrapper->GetGeometryNode()->GetContent();
86 auto frameNode = layoutWrapper->GetHostNode();
87 CHECK_NULL_VOID(frameNode);
88 auto pattern = frameNode->GetPattern<TextFieldPattern>();
89 CHECK_NULL_VOID(pattern);
90 float contentWidth = 0.0f;
91 float contentHeight = 0.0f;
92 if (content) {
93 auto contentSize = content->GetRect().GetSize();
94 contentWidth = contentSize.Width();
95 contentHeight = contentSize.Height();
96 }
97 auto pipeline = frameNode->GetContext();
98 CHECK_NULL_VOID(pipeline);
99 auto textFieldTheme = pipeline->GetTheme<TextFieldTheme>();
100 CHECK_NULL_VOID(textFieldTheme);
101 auto defaultHeight = GetDefaultHeightByType(layoutWrapper);
102
103 auto responseAreaWidth = 0.0f;
104 if (pattern->GetCleanNodeResponseArea()) {
105 responseAreaWidth += pattern->GetCleanNodeResponseArea()->GetFrameSize().Width();
106 }
107 if (pattern->GetResponseArea()) {
108 responseAreaWidth += pattern->GetResponseArea()->GetFrameSize().Width();
109 }
110 frameSize.SetWidth(contentWidth + pattern->GetHorizontalPaddingAndBorderSum() + responseAreaWidth);
111
112 if (textFieldContentConstraint_.selfIdealSize.Height().has_value()) {
113 if (LessOrEqual(contentWidth, 0)) {
114 frameSize.SetHeight(textFieldContentConstraint_.maxSize.Height());
115 } else {
116 frameSize.SetHeight(
117 textFieldContentConstraint_.maxSize.Height() + pattern->GetVerticalPaddingAndBorderSum());
118 }
119 } else {
120 auto height = LessNotEqual(contentHeight, defaultHeight)
121 ? defaultHeight + pattern->GetVerticalPaddingAndBorderSum()
122 : contentHeight + pattern->GetVerticalPaddingAndBorderSum();
123 frameSize.SetHeight(height);
124 }
125 if (Container::LessThanAPIVersion(PlatformVersion::VERSION_TEN)) {
126 frameSize.Constrain(layoutConstraint->minSize, layoutConstraint->maxSize);
127 } else if (!layoutWrapper->GetLayoutProperty()->GetLayoutRect()) {
128 auto frameSizeConstraint = CalculateFrameSizeConstraint(textFieldContentConstraint_, layoutWrapper);
129 auto finalSize = UpdateOptionSizeByCalcLayoutConstraint(frameSize,
130 layoutWrapper->GetLayoutProperty()->GetCalcLayoutConstraint(),
131 layoutWrapper->GetLayoutProperty()->GetLayoutConstraint()->percentReference);
132 frameSize.SetHeight(finalSize.Height());
133 frameSize.Constrain(frameSizeConstraint.minSize, frameSizeConstraint.maxSize);
134 }
135 layoutWrapper->GetGeometryNode()->SetFrameSize(frameSize.ConvertToSizeT());
136 }
137
PrepareErrorTextNode(LayoutWrapper * layoutWrapper)138 void PrepareErrorTextNode(LayoutWrapper* layoutWrapper)
139 {
140 auto host = layoutWrapper->GetHostNode();
141 CHECK_NULL_VOID(host);
142 auto pattern = host->GetPattern<TextFieldPattern>();
143 CHECK_NULL_VOID(pattern);
144 auto textNode = pattern->GetErrorNode().Upgrade();
145 CHECK_NULL_VOID(textNode);
146 auto theme = pattern->GetTheme();
147 CHECK_NULL_VOID(theme);
148 auto textNodeLayoutProperty = AceType::DynamicCast<TextLayoutProperty>(textNode->GetLayoutProperty());
149 CHECK_NULL_VOID(textNodeLayoutProperty);
150
151 TextStyle errorTextStyle = theme->GetErrorTextStyle(); // update content
152 auto errorText = pattern->GetErrorTextString();
153 StringUtils::TransformStrCase(errorText, static_cast<int32_t>(errorTextStyle.GetTextCase()));
154 textNodeLayoutProperty->UpdateContent(errorText);
155 }
156
157 // calculate width constraint according to width of Counter and TextInput
BeforeErrorLayout(LayoutWrapper * layoutWrapper)158 void BeforeErrorLayout(LayoutWrapper* layoutWrapper)
159 {
160 PrepareErrorTextNode(layoutWrapper);
161 auto host = layoutWrapper->GetHostNode();
162 CHECK_NULL_VOID(host);
163 auto pattern = host->GetPattern<TextFieldPattern>();
164 CHECK_NULL_VOID(pattern);
165 auto geometryNode = host->GetGeometryNode();
166 CHECK_NULL_VOID(geometryNode);
167 auto textNode = pattern->GetErrorNode().Upgrade();
168 CHECK_NULL_VOID(textNode);
169 RectF textFieldFrameRect = geometryNode->GetFrameRect(); // calculate layoutWidth
170 auto errorValue = pattern->GetErrorTextString();
171 if (pattern->IsShowError() && !pattern->IsDisabled() && !errorValue.empty()) {
172 float padding = 0.0f;
173 auto textFieldLayoutProperty = pattern->GetLayoutProperty<TextFieldLayoutProperty>();
174 if (textFieldLayoutProperty && textFieldLayoutProperty->GetPaddingProperty()) {
175 const auto& paddingProperty = textFieldLayoutProperty->GetPaddingProperty();
176 padding = paddingProperty->left.value_or(CalcLength(0.0f)).GetDimension().ConvertToPx() +
177 paddingProperty->right.value_or(CalcLength(0.0f)).GetDimension().ConvertToPx();
178 }
179 float layoutWidth = textFieldFrameRect.Width() - padding; // subtract border width
180 auto localBorder = pattern->GetBorderWidthProperty();
181 float borderWidth = pattern->GetBorderLeft(localBorder) + pattern->GetBorderRight(localBorder);
182 borderWidth = std::max(borderWidth, 0.0f);
183 layoutWidth -= borderWidth;
184 auto counterDecoratorWrapper = pattern->GetCounterNode().Upgrade();
185 if (pattern->IsShowCount() && counterDecoratorWrapper) {
186 auto counterDecorator = counterDecoratorWrapper->GetHostNode();
187 if (counterDecorator) { // subtract counter length
188 float counterWidth = pattern->CalcDecoratorWidth(counterDecorator);
189 layoutWidth -= counterWidth;
190 }
191 }
192 LayoutConstraintF invisibleConstraint;
193 invisibleConstraint.UpdateMaxSizeWithCheck({0.0f, 0.0f});
194 if (LessOrEqual(layoutWidth, 0.0f)) {
195 textNode->Measure(invisibleConstraint);
196 return;
197 }
198 LayoutConstraintF textContentConstraint;
199 textContentConstraint.UpdateMaxSizeWithCheck({layoutWidth, Infinity<float>()});
200 auto textNodeLayoutWrapper = host->GetOrCreateChildByIndex(host->GetChildIndex(textNode));
201 if (textNodeLayoutWrapper) {
202 textNode->Measure(textContentConstraint);
203 if (GreatNotEqual(pattern->CalcDecoratorWidth(textNode), layoutWidth)) {
204 textNode->Measure(invisibleConstraint);
205 }
206 }
207 }
208 }
209
ErrorLayout(LayoutWrapper * layoutWrapper)210 void ErrorLayout(LayoutWrapper* layoutWrapper)
211 {
212 BeforeErrorLayout(layoutWrapper);
213 auto decoratedNode = layoutWrapper->GetHostNode();
214 CHECK_NULL_VOID(decoratedNode);
215 RefPtr<TextFieldPattern> textFieldPattern = decoratedNode->GetPattern<TextFieldPattern>();
216 CHECK_NULL_VOID(textFieldPattern);
217 auto textFieldLayoutProperty = decoratedNode->GetLayoutProperty<TextFieldLayoutProperty>();
218 CHECK_NULL_VOID(textFieldLayoutProperty);
219 auto textFieldGeometryNode = decoratedNode->GetGeometryNode();
220 CHECK_NULL_VOID(textFieldGeometryNode);
221 auto textNode = textFieldPattern->GetErrorNode().Upgrade();
222 CHECK_NULL_VOID(textNode);
223 auto textGeometryNode = textNode->GetGeometryNode();
224 CHECK_NULL_VOID(textGeometryNode);
225
226 float errorMargin = 0.0f;
227 if (textFieldLayoutProperty->GetShowUnderlineValue(false) && textFieldPattern->IsShowError()) {
228 errorMargin = ERROR_TEXT_UNDERLINE_MARGIN.ConvertToPx();
229 } else if (textFieldPattern->NeedShowPasswordIcon() && textFieldPattern->IsShowError()) {
230 errorMargin = ERROR_TEXT_CAPSULE_MARGIN.ConvertToPx();
231 } else if (textFieldPattern->IsShowError()) {
232 errorMargin = ERROR_TEXT_CAPSULE_MARGIN.ConvertToPx();
233 } else {
234 errorMargin = 0;
235 }
236
237 auto textFrameRect = textFieldGeometryNode->GetFrameRect();
238 auto offset = textFieldGeometryNode->GetContentOffset();
239 auto isRTL = textFieldLayoutProperty->GetNonAutoLayoutDirection() == TextDirection::RTL;
240 auto offSetX = offset.GetX();
241 if (isRTL) {
242 auto textFieldContentRect = textFieldGeometryNode->GetContentRect();
243 offSetX += textFieldContentRect.Width() - textGeometryNode->GetFrameRect().Width();
244 }
245
246 textGeometryNode->SetFrameOffset(OffsetF(offSetX, textFrameRect.Bottom() - textFrameRect.Top() + errorMargin));
247 textNode->Layout();
248 }
249
Layout(LayoutWrapper * layoutWrapper)250 void TextInputLayoutAlgorithm::Layout(LayoutWrapper* layoutWrapper)
251 {
252 auto frameNode = layoutWrapper->GetHostNode();
253 CHECK_NULL_VOID(frameNode);
254 auto pattern = frameNode->GetPattern<TextFieldPattern>();
255 CHECK_NULL_VOID(pattern);
256 auto size = layoutWrapper->GetGeometryNode()->GetFrameSize() -
257 SizeF(pattern->GetHorizontalPaddingAndBorderSum(), pattern->GetVerticalPaddingAndBorderSum());
258 const auto& content = layoutWrapper->GetGeometryNode()->GetContent();
259 CHECK_NULL_VOID(content);
260 SizeT<float> contentSize = content->GetRect().GetSize();
261 auto layoutProperty = DynamicCast<TextFieldLayoutProperty>(layoutWrapper->GetLayoutProperty());
262 CHECK_NULL_VOID(layoutProperty);
263 PipelineContext* context = layoutWrapper->GetHostNode()->GetContext();
264 CHECK_NULL_VOID(context);
265 parentGlobalOffset_ = layoutWrapper->GetHostNode()->GetPaintRectOffset(false, true) -
266 context->GetRootRect().GetOffset();
267 Alignment align = Alignment::CENTER;
268 auto isRTL = layoutProperty->GetNonAutoLayoutDirection() == TextDirection::RTL;
269 auto hasAlign = false;
270 if (layoutProperty->GetPositionProperty()) {
271 align = layoutWrapper->GetLayoutProperty()->GetPositionProperty()->GetAlignment().value_or(align);
272 hasAlign = layoutWrapper->GetLayoutProperty()->GetPositionProperty()->GetAlignment().has_value();
273 }
274 auto border = pattern->GetBorderWidthProperty();
275 OffsetF offsetBase = OffsetF(pattern->GetPaddingLeft() + pattern->GetBorderLeft(border),
276 pattern->GetPaddingTop() + pattern->GetBorderTop(border));
277
278 auto responseArea = pattern->GetResponseArea();
279 auto cleanNodeResponseArea = pattern->GetCleanNodeResponseArea();
280 auto unitNodeWidth = 0.0f;
281 if (responseArea) {
282 int32_t childIndex = frameNode->GetChildIndex(responseArea->GetFrameNode());
283 responseArea->Layout(layoutWrapper, childIndex, unitNodeWidth);
284 }
285 if (cleanNodeResponseArea) {
286 int32_t childIndex = frameNode->GetChildIndex(cleanNodeResponseArea->GetFrameNode());
287 cleanNodeResponseArea->Layout(layoutWrapper, childIndex, unitNodeWidth);
288 }
289
290 UpdateContentPositionParams params = {
291 .isRTL = isRTL,
292 .offsetBase = offsetBase,
293 .size = size,
294 .contentSize = contentSize,
295 .align = align,
296 .responseArea = responseArea,
297 .cleanResponseArea = cleanNodeResponseArea
298 };
299 UpdateContentPosition(params, content);
300
301 auto paintProperty = pattern->GetPaintProperty<TextFieldPaintProperty>();
302 CHECK_NULL_VOID(paintProperty);
303 UpdateTextRectParams updateTextRectParams = {
304 .layoutProperty = layoutProperty,
305 .pattern = pattern,
306 .contentSize = contentSize,
307 .isRTL = isRTL,
308 .responseArea = responseArea,
309 .cleanResponseArea = cleanNodeResponseArea,
310 .contentOffset = content->GetRect().GetOffset()
311 };
312 UpdateTextRect(updateTextRectParams);
313
314 bool isInlineStyle = pattern->IsNormalInlineState();
315 if (layoutProperty->GetShowCounterValue(false) && layoutProperty->HasMaxLength() && !isInlineStyle) {
316 TextFieldLayoutAlgorithm::CounterLayout(layoutWrapper);
317 }
318 if (pattern->IsShowError()) {
319 ErrorLayout(layoutWrapper);
320 }
321 }
322
UpdateContentPosition(const UpdateContentPositionParams & params,const std::unique_ptr<GeometryProperty> & content)323 void TextInputLayoutAlgorithm::UpdateContentPosition(const UpdateContentPositionParams ¶ms,
324 const std::unique_ptr<GeometryProperty> &content)
325 {
326 OffsetF contentOffset =
327 params.offsetBase + Alignment::GetAlignPosition(params.size, params.contentSize, params.align);
328 auto offsetBaseX = params.offsetBase.GetX();
329 if (params.isRTL) {
330 if (params.responseArea) {
331 offsetBaseX += params.responseArea->GetAreaRect().Width();
332 }
333 if (params.cleanResponseArea) {
334 offsetBaseX += params.cleanResponseArea->GetAreaRect().Width();
335 }
336 }
337 content->SetOffset(OffsetF(offsetBaseX, contentOffset.GetY()));
338 }
339
UpdateTextRect(const UpdateTextRectParams & params)340 void TextInputLayoutAlgorithm::UpdateTextRect(const UpdateTextRectParams& params)
341 {
342 if (LessOrEqual(textRect_.Width(), params.contentSize.Width())) {
343 float textRectOffsetX = 0.0f;
344 if (Container::LessThanAPIVersion(PlatformVersion::VERSION_TEN)) {
345 textRectOffsetX = params.pattern->GetPaddingLeft();
346 } else {
347 auto border = params.pattern->GetBorderWidthProperty();
348 textRectOffsetX = params.pattern->GetPaddingLeft() + params.pattern->GetBorderLeft(border);
349 }
350 bool isEmptyTextEditValue = params.pattern->GetTextValue().empty();
351 bool isInlineStyle = params.pattern->IsNormalInlineState();
352 if (!isEmptyTextEditValue && !isInlineStyle) {
353 TextAlign textAlign = params.layoutProperty->GetTextAlignValue(TextAlign::START);
354 params.pattern->CheckTextAlignByDirection(textAlign, direction_);
355 }
356 if (params.isRTL) {
357 if (params.responseArea) {
358 RectF responseAreaRect = params.responseArea->GetAreaRect();
359 textRectOffsetX += responseAreaRect.Width();
360 }
361 if (params.cleanResponseArea) {
362 RectF cleanResponseAreaRect = params.cleanResponseArea->GetAreaRect();
363 textRectOffsetX += cleanResponseAreaRect.Width();
364 }
365 textRect_.SetOffset(OffsetF(textRectOffsetX, params.contentOffset.GetY()));
366 } else {
367 textRect_.SetOffset(OffsetF(textRectOffsetX, params.contentOffset.GetY()));
368 }
369 } else {
370 textRect_.SetOffset({ params.pattern->GetTextRect().GetOffset().GetX(), params.contentOffset.GetY() });
371 }
372 }
373
GetDefaultHeightByType(LayoutWrapper * layoutWrapper)374 float TextInputLayoutAlgorithm::GetDefaultHeightByType(LayoutWrapper* layoutWrapper)
375 {
376 auto frameNode = layoutWrapper->GetHostNode();
377 CHECK_NULL_RETURN(frameNode, 0.0f);
378 auto pipeline = frameNode->GetContext();
379 CHECK_NULL_RETURN(pipeline, 0.0f);
380 auto textFieldTheme = pipeline->GetTheme<TextFieldTheme>();
381 CHECK_NULL_RETURN(textFieldTheme, 0.0f);
382 return static_cast<float>(textFieldTheme->GetContentHeight().ConvertToPx());
383 }
384
CreateParagraphEx(const TextStyle & textStyle,const std::string & content,const LayoutConstraintF & contentConstraint,LayoutWrapper * layoutWrapper)385 bool TextInputLayoutAlgorithm::CreateParagraphEx(const TextStyle& textStyle, const std::string& content,
386 const LayoutConstraintF& contentConstraint, LayoutWrapper* layoutWrapper)
387 {
388 // update child position.
389 auto frameNode = layoutWrapper->GetHostNode();
390 CHECK_NULL_RETURN(frameNode, false);
391 auto pattern = frameNode->GetPattern<TextFieldPattern>();
392 CHECK_NULL_RETURN(pattern, false);
393 auto isInlineStyle = pattern->IsNormalInlineState();
394 auto isPasswordType = pattern->IsInPasswordMode();
395 auto disableTextAlign = false;
396 auto fontSize = pattern->FontSizeConvertToPx(textStyle.GetFontSize());
397 auto paragraphData = CreateParagraphData { disableTextAlign, fontSize };
398
399 if (pattern->IsDragging() && !showPlaceHolder_ && !isInlineStyle) {
400 CreateParagraph(textStyle, pattern->GetDragContents(), content,
401 isPasswordType && pattern->GetTextObscured() && !showPlaceHolder_, paragraphData);
402 } else {
403 CreateParagraph(textStyle, content, isPasswordType && pattern->GetTextObscured() && !showPlaceHolder_,
404 pattern->GetNakedCharPosition(), paragraphData);
405 }
406 return true;
407 }
408
BuildLayoutConstraintWithoutResponseArea(const LayoutConstraintF & contentConstraint,LayoutWrapper * layoutWrapper)409 LayoutConstraintF TextInputLayoutAlgorithm::BuildLayoutConstraintWithoutResponseArea(
410 const LayoutConstraintF& contentConstraint, LayoutWrapper* layoutWrapper)
411 {
412 auto frameNode = layoutWrapper->GetHostNode();
413 CHECK_NULL_RETURN(frameNode, contentConstraint);
414 auto pattern = frameNode->GetPattern<TextFieldPattern>();
415 CHECK_NULL_RETURN(pattern, contentConstraint);
416
417 auto responseArea = pattern->GetResponseArea();
418 auto cleanNodeResponseArea = pattern->GetCleanNodeResponseArea();
419 float childWidth = 0.0f;
420 if (responseArea) {
421 auto childIndex = frameNode->GetChildIndex(responseArea->GetFrameNode());
422 childWidth += responseArea->Measure(layoutWrapper, childIndex).Width();
423 }
424 if (cleanNodeResponseArea) {
425 auto childIndex = frameNode->GetChildIndex(cleanNodeResponseArea->GetFrameNode());
426 childWidth += cleanNodeResponseArea->Measure(layoutWrapper, childIndex).Width();
427 }
428
429 auto newLayoutConstraint = contentConstraint;
430 newLayoutConstraint.maxSize.SetWidth(std::max(newLayoutConstraint.maxSize.Width() - childWidth, 0.0f));
431 newLayoutConstraint.minSize.SetWidth(std::max(newLayoutConstraint.minSize.Width() - childWidth, 0.0f));
432 if (newLayoutConstraint.selfIdealSize.Width()) {
433 newLayoutConstraint.selfIdealSize.SetWidth(newLayoutConstraint.selfIdealSize.Width().value() - childWidth);
434 }
435 return newLayoutConstraint;
436 }
437 } // namespace OHOS::Ace::NG
438