!45023 修改输入框的border和padding之后标记textRect初始化

Merge pull request !45023 from 郝烁/autoui
This commit is contained in:
openharmony_ci 2024-10-08 07:22:43 +00:00 committed by Gitee
commit 1af55dbc6c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 19 additions and 2 deletions

View File

@ -738,6 +738,11 @@ void TextFieldModelNG::SetPadding(const NG::PaddingProperty& newPadding, Edge ol
}
NG::ViewAbstract::SetPadding(newPadding);
ACE_UPDATE_PAINT_PROPERTY(TextFieldPaintProperty, PaddingByUser, newPadding);
auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode();
CHECK_NULL_VOID(frameNode);
auto pattern = frameNode->GetPattern<TextFieldPattern>();
CHECK_NULL_VOID(pattern);
pattern->SetIsInitTextRect(false);
}
void TextFieldModelNG::SetDefaultPadding()
@ -756,6 +761,9 @@ void TextFieldModelNG::SetDefaultPadding()
paddings.right = NG::CalcLength(themePadding.Right().ConvertToPx());
ViewAbstract::SetPadding(paddings);
ACE_UPDATE_PAINT_PROPERTY(TextFieldPaintProperty, PaddingByUser, paddings);
auto pattern = frameNode->GetPattern<TextFieldPattern>();
CHECK_NULL_VOID(pattern);
pattern->SetIsInitTextRect(false);
}
void TextFieldModelNG::SetHoverEffect(HoverEffectType hoverEffect)
@ -1912,6 +1920,9 @@ void TextFieldModelNG::SetPadding(FrameNode* frameNode, NG::PaddingProperty& new
CHECK_NULL_VOID(frameNode);
NG::ViewAbstract::SetPadding(newPadding);
ACE_UPDATE_NODE_PAINT_PROPERTY(TextFieldPaintProperty, PaddingByUser, newPadding, frameNode);
auto pattern = frameNode->GetPattern<TextFieldPattern>();
CHECK_NULL_VOID(pattern);
pattern->SetIsInitTextRect(false);
}
RefPtr<UINode> TextFieldModelNG::GetCustomKeyboard(FrameNode* frameNode)
@ -1972,6 +1983,9 @@ void TextFieldModelNG::SetBorderWidth(FrameNode* frameNode, NG::BorderWidthPrope
CHECK_NULL_VOID(frameNode);
NG::ViewAbstract::SetBorderWidth(frameNode, borderWidth);
ACE_UPDATE_NODE_PAINT_PROPERTY(TextFieldPaintProperty, BorderWidthFlagByUser, borderWidth, frameNode);
auto pattern = frameNode->GetPattern<TextFieldPattern>();
CHECK_NULL_VOID(pattern);
pattern->SetIsInitTextRect(false);
}
void TextFieldModelNG::SetBorderRadius(FrameNode* frameNode, NG::BorderRadiusProperty borderRadius)

View File

@ -2942,8 +2942,7 @@ void TextFieldPattern::OnModifyDone()
SetShowError();
}
// The textRect position can't be changed by only redraw.
if (CheckNeedMeasure(layoutProperty->GetPropertyChangeFlag()) && !HasInputOperation() &&
(!HasFocus() || !initTextRect_) && isTextChangedAtCreation_) {
if (!initTextRect_) {
textRect_.SetLeft(GetPaddingLeft() + GetBorderLeft());
textRect_.SetTop(GetPaddingTop() + GetBorderTop());
initTextRect_ = true;

View File

@ -1528,6 +1528,10 @@ public:
const RefPtr<CleanNodeResponseArea>& cleanNodeResponseArea);
void StopContentScroll();
void UpdateContentScroller(const Offset& localOffset);
void SetIsInitTextRect(bool isInitTextRect)
{
initTextRect_ = isInitTextRect;
}
protected:
virtual void InitDragEvent();