• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2024 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 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_TEXT_FIELD_TEXT_FIELD_PATTERN_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_TEXT_FIELD_TEXT_FIELD_PATTERN_H
18 
19 #include <cstdint>
20 #include <optional>
21 #include <queue>
22 #include <string>
23 #include <utility>
24 #include <vector>
25 
26 #include "base/geometry/ng/offset_t.h"
27 #include "base/geometry/ng/rect_t.h"
28 #include "base/geometry/rect.h"
29 #include "base/memory/referenced.h"
30 #include "base/mousestyle/mouse_style.h"
31 #include "base/utils/multi_thread.h"
32 #include "base/utils/utf_helper.h"
33 #include "base/view_data/view_data_wrap.h"
34 #include "core/common/ace_application_info.h"
35 #include "core/common/ai/ai_write_adapter.h"
36 #include "base/view_data/hint_to_type_wrap.h"
37 #include "core/common/clipboard/clipboard.h"
38 #include "core/common/ime/text_edit_controller.h"
39 #include "core/common/ime/text_input_action.h"
40 #include "core/common/ime/text_input_client.h"
41 #include "core/common/ime/text_input_configuration.h"
42 #include "core/common/ime/text_input_connection.h"
43 #include "core/common/ime/text_input_formatter.h"
44 #include "core/common/ime/text_input_proxy.h"
45 #include "core/common/ime/text_input_type.h"
46 #include "core/common/ime/text_selection.h"
47 #include "core/components/text_field/textfield_theme.h"
48 #include "core/components_ng/image_provider/image_loading_context.h"
49 #include "core/components_ng/pattern/overlay/keyboard_base_pattern.h"
50 #include "core/components_ng/pattern/scrollable/scrollable_pattern.h"
51 #include "core/components_ng/pattern/text/layout_info_interface.h"
52 #include "core/components_ng/pattern/select_overlay/magnifier.h"
53 #include "core/components_ng/pattern/text/multiple_click_recognizer.h"
54 #include "core/components_ng/pattern/text/text_base.h"
55 #include "core/components_ng/pattern/text/text_menu_extension.h"
56 #include "core/components_ng/pattern/text_area/text_area_layout_algorithm.h"
57 #include "core/components_ng/pattern/text_drag/text_drag_base.h"
58 #include "core/components_ng/pattern/text_field/content_controller.h"
59 #include "core/components_ng/pattern/text_field/text_component_decorator.h"
60 #include "core/components_ng/pattern/text_field/text_editing_value_ng.h"
61 #include "core/components_ng/pattern/text_field/text_content_type.h"
62 #include "core/components_ng/pattern/text_field/auto_fill_controller.h"
63 #include "core/components_ng/pattern/text_field/text_field_accessibility_property.h"
64 #include "core/components_ng/pattern/text_field/text_field_controller.h"
65 #include "core/components_ng/pattern/text_field/text_field_event_hub.h"
66 #include "core/components_ng/pattern/text_field/text_field_layout_property.h"
67 #include "core/components_ng/pattern/text_field/text_field_manager.h"
68 #include "core/components_ng/pattern/text_field/text_field_paint_method.h"
69 #include "core/components_ng/pattern/text_field/text_field_paint_property.h"
70 #include "core/components_ng/pattern/text_field/text_field_select_overlay.h"
71 #include "core/components_ng/pattern/text_field/text_input_response_area.h"
72 #include "core/components_ng/pattern/text_field/text_select_controller.h"
73 #include "core/components_ng/pattern/text_field/text_selector.h"
74 #include "core/components_ng/pattern/text_input/text_input_layout_algorithm.h"
75 #include "core/components_ng/pattern/text_field/text_keyboard_common_type.h"
76 
77 #ifndef ACE_UNITTEST
78 #ifdef ENABLE_STANDARD_INPUT
79 #include "refbase.h"
80 
81 namespace OHOS::MiscServices {
82 class InspectorFilter;
83 class OnTextChangedListener;
84 
85 struct TextConfig;
86 } // namespace OHOS::MiscServices
87 #endif
88 #endif
89 
90 namespace OHOS::Ace::NG {
91 
92 enum class FocuseIndex { TEXT = 0, CANCEL, UNIT };
93 
94 enum class SelectionMode { SELECT, SELECT_ALL, NONE };
95 
96 enum class DragStatus { DRAGGING, ON_DROP, NONE };
97 
98 enum class CaretStatus { SHOW, HIDE, NONE };
99 
100 enum class InputOperation {
101     INSERT,
102     DELETE_BACKWARD,
103     DELETE_FORWARD,
104     CURSOR_UP,
105     CURSOR_DOWN,
106     CURSOR_LEFT,
107     CURSOR_RIGHT,
108     SET_PREVIEW_TEXT,
109     SET_PREVIEW_FINISH,
110     INPUT,
111 };
112 
113 struct PasswordModeStyle {
114     Color bgColor;
115     Color textColor;
116     BorderWidthProperty borderwidth;
117     BorderColorProperty borderColor;
118     BorderRadiusProperty radius;
119     PaddingProperty padding;
120     MarginProperty margin;
121 };
122 
123 struct PreState {
124     Color textColor;
125     Color bgColor;
126     BorderRadiusProperty radius;
127     BorderWidthProperty borderWidth;
128     BorderColorProperty borderColor;
129     PaddingProperty padding;
130     MarginProperty margin;
131     RectF frameRect;
132     bool setHeight = false;
133     bool saveState = false;
134     bool hasBorderColor = false;
135 };
136 
137 enum class RequestKeyboardReason {
138     UNKNOWN = 0,
139     ON_KEY_EVENT,
140     SINGLE_CLICK,
141     DOUBLE_CLICK,
142     LONG_PRESS,
143     RESET_KEYBOARD,
144     MOUSE_RELEASE,
145     SET_SELECTION,
146     SEARCH_REQUEST,
147     AUTO_FILL_REQUEST_FAIL,
148     SHOW_KEYBOARD_ON_FOCUS,
149     STYLUS_DETECTOR,
150     CUSTOM_KEYBOARD
151 };
152 
153 enum class RequestFocusReason {
154     UNKNOWN = 0,
155     DRAG_END,
156     DRAG_MOVE,
157     CLICK,
158     LONG_PRESS,
159     AUTO_FILL,
160     CLEAN_NODE,
161     MOUSE,
162     SYSTEM,
163     DRAG_ENTER,
164     DRAG_SELECT
165 };
166 
167 
168 // reason for needToRequestKeyboardInner_ change
169 enum class RequestKeyboardInnerChangeReason {
170     UNKNOWN = 0,
171     BLUR,
172     FOCUS,
173     AUTOFILL_PROCESS,
174     REQUEST_KEYBOARD_SUCCESS,
175     SEARCH_FOCUS
176 };
177 
178 enum class InputReason {
179     NONE = 0,
180     IME,
181     PASTE,
182     CUT,
183     DRAG,
184     AUTO_FILL,
185     AI_WRITE,
186     CANCEL_BUTTON
187 };
188 
189 struct PreviewTextInfo {
190     std::u16string text;
191     PreviewRange range;
192     bool isIme;
193 };
194 
195 struct InsertCommandInfo {
196     std::u16string insertValue;
197     InputReason reason;
198 };
199 
200 struct InputCommandInfo {
201     PreviewRange deleteRange;
202     int32_t insertOffset;
203     std::u16string insertValue;
204     InputReason reason;
205 };
206 
207 struct TouchAndMoveCaretState {
208     bool isTouchCaret = false;
209     bool isMoveCaret = false;
210     Offset touchDownOffset;
211     Dimension minDinstance = 5.0_vp;
212     int32_t touchFingerId = -1;
213 };
214 
215 struct FloatingCaretState {
216     bool FloatingCursorVisible = false;
217     bool ShowOriginCursor = false;
218     Color OriginCursorColor = Color(0x4D000000);
219     std::optional<float> lastFloatingCursorY = std::nullopt;
220 
ResetFloatingCaretState221     void Reset()
222     {
223         FloatingCursorVisible = false;
224         ShowOriginCursor = false;
225         lastFloatingCursorY = std::nullopt;
226     }
227 };
228 
229 struct ContentScroller {
230     CancelableCallback<void()> autoScrollTask;
231     std::function<void(const Offset&)> scrollingCallback;
232     std::function<void(const Offset&)> beforeScrollingCallback;
233     bool isScrolling = false;
234     float scrollInterval = 15;
235     float stepOffset = 0.0f;
236     Offset localOffset;
237     std::optional<Offset> hotAreaOffset;
238 
OnBeforeScrollingCallbackContentScroller239     void OnBeforeScrollingCallback(const Offset& localOffset)
240     {
241         if (beforeScrollingCallback && !isScrolling) {
242             beforeScrollingCallback(localOffset);
243         }
244     }
245 };
246 
247 struct MoveCaretToContentRectData {
248     int32_t index = 0;
249     TextAffinity textAffinity = TextAffinity::UPSTREAM;
250     bool isEditorValueChanged = true;
251     bool moveContent = true;
252 };
253 
254 class TextFieldPattern : public ScrollablePattern,
255                          public TextDragBase,
256                          public ValueChangeObserver,
257                          public TextInputClient,
258                          public TextBase,
259                          public Magnifier,
260                          public TextGestureSelector,
261                          public LayoutInfoInterface {
262     DECLARE_ACE_TYPE(TextFieldPattern, ScrollablePattern, TextDragBase, ValueChangeObserver, TextInputClient, TextBase,
263         Magnifier, TextGestureSelector);
264 
265 public:
266     TextFieldPattern();
267     ~TextFieldPattern() override;
268 
GetInstanceId()269     int32_t GetInstanceId() const override
270     {
271         return GetHostInstanceId();
272     }
273 
274     // TextField needs softkeyboard, override function.
NeedSoftKeyboard()275     bool NeedSoftKeyboard() const override
276     {
277         return true;
278     }
279 
SetBlurOnSubmit(bool blurOnSubmit)280     void SetBlurOnSubmit(bool blurOnSubmit)
281     {
282         textInputBlurOnSubmit_ = blurOnSubmit;
283         textAreaBlurOnSubmit_ = blurOnSubmit;
284     }
285 
GetBlurOnSubmit()286     bool GetBlurOnSubmit()
287     {
288         return IsTextArea() ? textAreaBlurOnSubmit_ : textInputBlurOnSubmit_;
289     }
290 
ClearOperationRecords()291     void ClearOperationRecords()
292     {
293         operationRecords_.clear();
294         redoOperationRecords_.clear();
295     }
296 
SetKeyboardAppearance(KeyboardAppearance value)297     void SetKeyboardAppearance(KeyboardAppearance value)
298     {
299         keyboardAppearance_ = value;
300     }
301 
GetKeyboardAppearance()302     KeyboardAppearance GetKeyboardAppearance() const
303     {
304         return keyboardAppearance_;
305     }
306 
NeedToRequestKeyboardOnFocus()307     bool NeedToRequestKeyboardOnFocus() const override
308     {
309         return needToRequestKeyboardOnFocus_;
310     }
311 
312     bool CheckBlurReason();
313 
314     bool NeedSetScrollRect();
315 
316     RefPtr<NodePaintMethod> CreateNodePaintMethod() override;
317 
CreateLayoutProperty()318     RefPtr<LayoutProperty> CreateLayoutProperty() override
319     {
320         return MakeRefPtr<TextFieldLayoutProperty>();
321     }
322 
CreateEventHub()323     RefPtr<EventHub> CreateEventHub() override
324     {
325         return MakeRefPtr<TextFieldEventHub>();
326     }
327 
CreatePaintProperty()328     RefPtr<PaintProperty> CreatePaintProperty() override
329     {
330         return MakeRefPtr<TextFieldPaintProperty>();
331     }
332 
CreateAccessibilityProperty()333     RefPtr<AccessibilityProperty> CreateAccessibilityProperty() override
334     {
335         return MakeRefPtr<TextFieldAccessibilityProperty>();
336     }
337 
CreateLayoutAlgorithm()338     RefPtr<LayoutAlgorithm> CreateLayoutAlgorithm() override
339     {
340         if (IsTextArea()) {
341             return MakeRefPtr<TextAreaLayoutAlgorithm>();
342         }
343         return MakeRefPtr<TextInputLayoutAlgorithm>();
344     }
345 
346     void OnModifyDone() override;
347     void MultiThreadDelayedExecution();
348     void ProcessUnderlineColorOnModifierDone();
349     void UpdateSelectionOffset();
350     void CalcCaretMetricsByPosition(
351         int32_t extent, CaretMetricsF& caretCaretMetric, TextAffinity textAffinity = TextAffinity::DOWNSTREAM);
352     int32_t ConvertTouchOffsetToCaretPosition(const Offset& localOffset);
353     int32_t ConvertTouchOffsetToCaretPositionNG(const Offset& localOffset);
354 
355     // Obtain the systemWindowsId when switching between windows
356     uint32_t GetSCBSystemWindowId();
357 
358     void InsertValue(const std::u16string& insertValue, bool isIME = false) override;
359     void InsertValue(const std::string& insertValue, bool isIME = false) override;
360     void NotifyImfFinishTextPreview();
361     int32_t InsertValueByController(const std::u16string& insertValue, int32_t offset);
362     void ExecuteInsertValueCommand(const InsertCommandInfo& info);
363     void CalcCounterAfterFilterInsertValue(int32_t curLength, const std::u16string insertValue, int32_t maxLength);
364     void UpdateObscure(const std::u16string& insertValue, bool hasInsertValue);
365     void CleanCounterNode();
366     void CleanErrorNode();
367     float CalcDecoratorWidth(const RefPtr<FrameNode>& decoratorNode);
368     float CalcDecoratorHeight(const RefPtr<FrameNode>& decoratorNode);
369     void UltralimitShake();
370     void UpdateAreaBorderStyle(BorderWidthProperty& currentBorderWidth, BorderWidthProperty& overCountBorderWidth,
371         BorderColorProperty& overCountBorderColor, BorderColorProperty& currentBorderColor);
372     void DeleteBackward(int32_t length) override;
373     void DeleteBackwardOperation(int32_t length);
374     void DeleteForward(int32_t length) override;
375     void DeleteForwardOperation(int32_t length);
376     void HandleOnDelete(bool backward) override;
377     bool HandleOnDeleteComb(bool backward) override;
378     void DeleteBackwardWord();
379     void DeleteForwardWord();
380     void HandleOnPageUp() override;
381     void HandleOnPageDown() override;
382     void CreateHandles() override;
383     void GetEmojiSubStringRange(int32_t& start, int32_t& end);
384 
385     int32_t SetPreviewText(const std::u16string& previewValue, const PreviewRange range) override;
386     int32_t SetPreviewText(const std::string& previewValue, const PreviewRange range) override;
387     void FinishTextPreview() override;
388     void SetPreviewTextOperation(PreviewTextInfo info);
389     void SetPreviewTextOperationMultiThread(PreviewTextInfo info);
390     void SetPreviewTextOperationMultiThreadPart(PreviewTextInfo info, int32_t start, int32_t end);
391     void FinishTextPreviewOperation(bool triggerOnWillChange = true);
392     void FinishTextPreviewOperationMultiThread(bool triggerOnWillChange = true);
393     void FinishTextPreviewOperationMultiThreadPart(bool triggerOnWillChange = true);
394     TextDragInfo CreateTextDragInfo() const;
395 
GetCounterDecorator()396     RefPtr<TextComponentDecorator> GetCounterDecorator() const
397     {
398         return counterDecorator_;
399     }
400 
GetErrorDecorator()401     RefPtr<TextComponentDecorator> GetErrorDecorator() const
402     {
403         return errorDecorator_;
404     }
405 
GetShowCounterStyleValue()406     bool GetShowCounterStyleValue() const
407     {
408         return showCountBorderStyle_;
409     }
410 
SetCounterState(bool counterChange)411     void SetCounterState(bool counterChange)
412     {
413         counterChange_ = counterChange;
414     }
415 
416     float GetTextOrPlaceHolderFontSize();
417 
SetTextFieldController(const RefPtr<TextFieldController> & controller)418     void SetTextFieldController(const RefPtr<TextFieldController>& controller)
419     {
420         textFieldController_ = controller;
421     }
422 
GetTextFieldController()423     const RefPtr<TextFieldController>& GetTextFieldController()
424     {
425         return textFieldController_;
426     }
427 
SetJSTextEditableController(const RefPtr<Referenced> & jsController)428     void SetJSTextEditableController(const RefPtr<Referenced>& jsController)
429     {
430         jsTextEditableController_ = jsController;
431     }
432 
GetJSTextEditableController()433     RefPtr<Referenced> GetJSTextEditableController()
434     {
435         return jsTextEditableController_.Upgrade();
436     }
437 
GetTextValue()438     std::string GetTextValue() const
439     {
440         return contentController_->GetTextValue();
441     }
442 
GetTextUtf16Value()443     const std::u16string& GetTextUtf16Value() const
444     {
445         return contentController_->GetTextUtf16Value();
446     }
447 
GetOrCreateAutoFillController()448     const RefPtr<AutoFillController>& GetOrCreateAutoFillController()
449     {
450         if (!autoFillController_) {
451             autoFillController_ = MakeRefPtr<AutoFillController>(WeakClaim(this));
452         }
453         return autoFillController_;
454     }
455 
456 #if defined(IOS_PLATFORM)
GetInputEditingValue()457     const TextEditingValue& GetInputEditingValue() const override
458     {
459         static TextEditingValue value;
460         value.text = contentController_->GetTextValue();
461         value.hint = UtfUtils::Str16DebugToStr8(GetPlaceHolder());
462         value.selection.Update(selectController_->GetStartIndex(), selectController_->GetEndIndex());
463         return value;
464     };
465     Offset GetGlobalOffset() const;
466     double GetEditingBoxY() const override;
467     double GetEditingBoxTopY() const override;
468     bool GetEditingBoxModel() const override;
469 #endif
470 
ShouldDelayChildPressedState()471     bool ShouldDelayChildPressedState() const override
472     {
473         return false;
474     }
475 
UpdateEditingValue(const std::string & value,int32_t caretPosition)476     void UpdateEditingValue(const std::string& value, int32_t caretPosition)
477     {
478         contentController_->SetTextValue(UtfUtils::Str8DebugToStr16(value));
479         selectController_->UpdateCaretIndex(caretPosition);
480     }
481     void UpdateCaretPositionByTouch(const Offset& offset);
482     bool IsReachedBoundary(float offset);
483 
484     virtual int32_t GetRequestKeyboardId();
485 
486     virtual TextInputAction GetDefaultTextInputAction() const;
487     bool RequestKeyboardCrossPlatForm(bool isFocusViewChanged);
488     bool RequestKeyboard(bool isFocusViewChanged, bool needStartTwinkling, bool needShowSoftKeyboard,
489         SourceType sourceType = SourceType::NONE);
490     bool CloseKeyboard(bool forceClose) override;
491     bool CloseKeyboard(bool forceClose, bool isStopTwinkling);
492 
493     FocusPattern GetFocusPattern() const override;
494     void PerformAction(TextInputAction action, bool forceCloseKeyboard = false) override;
495     void UpdateEditingValue(const std::shared_ptr<TextEditingValue>& value, bool needFireChangeEvent = true) override;
496     void UpdateInputFilterErrorText(const std::u16string& errorText) override;
497     void UpdateInputFilterErrorText(const std::string& errorText) override;
498 
499     void OnValueChanged(bool needFireChangeEvent = true, bool needFireSelectChangeEvent = true) override;
500 
501     void OnHandleAreaChanged() override;
502 
503     void HandleCounterBorder();
504 
GetCaretIndex()505     int32_t GetCaretIndex() const override
506     {
507         return selectController_->GetCaretIndex();
508     }
509 
GetFirstHandleOffset()510     OffsetF GetFirstHandleOffset() const override
511     {
512         return selectController_->GetFirstHandleOffset();
513     }
514 
GetSecondHandleOffset()515     OffsetF GetSecondHandleOffset() const override
516     {
517         return selectController_->GetSecondHandleOffset();
518     }
519 
ACE_DEFINE_PROPERTY_ITEM_FUNC_WITHOUT_GROUP(TextInputAction,TextInputAction)520     ACE_DEFINE_PROPERTY_ITEM_FUNC_WITHOUT_GROUP(TextInputAction, TextInputAction)
521 
522     ACE_DEFINE_PROPERTY_ITEM_FUNC_WITHOUT_GROUP(AutoCapitalizationMode, AutoCapitalizationMode)
523 
524     const RefPtr<Paragraph>& GetParagraph() const
525     {
526         return paragraph_;
527     }
528 
GetCursorVisible()529     bool GetCursorVisible() const
530     {
531         return cursorVisible_;
532     }
533 
GetFloatingCursorVisible()534     bool GetFloatingCursorVisible() const
535     {
536         return floatCaretState_.FloatingCursorVisible;
537     }
538 
SetFloatingCursorVisible(bool floatingCursorVisible)539     void SetFloatingCursorVisible(bool floatingCursorVisible)
540     {
541         floatCaretState_.FloatingCursorVisible = floatingCursorVisible;
542     }
543 
ResetFloatingCursorState()544     void ResetFloatingCursorState()
545     {
546         floatCaretState_.Reset();
547     }
548 
549     void SetMagnifierLocalOffsetToFloatingCaretPos();
550 
GetShowOriginCursor()551     bool GetShowOriginCursor() const
552     {
553         return floatCaretState_.ShowOriginCursor;
554     }
555 
SetShowOriginCursor(bool showOriginCursor)556     void SetShowOriginCursor(bool showOriginCursor)
557     {
558         floatCaretState_.ShowOriginCursor = showOriginCursor;
559     }
560 
GetOriginCursorColor()561     Color GetOriginCursorColor() const
562     {
563         return floatCaretState_.OriginCursorColor;
564     }
565 
SetOriginCursorColor(Color originCursorColor)566     void SetOriginCursorColor(Color originCursorColor)
567     {
568         floatCaretState_.OriginCursorColor = originCursorColor;
569     }
570 
571     virtual void AdjustFloatingCaretInfo(const Offset& localOffset,
572         const HandleInfoNG& caretInfo, HandleInfoNG& floatingCaretInfo);
573 
574     void FloatingCaretLand();
575 
576 #if defined(OHOS_STANDARD_SYSTEM) && !defined(PREVIEW)
GetImeAttached()577     bool GetImeAttached() const
578     {
579         return imeAttached_;
580     }
581 #endif
582 
GetLastTouchOffset()583     const OffsetF& GetLastTouchOffset()
584     {
585         return lastTouchOffset_;
586     }
587 
GetCaretOffset()588     OffsetF GetCaretOffset() const override
589     {
590         return movingCaretOffset_;
591     }
592 
SetMovingCaretOffset(const OffsetF & offset)593     void SetMovingCaretOffset(const OffsetF& offset)
594     {
595         movingCaretOffset_ = offset;
596     }
597 
GetCaretUpdateType()598     CaretUpdateType GetCaretUpdateType() const
599     {
600         return caretUpdateType_;
601     }
602 
SetCaretUpdateType(CaretUpdateType type)603     void SetCaretUpdateType(CaretUpdateType type)
604     {
605         caretUpdateType_ = type;
606     }
607 
608     float GetPaddingTop() const;
609     float GetPaddingBottom() const;
610     float GetPaddingLeft() const;
611     float GetPaddingRight() const;
612 
613     float GetHorizontalPaddingAndBorderSum() const;
614 
615     float GetVerticalPaddingAndBorderSum() const;
616 
617     double GetPercentReferenceWidth() const;
618 
619     BorderWidthProperty GetBorderWidthProperty() const;
620     float GetBorderLeft(BorderWidthProperty border) const;
621     float GetBorderTop(BorderWidthProperty border) const;
622     float GetBorderBottom(BorderWidthProperty border) const;
623     float GetBorderRight(BorderWidthProperty border) const;
624 
625     void OnDragNodeDetachFromMainTree() override;
GetTextRect()626     const RectF& GetTextRect() const override
627     {
628         return textRect_;
629     }
630 
SetTextRect(const RectF & textRect)631     void SetTextRect(const RectF& textRect)
632     {
633         textRect_ = textRect;
634     }
635 
GetTextParagraphIndent()636     float GetTextParagraphIndent() const
637     {
638         return textParagraphIndent_;
639     }
640 
GetFrameRect()641     const RectF& GetFrameRect() const
642     {
643         return frameRect_;
644     }
645 
GetCountHeight()646     float GetCountHeight() const
647     {
648         return countHeight_;
649     }
650 
GetTextSelectController()651     const RefPtr<TextSelectController>& GetTextSelectController()
652     {
653         return selectController_;
654     }
655 
GetTextContentController()656     const RefPtr<ContentController>& GetTextContentController()
657     {
658         return contentController_;
659     }
660 
SetInSelectMode(SelectionMode selectionMode)661     void SetInSelectMode(SelectionMode selectionMode)
662     {
663         selectionMode_ = selectionMode;
664     }
665 
GetSelectMode()666     SelectionMode GetSelectMode() const
667     {
668         return selectionMode_;
669     }
670 
IsSelected()671     bool IsSelected() const override
672     {
673         return selectController_->IsSelected();
674     }
675 
IsUsingMouse()676     bool IsUsingMouse() const
677     {
678         return selectOverlay_->IsUsingMouse();
679     }
680     int32_t GetWordLength(int32_t originCaretPosition, int32_t directionalMove, bool skipNewLineChar = true);
681     int32_t GetLineBeginPosition(int32_t originCaretPosition, bool needToCheckLineChanged = true);
682     int32_t GetLineEndPosition(int32_t originCaretPosition, bool needToCheckLineChanged = true);
HasText()683     bool HasText() const
684     {
685         return !contentController_->IsEmpty();
686     }
687 
688     void CursorMove(CaretMoveIntent direction) override;
689     bool CursorMoveLeft();
690     bool CursorMoveLeftOperation();
691     bool CursorMoveLeftWord();
692     bool CursorMoveLineBegin();
693     bool CursorMoveToParagraphBegin();
694     bool CursorMoveHome();
695     bool CursorMoveRight();
696     bool CursorMoveRightOperation();
697     bool CursorMoveRightWord();
698     bool CursorMoveLineEnd();
699     bool CursorMoveToParagraphEnd();
700     bool CursorMoveEnd();
701     bool CursorMoveUp();
702     bool CursorMoveDown();
703     bool CursorMoveUpOperation();
704     bool CursorMoveDownOperation();
705     void SetCaretPosition(int32_t position, bool moveContent = true);
706     void SetCaretPositionMultiThread(int32_t position, bool moveContent = true);
707     void HandleSetSelection(int32_t start, int32_t end, bool showHandle = true) override;
708     void HandleSetSelectionMultiThread(int32_t start, int32_t end, bool showHandle = true);
709     void HandleExtendAction(int32_t action) override;
710     void HandleSelect(CaretMoveIntent direction) override;
711 
HandleSelectExtend(CaretMoveIntent direction)712     void HandleSelectExtend(CaretMoveIntent direction) override
713     {
714         HandleSelect(direction);
715     }
716 
717     OffsetF GetDragUpperLeftCoordinates() override;
718 
GetTextBoxes()719     std::vector<RectF> GetTextBoxes() override
720     {
721         return selectController_->GetSelectedRects();
722     }
723     std::vector<RectF> GetTextBoxesForSelect();
724     void AdjustSelectedBlankLineWidth(RectF& rect);
725     void ToJsonValue(std::unique_ptr<JsonValue>& json, const InspectorFilter& filter) const override;
726     void ToTreeJson(std::unique_ptr<JsonValue>& json, const InspectorConfig& config) const override;
727     void ToJsonValueForFontFeature(std::unique_ptr<JsonValue>& json, const InspectorFilter& filter) const;
728     void ToJsonValueForOption(std::unique_ptr<JsonValue>& json, const InspectorFilter& filter) const;
729     void ToJsonValueSelectOverlay(std::unique_ptr<JsonValue>& json, const InspectorFilter& filter) const;
730     void ToJsonValueForStroke(std::unique_ptr<JsonValue>& json, const InspectorFilter& filter) const;
731     void FromJson(const std::unique_ptr<JsonValue>& json) override;
732     void InitEditingValueText(std::u16string content);
733     bool InitValueText(std::u16string content);
734     void HandleButtonMouseEvent(const RefPtr<TextInputResponseArea>& responseArea, bool isHover);
735 
736     void CloseSelectOverlay() override;
737     void CloseSelectOverlay(bool animation);
SetInputMethodStatus(bool keyboardShown)738     void SetInputMethodStatus(bool keyboardShown) override
739     {
740 #if defined(OHOS_STANDARD_SYSTEM) && !defined(PREVIEW)
741         imeShown_ = keyboardShown;
742 #endif
743     }
744     void NotifyKeyboardClosedByUser() override;
745 
746     void NotifyKeyboardClosed() override;
747 
748     std::u16string GetLeftTextOfCursor(int32_t number) override;
749     std::u16string GetRightTextOfCursor(int32_t number) override;
750     int32_t GetTextIndexAtCursor() override;
751 
HasConnection()752     bool HasConnection() const
753     {
754 #if defined(OHOS_STANDARD_SYSTEM) && !defined(PREVIEW)
755         return imeShown_;
756 #else
757         return connection_;
758 #endif
759     }
760     float PreferredLineHeight(bool isAlgorithmMeasure = false);
761 
762     void SearchRequestKeyboard();
763 
764     bool RequestKeyboardNotByFocusSwitch(
765         RequestKeyboardReason reason = RequestKeyboardReason::UNKNOWN, SourceType sourceType = SourceType::NONE);
766 
767     bool TextFieldRequestFocus(RequestFocusReason reason = RequestFocusReason::UNKNOWN);
768 
769     static std::string RequestFocusReasonToString(RequestFocusReason reason);
770 
771     static std::string RequestKeyboardReasonToString(RequestKeyboardReason reason);
772 
GetTextObscured()773     bool GetTextObscured() const
774     {
775         return textObscured_;
776     }
777 
778     static std::u16string CreateObscuredText(int32_t len);
779     static std::u16string CreateDisplayText(
780         const std::u16string& content, int32_t nakedCharPosition, bool needObscureText, bool showPasswordDirectly);
781     bool IsTextArea() const override;
782 
GetTouchListener()783     const RefPtr<TouchEventImpl>& GetTouchListener()
784     {
785         return touchListener_;
786     }
787 
NeedShowPasswordIcon()788     bool NeedShowPasswordIcon()
789     {
790         auto layoutProperty = GetLayoutProperty<TextFieldLayoutProperty>();
791         CHECK_NULL_RETURN(layoutProperty, false);
792         return IsInPasswordMode() && layoutProperty->GetShowPasswordIconValue(true);
793     }
794 
SetEnableTouchAndHoverEffect(bool enable)795     void SetEnableTouchAndHoverEffect(bool enable)
796     {
797         enableTouchAndHoverEffect_ = enable;
798     }
799 
GetCaretRect()800     RectF GetCaretRect() const override
801     {
802         return selectController_->GetCaretRect();
803     }
804 
GetFloatingCaretRect()805     RectF GetFloatingCaretRect() const
806     {
807         return selectController_->GetFloatingCaretRect();
808     }
809 
810     void HandleSurfaceChanged(int32_t newWidth, int32_t newHeight, int32_t prevWidth, int32_t prevHeight);
811     void HandleSurfacePositionChanged(int32_t posX, int32_t posY);
812 
813     void InitSurfaceChangedCallback();
814     void InitSurfaceChangedCallbackMultiThread();
815     void InitSurfaceChangedCallbackMultiThreadAction();
816     void InitSurfacePositionChangedCallback();
817     void InitSurfacePositionChangedCallbackMultiThread();
818     void InitSurfacePositionChangedCallbackMultiThreadAction();
819 
HasSurfaceChangedCallback()820     bool HasSurfaceChangedCallback()
821     {
822         return surfaceChangedCallbackId_.has_value();
823     }
UpdateSurfaceChangedCallbackId(int32_t id)824     void UpdateSurfaceChangedCallbackId(int32_t id)
825     {
826         surfaceChangedCallbackId_ = id;
827     }
828 
HasSurfacePositionChangedCallback()829     bool HasSurfacePositionChangedCallback()
830     {
831         return surfacePositionChangedCallbackId_.has_value();
832     }
UpdateSurfacePositionChangedCallbackId(int32_t id)833     void UpdateSurfacePositionChangedCallbackId(int32_t id)
834     {
835         surfacePositionChangedCallbackId_ = id;
836     }
837 
838     void ProcessInnerPadding();
839     void ProcessNumberOfLines();
840     void OnCursorMoveDone(
841         TextAffinity textAffinity = TextAffinity::UPSTREAM, std::optional<Offset> offset = std::nullopt);
842     bool IsDisabled();
843     bool AllowCopy();
844 
GetIsMousePressed()845     bool GetIsMousePressed() const
846     {
847         return isMousePressed_;
848     }
849 
GetMouseStatus()850     MouseStatus GetMouseStatus() const
851     {
852         return mouseStatus_;
853     }
854 
855     void UpdateEditingValueToRecord(int32_t beforeCaretPosition = -1);
856 
857     void UpdateScrollBarOffset() override;
858 
UpdateCurrentOffset(float offset,int32_t source)859     bool UpdateCurrentOffset(float offset, int32_t source) override
860     {
861         OnScrollCallback(offset, source);
862         return true;
863     }
864 
865     void PlayScrollBarAppearAnimation();
866 
867     void ScheduleDisappearDelayTask();
868 
IsAtTop()869     bool IsAtTop() const override
870     {
871         return contentRect_.GetY() == textRect_.GetY();
872     }
873 
874     bool IsAtBottom(bool considerRepeat = false) const override
875     {
876         return contentRect_.GetY() + contentRect_.Height() == textRect_.GetY() + textRect_.Height();
877     }
878 
IsScrollable()879     bool IsScrollable() const override
880     {
881         return scrollable_;
882     }
883 
IsAtomicNode()884     bool IsAtomicNode() const override
885     {
886         return true;
887     }
888 
GetCurrentOffset()889     float GetCurrentOffset() const
890     {
891         return currentOffset_;
892     }
893 
GetContentModifier()894     RefPtr<TextFieldContentModifier> GetContentModifier()
895     {
896         return textFieldContentModifier_;
897     }
898 
899     double GetScrollBarWidth();
900 
GetLineHeight()901     float GetLineHeight() const override
902     {
903         return selectController_->GetCaretRect().Height();
904     }
905 
GetParentGlobalOffset()906     OffsetF GetParentGlobalOffset() const override
907     {
908         return parentGlobalOffset_;
909     }
910 
911     RectF GetTextContentRect(bool isActualText = false) const override
912     {
913         return contentRect_;
914     }
915 
GetKeyboardOverLay()916     const RefPtr<OverlayManager>& GetKeyboardOverLay()
917     {
918         return keyboardOverlay_;
919     }
920 
GetIsCustomKeyboardAttached()921     bool GetIsCustomKeyboardAttached()
922     {
923         return isCustomKeyboardAttached_;
924     }
925 
GetDragParagraph()926     const RefPtr<Paragraph>& GetDragParagraph() const override
927     {
928         return paragraph_;
929     }
930 
MoveDragNode()931     const RefPtr<FrameNode>& MoveDragNode() override
932     {
933         return dragNode_;
934     }
935 
GetDragContents()936     const std::vector<std::u16string>& GetDragContents() const
937     {
938         return dragContents_;
939     }
940 
IsDragging()941     bool IsDragging() const
942     {
943         return dragStatus_ == DragStatus::DRAGGING;
944     }
945 
946     bool BetweenSelectedPosition(GestureEvent& info);
947 
948     bool BetweenSelectedPosition(const Offset& globalOffset) override;
949 
950     bool RequestCustomKeyboard();
951     bool CloseCustomKeyboard();
952 
953     // xts
954     std::string GetStrokeWidth() const;
955     std::string GetStrokeColor() const;
956     std::string TextInputTypeToString() const;
957     std::string TextInputActionToString() const;
958     std::string AutoCapTypeToString() const;
959     std::string TextContentTypeToString() const;
960     virtual std::string GetPlaceholderFont() const;
961     RefPtr<TextFieldTheme> GetTheme() const;
962     void InitTheme();
963     std::string GetTextColor() const;
964     std::string GetCaretColor() const;
965     std::string GetPlaceholderColor() const;
966     std::string GetFontSize() const;
967     std::string GetMinFontSize() const;
968     std::string GetMaxFontSize() const;
969     std::string GetMinFontScale() const;
970     std::string GetMaxFontScale() const;
971     std::string GetEllipsisMode() const;
972     std::string GetTextIndent() const;
973     Ace::FontStyle GetItalicFontStyle() const;
974     FontWeight GetFontWeight() const;
975     std::string GetFontFamily() const;
976     TextAlign GetTextAlign() const;
977     std::u16string GetPlaceHolder() const;
978     uint32_t GetMaxLength() const;
979     uint32_t GetMaxLines() const;
980     uint32_t GetMinLines() const;
981     std::string GetInputFilter() const;
982     std::string GetCopyOptionString() const;
983     std::string GetInputStyleString() const;
984     std::u16string GetErrorTextString() const;
985     std::string GetBarStateString() const;
986     bool GetErrorTextState() const;
987     std::string GetShowPasswordIconString() const;
988     int32_t GetNakedCharPosition() const;
989     void SetSelectionFlag(int32_t selectionStart, int32_t selectionEnd,
990         const std::optional<SelectionOptions>& options = std::nullopt, bool isForward = false);
991     void SetSelectionFlagMultiThread(int32_t selectionStart, int32_t selectionEnd,
992         const std::optional<SelectionOptions>& options = std::nullopt, bool isForward = false);
993     void SetSelection(int32_t start, int32_t end,
994         const std::optional<SelectionOptions>& options = std::nullopt, bool isForward = false) override;
995     void HandleBlurEvent();
996     void HandleFocusEvent();
997     void SetFocusStyle();
998     void ClearFocusStyle();
999     void ProcessFocusStyle();
1000     bool OnBackPressed() override;
1001     bool IsStopBackPress() const override;
1002     void CheckScrollable();
1003     void HandleClickEvent(GestureEvent& info);
1004     bool CheckMousePressedOverScrollBar(GestureEvent& info);
1005     int32_t CheckClickLocation(GestureEvent& info);
1006     void HandleDoubleClickEvent(GestureEvent& info);
1007     void HandleTripleClickEvent(GestureEvent& info);
1008     void HandleSingleClickEvent(GestureEvent& info, bool firstGetFocus = false);
1009     bool HandleBetweenSelectedPosition(const GestureEvent& info);
1010 
1011     bool CheckAttachInput();
1012     void HandleSelectionUp();
1013     void HandleSelectionDown();
1014     void HandleSelectionLeft();
1015     void HandleSelectionLeftWord();
1016     void HandleSelectionLineBegin();
1017     void HandleSelectionHome();
1018     void HandleSelectionParagraghBegin();
1019     void HandleSelectionRight();
1020     void HandleSelectionRightWord();
1021     void HandleSelectionLineEnd();
1022     void HandleSelectionEnd();
1023     void HandleSelectionParagraghEnd();
1024     bool HandleOnEscape() override;
1025     bool HandleOnTab(bool backward) override;
HandleOnEnter()1026     void HandleOnEnter() override
1027     {
1028         PerformAction(GetTextInputActionValue(GetDefaultTextInputAction()), false);
1029     }
1030     void HandleOnUndoAction() override;
1031 
HandleOnExtendUndoAction()1032     void HandleOnExtendUndoAction() override
1033     {
1034         HandleOnUndoAction();
1035     }
1036 
1037     void HandleOnRedoAction() override;
1038     bool CanUndo();
1039     bool HasOperationRecords();
1040     bool CanRedo();
1041     void HandleOnSelectAll(bool isKeyEvent, bool inlineStyle = false, bool showMenu = false);
HandleOnSelectAll()1042     void HandleOnSelectAll() override
1043     {
1044         HandleOnSelectAll(true);
1045     }
1046     void HandleOnCopy(bool isUsingExternalKeyboard = false) override;
1047     void HandleOnPaste() override;
1048     void HandleOnCut() override;
1049     bool IsShowTranslate();
1050     bool IsShowSearch();
1051     void HandleOnCameraInput();
1052     void HandleOnAIWrite();
1053     void GetAIWriteInfo(AIWriteInfo& info);
1054     bool IsShowAIWrite();
1055     void HandleAIWriteResult(int32_t start, int32_t end, std::vector<uint8_t>& buffer);
1056     void UpdateShowCountBorderStyle();
1057     void StripNextLine(std::wstring& data);
1058     bool IsShowHandle();
1059     std::string GetCancelButton();
1060     std::string GetCancelImageText();
1061     std::string GetPasswordIconPromptInformation(bool show);
1062     bool OnKeyEvent(const KeyEvent& event);
1063     size_t GetLineCount() const override;
GetKeyboard()1064     TextInputType GetKeyboard()
1065     {
1066         return keyboard_;
1067     }
GetAction()1068     TextInputAction GetAction()
1069     {
1070         return action_;
1071     }
1072 
SetNeedToRequestKeyboardOnFocus(bool needToRequest)1073     void SetNeedToRequestKeyboardOnFocus(bool needToRequest)
1074     {
1075         needToRequestKeyboardOnFocus_ = needToRequest;
1076     }
1077     void SetUnitNode(const RefPtr<NG::UINode>& unitNode);
1078     void AddCounterNode();
1079     void SetShowError();
1080 
GetUnderlineWidth()1081     float GetUnderlineWidth() const
1082     {
1083         return static_cast<float>(underlineWidth_.Value());
1084     }
1085 
GetUnderlineColor()1086     const Color& GetUnderlineColor() const
1087     {
1088         return underlineColor_;
1089     }
1090 
1091     float GetMarginBottom() const;
1092 
SetUnderlineColor(Color underlineColor)1093     void SetUnderlineColor(Color underlineColor)
1094     {
1095         underlineColor_ = underlineColor;
1096     }
1097 
SetTypingUnderlineColor(const Color & normalColor)1098     void SetTypingUnderlineColor(const Color& normalColor)
1099     {
1100         userUnderlineColor_.typing = normalColor;
1101     }
1102 
ResetTypingUnderlineColor()1103     void ResetTypingUnderlineColor()
1104     {
1105         userUnderlineColor_.typing = std::nullopt;
1106     }
1107 
SetNormalUnderlineColor(const Color & normalColor)1108     void SetNormalUnderlineColor(const Color& normalColor)
1109     {
1110         userUnderlineColor_.normal = normalColor;
1111     }
1112 
ResetNormalUnderlineColor()1113     void ResetNormalUnderlineColor()
1114     {
1115         userUnderlineColor_.normal = std::nullopt;
1116     }
1117 
SetErrorUnderlineColor(const Color & normalColor)1118     void SetErrorUnderlineColor(const Color& normalColor)
1119     {
1120         userUnderlineColor_.error = normalColor;
1121     }
1122 
ResetErrorUnderlineColor()1123     void ResetErrorUnderlineColor()
1124     {
1125         userUnderlineColor_.error = std::nullopt;
1126     }
1127 
SetDisableUnderlineColor(const Color & normalColor)1128     void SetDisableUnderlineColor(const Color& normalColor)
1129     {
1130         userUnderlineColor_.disable = normalColor;
1131     }
1132 
ResetDisableUnderlineColor()1133     void ResetDisableUnderlineColor()
1134     {
1135         userUnderlineColor_.disable = std::nullopt;
1136     }
1137 
SetUserUnderlineColor(UserUnderlineColor userUnderlineColor)1138     void SetUserUnderlineColor(UserUnderlineColor userUnderlineColor)
1139     {
1140         userUnderlineColor_ = userUnderlineColor;
1141     }
1142 
GetUserUnderlineColor()1143     UserUnderlineColor GetUserUnderlineColor()
1144     {
1145         return userUnderlineColor_;
1146     }
1147 
SetUnderlineWidth(Dimension underlineWidth)1148     void SetUnderlineWidth(Dimension underlineWidth)
1149     {
1150         underlineWidth_ = underlineWidth;
1151     }
1152 
IsSelectAll()1153     bool IsSelectAll()
1154     {
1155         return abs(selectController_->GetStartIndex() - selectController_->GetEndIndex()) >=
1156                static_cast<int32_t>(contentController_->GetTextUtf16Value().length());
1157     }
1158 
1159     void StopEditing();
1160     void StopEditingMultiThread();
1161     void StopEditingMultiThreadAction();
1162 
MarkContentChange()1163     void MarkContentChange()
1164     {
1165         contChange_ = true;
1166     }
1167 
ResetContChange()1168     void ResetContChange()
1169     {
1170         contChange_ = false;
1171     }
1172 
GetContChange()1173     bool GetContChange() const
1174     {
1175         return contChange_;
1176     }
1177     std::string GetShowResultImageSrc() const;
1178     std::string GetHideResultImageSrc() const;
1179     std::string GetNormalUnderlineColorStr() const;
1180     std::string GetTypingUnderlineColorStr() const;
1181     std::string GetDisableUnderlineColorStr() const;
1182     std::string GetErrorUnderlineColorStr() const;
1183     void OnAttachToFrameNode() override;
1184     void OnAttachToFrameNodeMultiThread();
1185 
GetTextInputFlag()1186     bool GetTextInputFlag() const
1187     {
1188         return isTextInput_;
1189     }
1190 
SetTextInputFlag(bool isTextInput)1191     void SetTextInputFlag(bool isTextInput)
1192     {
1193         isTextInput_ = isTextInput;
1194         SetTextFadeoutCapacity(isTextInput_);
1195     }
1196 
SetSingleLineHeight(float height)1197     void SetSingleLineHeight(float height)
1198     {
1199         inlineSingleLineHeight_ = height;
1200     }
1201 
GetSingleLineHeight()1202     float GetSingleLineHeight() const
1203     {
1204         return inlineSingleLineHeight_;
1205     }
1206 
GetInlinePadding()1207     float GetInlinePadding() const
1208     {
1209         return inlinePadding_;
1210     }
1211 
GetScrollBarVisible()1212     bool GetScrollBarVisible() const
1213     {
1214         return scrollBarVisible_;
1215     }
1216 
SetFillRequestFinish(bool success)1217     void SetFillRequestFinish(bool success)
1218     {
1219         isFillRequestFinish_ = success;
1220     }
1221 
IsFillRequestFinish()1222     bool IsFillRequestFinish()
1223     {
1224         return isFillRequestFinish_;
1225     }
1226 
1227     bool IsNormalInlineState() const;
1228     bool IsUnspecifiedOrTextType() const;
1229     void TextIsEmptyRect(RectF& rect);
1230     void TextAreaInputRectUpdate(RectF& rect);
1231     void UpdateRectByTextAlign(RectF& rect);
1232 
1233     void EditingValueFilterChange();
1234 
1235     void SetCustomKeyboard(const std::function<void()>&& keyboardBuilder);
1236 
1237     void SetCustomKeyboardWithNode(const RefPtr<UINode>& keyboardBuilder);
1238     void SetCustomKeyboardWithNodeMultiThread(const RefPtr<UINode>& keyboardBuilder);
1239     void SetCustomKeyboardWithNodeMultiThreadAction(const RefPtr<UINode>& keyboardBuilder);
1240 
HasCustomKeyboard()1241     bool HasCustomKeyboard() const
1242     {
1243         return customKeyboard_ != nullptr || customKeyboardBuilder_ != nullptr;
1244     }
1245 
1246     void DumpInfo() override;
DumpSimplifyInfo(std::shared_ptr<JsonValue> & json)1247     void DumpSimplifyInfo(std::shared_ptr<JsonValue>& json) override {}
1248     void DumpAdvanceInfo() override;
1249     void DumpPlaceHolderInfo();
1250     void DumpTextEngineInfo();
1251     void DumpScaleInfo();
1252     std::string GetDumpTextValue() const;
1253     void DumpViewDataPageNode(RefPtr<ViewDataWrap> viewDataWrap, bool needsRecordData = false) override;
1254     void NotifyFillRequestSuccess(RefPtr<ViewDataWrap> viewDataWrap,
1255         RefPtr<PageNodeInfoWrap> nodeWrap, AceAutoFillType autoFillType) override;
1256     void NotifyFillRequestFailed(int32_t errCode, const std::string& fillContent = "", bool isPopup = false) override;
1257     bool CheckAutoSave() override;
1258     void OnColorConfigurationUpdate() override;
1259     bool NeedPaintSelect();
1260     void SetCustomKeyboardOption(bool supportAvoidance);
1261 
SetIsCustomFont(bool isCustomFont)1262     void SetIsCustomFont(bool isCustomFont)
1263     {
1264         isCustomFont_ = isCustomFont;
1265     }
1266 
GetIsCustomFont()1267     bool GetIsCustomFont() const
1268     {
1269         return isCustomFont_;
1270     }
1271 
SetIsCounterIdealHeight(bool isIdealHeight)1272     void SetIsCounterIdealHeight(bool isIdealHeight)
1273     {
1274         isCounterIdealheight_ = isIdealHeight;
1275     }
1276 
GetIsCounterIdealHeight()1277     bool GetIsCounterIdealHeight() const
1278     {
1279         return isCounterIdealheight_;
1280     }
1281 
1282     virtual RefPtr<FocusHub> GetFocusHub() const;
1283     void UpdateCaretInfoToController(bool forceUpdate = false);
1284     void OnObscuredChanged(bool isObscured);
GetResponseArea()1285     const RefPtr<TextInputResponseArea>& GetResponseArea()
1286     {
1287         return responseArea_;
1288     }
1289 
GetCleanNodeResponseArea()1290     const RefPtr<TextInputResponseArea>& GetCleanNodeResponseArea()
1291     {
1292         return cleanNodeResponseArea_;
1293     }
1294 
1295     bool IsShowUnit() const;
1296     bool IsShowPasswordIcon() const;
1297     std::optional<bool> IsShowPasswordText() const;
1298     bool IsInPasswordMode() const;
1299     bool IsShowCancelButtonMode() const;
1300     void CheckPasswordAreaState();
1301 
GetShowSelect()1302     bool GetShowSelect() const
1303     {
1304         return showSelect_;
1305     }
1306 
ShowSelect()1307     void ShowSelect()
1308     {
1309         showSelect_ = true;
1310     }
1311 
1312     void FocusForwardStopTwinkling();
1313     bool UpdateFocusForward();
1314 
1315     bool UpdateFocusBackward();
1316 
1317     bool HandleSpaceEvent();
1318 
1319     virtual void ApplyNormalTheme();
1320     void ApplyUnderlineTheme();
1321     void ApplyInlineTheme();
1322 
GetContentWideTextLength()1323     int32_t GetContentWideTextLength() override
1324     {
1325         return static_cast<int32_t>(contentController_->GetTextUtf16Value().length());
1326     }
1327 
HandleOnShowMenu()1328     void HandleOnShowMenu() override
1329     {
1330         selectOverlay_->HandleOnShowMenu();
1331     }
1332     bool HasFocus() const;
1333     void StopTwinkling();
1334     void StartTwinkling();
1335 
IsModifyDone()1336     bool IsModifyDone()
1337     {
1338         return isModifyDone_;
1339     }
SetModifyDoneStatus(bool value)1340     void SetModifyDoneStatus(bool value)
1341     {
1342         isModifyDone_ = value;
1343     }
1344 
GetLastClickTime()1345     const TimeStamp& GetLastClickTime()
1346     {
1347         return lastClickTimeStamp_;
1348     }
1349 
1350     void CheckTextAlignByDirection(TextAlign& textAlign, TextDirection direction);
1351 
1352     void HandleOnDragStatusCallback(
1353         const DragEventType& dragEventType, const RefPtr<NotifyDragEvent>& notifyDragEvent) override;
1354 
1355     void GetCaretMetrics(CaretMetricsF& caretCaretMetric) override;
1356 
1357     OffsetF GetTextPaintOffset() const override;
1358 
1359     OffsetF GetPaintRectGlobalOffset() const;
1360 
NeedRequestKeyboard()1361     void NeedRequestKeyboard()
1362     {
1363         SetNeedToRequestKeyboardInner(true, RequestKeyboardInnerChangeReason::SEARCH_FOCUS);
1364     }
1365 
1366     void SetNeedToRequestKeyboardInner(bool needToRequestKeyboardInner,
1367         RequestKeyboardInnerChangeReason reason = RequestKeyboardInnerChangeReason::UNKNOWN);
1368 
1369     void CleanNodeResponseKeyEvent();
1370 
1371     void ScrollPage(bool reverse, bool smooth = false,
1372         AccessibilityScrollType scrollType = AccessibilityScrollType::SCROLL_FULL) override;
InitScrollBarClickEvent()1373     void InitScrollBarClickEvent() override {}
1374     void ClearTextContent();
1375     bool IsUnderlineMode() const;
1376     bool IsInlineMode() const;
1377     bool IsShowError();
1378     bool IsShowCount();
1379     void ResetContextAttr();
1380     void RestoreDefaultMouseState();
1381 
RegisterWindowSizeCallback()1382     inline void RegisterWindowSizeCallback()
1383     {
1384         auto host = GetHost();
1385         // call RegisterWindowSizeCallbackMultiThread() by multi thread
1386         FREE_NODE_CHECK(host, RegisterWindowSizeCallback);
1387         if (isOritationListenerRegisted_) {
1388             return;
1389         }
1390         isOritationListenerRegisted_ = true;
1391         CHECK_NULL_VOID(host);
1392         auto pipeline = host->GetContext();
1393         CHECK_NULL_VOID(pipeline);
1394         pipeline->AddWindowSizeChangeCallback(host->GetId());
1395     }
1396 
1397     void RegisterWindowSizeCallbackMultiThread();
1398     void RegisterWindowSizeCallbackMultiThreadAction();
1399 
1400     void OnWindowSizeChanged(int32_t width, int32_t height, WindowSizeChangeReason type) override;
1401 
IsTransparent()1402     bool IsTransparent()
1403     {
1404         return isTransparent_;
1405     }
1406 
GetClipboard()1407     RefPtr<Clipboard> GetClipboard() override
1408     {
1409         if (!clipboard_) {
1410             auto host = GetHost();
1411             CHECK_NULL_RETURN(host, clipboard_);
1412             auto context = host->GetContext();
1413             CHECK_NULL_RETURN(context, clipboard_);
1414             clipboard_ = ClipboardProxy::GetInstance()->GetClipboard(context->GetTaskExecutor());
1415         }
1416         return clipboard_;
1417     }
1418 
1419     const Dimension& GetAvoidSoftKeyboardOffset() const override;
1420 
GetPaintContentRect()1421     RectF GetPaintContentRect() override
1422     {
1423         auto transformContentRect = contentRect_;
1424         selectOverlay_->GetLocalRectWithTransform(transformContentRect);
1425         return transformContentRect;
1426     }
1427 
1428     bool ProcessAutoFill(bool& isPopup, bool isFromKeyBoard = false, bool isNewPassWord = false);
SetAutoFillUserName(const std::string & userName)1429     void SetAutoFillUserName(const std::string& userName)
1430     {
1431         autoFillUserName_ = userName;
1432     }
1433 
GetAutoFillUserName()1434     std::string GetAutoFillUserName()
1435     {
1436         return autoFillUserName_;
1437     }
1438 
GetAutoFillNewPassword()1439     std::string GetAutoFillNewPassword()
1440     {
1441         return autoFillNewPassword_;
1442     }
1443 
SetAutoFillNewPassword(const std::string & newPassword)1444     void SetAutoFillNewPassword(const std::string& newPassword)
1445     {
1446         autoFillNewPassword_ = newPassword;
1447     }
SetAutoFillOtherAccount(bool otherAccount)1448     void SetAutoFillOtherAccount(bool otherAccount)
1449     {
1450         autoFillOtherAccount_ = otherAccount;
1451     }
1452 
1453     std::vector<RectF> GetPreviewTextRects() const;
1454 
GetIsPreviewText()1455     bool GetIsPreviewText() const
1456     {
1457         return hasPreviewText_;
1458     }
1459 
GetPreviewDecorationColor()1460     const Color& GetPreviewDecorationColor() const
1461     {
1462         auto theme = GetTheme();
1463         CHECK_NULL_RETURN(theme, Color::TRANSPARENT);
1464         return theme->GetPreviewUnderlineColor();
1465     }
1466 
1467     bool NeedDrawPreviewText();
1468 
GetPreviewUnderlineWidth()1469     float GetPreviewUnderlineWidth() const
1470     {
1471         return static_cast<float>(previewUnderlineWidth_.ConvertToPx());
1472     }
1473 
1474     void ReceivePreviewTextStyle(const std::string& style) override;
1475 
1476     PreviewTextStyle GetPreviewTextStyle() const;
1477 
GetCustomKeyboard()1478     RefPtr<UINode> GetCustomKeyboard()
1479     {
1480         return customKeyboard_;
1481     }
1482 
GetCustomKeyboardOption()1483     bool GetCustomKeyboardOption()
1484     {
1485         return keyboardAvoidance_;
1486     }
1487 
1488     void SetShowKeyBoardOnFocus(bool value);
1489     void SetShowKeyBoardOnFocusMultiThread(bool value);
GetShowKeyBoardOnFocus()1490     bool GetShowKeyBoardOnFocus()
1491     {
1492         return showKeyBoardOnFocus_;
1493     }
1494 
1495     void OnSelectionMenuOptionsUpdate(const NG::OnCreateMenuCallback&& onCreateMenuCallback,
1496         const NG::OnMenuItemClickCallback&& onMenuItemClick, const NG::OnPrepareMenuCallback&& onPrepareMenuCallback);
1497 
OnCreateMenuCallbackUpdate(const NG::OnCreateMenuCallback && onCreateMenuCallback)1498     void OnCreateMenuCallbackUpdate(const NG::OnCreateMenuCallback&& onCreateMenuCallback)
1499     {
1500         selectOverlay_->OnCreateMenuCallbackUpdate(std::move(onCreateMenuCallback));
1501     }
1502 
OnMenuItemClickCallbackUpdate(const NG::OnMenuItemClickCallback && onMenuItemClick)1503     void OnMenuItemClickCallbackUpdate(const NG::OnMenuItemClickCallback&& onMenuItemClick)
1504     {
1505         selectOverlay_->OnMenuItemClickCallbackUpdate(std::move(onMenuItemClick));
1506     }
1507 
OnPrepareMenuCallbackUpdate(const NG::OnPrepareMenuCallback && onPrepareMenuCallback)1508     void OnPrepareMenuCallbackUpdate(const NG::OnPrepareMenuCallback&& onPrepareMenuCallback)
1509     {
1510         selectOverlay_->OnPrepareMenuCallbackUpdate(std::move(onPrepareMenuCallback));
1511     }
1512 
SetSupportPreviewText(bool isSupported)1513     void SetSupportPreviewText(bool isSupported)
1514     {
1515         hasSupportedPreviewText_ = isSupported;
1516     }
1517 
GetSupportPreviewText()1518     bool GetSupportPreviewText() const
1519     {
1520         return hasSupportedPreviewText_;
1521     }
1522 
GetPreviewTextStart()1523     int32_t GetPreviewTextStart() const
1524     {
1525         return hasPreviewText_ ? previewTextStart_ : selectController_->GetCaretIndex();
1526     }
1527 
GetPreviewTextEnd()1528     int32_t GetPreviewTextEnd() const
1529     {
1530         return hasPreviewText_ ? previewTextEnd_ : selectController_->GetCaretIndex();
1531     }
1532 
GetPreviewTextValue()1533     std::u16string GetPreviewTextValue() const
1534     {
1535         return contentController_->GetSelectedValue(GetPreviewTextStart(), GetPreviewTextEnd());
1536     }
1537 
GetBodyTextValue()1538     std::u16string GetBodyTextValue() const
1539     {
1540         return hasPreviewText_ ? bodyTextInPreivewing_ : GetTextUtf16Value();
1541     }
1542 
IsPressSelectedBox()1543     bool IsPressSelectedBox()
1544     {
1545         return isPressSelectedBox_;
1546     }
1547 
1548     int32_t CheckPreviewTextValidate(const std::string& previewValue, const PreviewRange range) override;
1549     int32_t CheckPreviewTextValidate(const std::u16string& previewValue, const PreviewRange range) override;
1550     void HiddenMenu();
1551 
OnFrameNodeChanged(FrameNodeChangeInfoFlag flag)1552     void OnFrameNodeChanged(FrameNodeChangeInfoFlag flag) override
1553     {
1554         selectOverlay_->OnAncestorNodeChanged(flag);
1555     }
1556 
GetSelectIndex(int32_t & start,int32_t & end)1557     void GetSelectIndex(int32_t& start, int32_t& end) const override
1558     {
1559         start = selectController_->GetStartIndex();
1560         end = selectController_->GetEndIndex();
1561     }
1562 
SetTextChangedAtCreation(bool changed)1563     void SetTextChangedAtCreation(bool changed)
1564     {
1565         isTextChangedAtCreation_ = changed;
1566     }
1567 
SetIsPasswordSymbol(bool isPasswordSymbol)1568     void SetIsPasswordSymbol(bool isPasswordSymbol)
1569     {
1570         isPasswordSymbol_ = isPasswordSymbol;
1571     }
1572 
IsShowPasswordSymbol()1573     bool IsShowPasswordSymbol() const
1574     {
1575         return isPasswordSymbol_ && Container::GreatOrEqualAPITargetVersion(PlatformVersion::VERSION_THIRTEEN);
1576     }
1577 
1578     bool IsResponseRegionExpandingNeededForStylus(const TouchEvent& touchEvent) const override;
1579 
1580     RectF ExpandDefaultResponseRegion(RectF& rect) override;
1581 
UpdateParentGlobalOffset()1582     void UpdateParentGlobalOffset()
1583     {
1584         parentGlobalOffset_ = GetPaintRectGlobalOffset();
1585     }
1586 
1587     PositionWithAffinity GetGlyphPositionAtCoordinate(int32_t x, int32_t y) override;
1588 
1589     bool InsertOrDeleteSpace(int32_t index) override;
1590 
1591     void DeleteRange(int32_t start, int32_t end, bool isIME = true) override;
1592 
1593     void DeleteTextRange(int32_t start, int32_t end, TextDeleteDirection direction);
1594 
1595     bool SetCaretOffset(int32_t caretPostion) override;
1596 
GetOrCreateMultipleClickRecognizer()1597     const RefPtr<MultipleClickRecognizer>& GetOrCreateMultipleClickRecognizer()
1598     {
1599         if (!multipleClickRecognizer_) {
1600             multipleClickRecognizer_ = MakeRefPtr<MultipleClickRecognizer>();
1601         }
1602         return multipleClickRecognizer_;
1603     }
1604 
SetAdaptFontSize(const std::optional<Dimension> & adaptFontSize)1605     void SetAdaptFontSize(const std::optional<Dimension>& adaptFontSize)
1606     {
1607         adaptFontSize_ = adaptFontSize;
1608     }
1609 
1610     void ShowCaretAndStopTwinkling();
1611 
1612     void TriggerAvoidOnCaretChange();
1613 
1614     void TriggerAvoidWhenCaretGoesDown();
1615 
1616     bool CheckIfNeedAvoidOnCaretChange(float caretPos);
1617 
1618     bool IsTextEditableForStylus() const override;
1619     bool IsHandleDragging();
IsLTRLayout()1620     bool IsLTRLayout()
1621     {
1622         auto host = GetHost();
1623         CHECK_NULL_RETURN(host, true);
1624         return host->GetLayoutProperty()->GetNonAutoLayoutDirection() == TextDirection::LTR;
1625     }
1626 
GetLastCaretPos()1627     std::optional<float> GetLastCaretPos() const
1628     {
1629         return lastCaretPos_;
1630     }
1631 
SetLastCaretPos(float lastCaretPos)1632     void SetLastCaretPos(float lastCaretPos)
1633     {
1634         lastCaretPos_ = lastCaretPos;
1635     }
1636 
SetEnableHapticFeedback(bool isEnabled)1637     void SetEnableHapticFeedback(bool isEnabled)
1638     {
1639         isEnableHapticFeedback_ = isEnabled;
1640     }
1641 
GetEnableHapticFeedback()1642     bool GetEnableHapticFeedback() const
1643     {
1644         return isEnableHapticFeedback_;
1645     }
1646 
SetIsFocusedBeforeClick(bool isFocusedBeforeClick)1647     void SetIsFocusedBeforeClick(bool isFocusedBeforeClick)
1648     {
1649         isFocusedBeforeClick_ = isFocusedBeforeClick;
1650     }
1651 
1652     void StartVibratorByIndexChange(int32_t currentIndex, int32_t preIndex);
1653     virtual void ProcessSelection();
1654     void AfterLayoutProcessCleanResponse(
1655         const RefPtr<CleanNodeResponseArea>& cleanNodeResponseArea);
1656     void StopContentScroll();
1657     void UpdateContentScroller(const Offset& localOffset, float delay = 0.0f, bool enableScrollOutside = true);
1658     Offset AdjustAutoScrollOffset(const Offset& offset);
SetIsInitTextRect(bool isInitTextRect)1659     void SetIsInitTextRect(bool isInitTextRect)
1660     {
1661         initTextRect_ = isInitTextRect;
1662     }
1663 
1664     virtual float FontSizeConvertToPx(const Dimension& fontSize);
1665 
1666     SelectionInfo GetSelection();
1667 
GetContentScrollerIsScrolling()1668     bool GetContentScrollerIsScrolling() const
1669     {
1670         return contentScroller_.isScrolling;
1671     }
1672 
SetTextFadeoutCapacity(bool enabled)1673     void SetTextFadeoutCapacity(bool enabled)
1674     {
1675         haveTextFadeoutCapacity_ = enabled;
1676     }
GetTextFadeoutCapacity()1677     bool GetTextFadeoutCapacity()
1678     {
1679         return haveTextFadeoutCapacity_;
1680     }
1681 
SetHoverPressBgColorEnabled(bool enabled)1682     void SetHoverPressBgColorEnabled(bool enabled)
1683     {
1684         hoverAndPressBgColorEnabled_ = enabled;
1685     }
1686 
1687     bool GetOriginCaretPosition(OffsetF& offset) const;
1688     void ResetOriginCaretPosition() override;
1689     bool RecordOriginCaretPosition() override;
1690     void AddInsertCommand(const std::u16string& insertValue, InputReason reason);
1691     void AddInputCommand(const InputCommandInfo& inputCommandInfo);
1692     void ExecuteInputCommand(const InputCommandInfo& inputCommandInfo);
1693     void FilterInitializeText();
SetIsFilterChanged(bool isFilterChanged)1694     void SetIsFilterChanged(bool isFilterChanged)
1695     {
1696         isFilterChanged_ = isFilterChanged;
1697     }
GetCancelButtonTouchInfo()1698     bool GetCancelButtonTouchInfo()
1699     {
1700         return cancelButtonTouched_;
1701     }
1702 
IsUnderlineAndButtonMode()1703     bool IsUnderlineAndButtonMode() const
1704     {
1705         auto layoutProperty = GetLayoutProperty<TextFieldLayoutProperty>();
1706         CHECK_NULL_RETURN(layoutProperty, false);
1707         auto cleanNodeStyle = layoutProperty->GetCleanNodeStyle().value_or(CleanNodeStyle::INPUT);
1708         auto isCancelMode = IsShowCancelButtonMode() && !(cleanNodeStyle == CleanNodeStyle::INVISIBLE);
1709         return IsUnderlineMode() && (isCancelMode || IsInPasswordMode());
1710     }
1711 
SetKeyboardAppearanceConfig(const KeyboardAppearanceConfig & config)1712     void SetKeyboardAppearanceConfig(const KeyboardAppearanceConfig& config)
1713     {
1714         imeGradientMode_ = config.gradientMode;
1715         imeFluidLightMode_ = config.fluidLightMode;
1716     }
1717 
1718     void UpdatePropertyImpl(const std::string& key, RefPtr<PropertyValueBase> value) override;
1719     void UpdateBorderResource() override;
1720     void UpdateMarginResource() override;
1721     void SetBackBorderRadius();
1722     void OnColorModeChange(uint32_t colorMode) override;
1723 
1724     void ProcessDefaultStyleAndBehaviors();
1725     void ProcessDefaultStyleAndBehaviorsMultiThread();
1726 
1727     void ProcessResponseArea();
AddContentScrollingCallback(std::function<void (const Offset &)> && callback)1728     void AddContentScrollingCallback(std::function<void(const Offset&)>&& callback)
1729     {
1730         contentScroller_.scrollingCallback = std::move(callback);
1731     }
1732 protected:
1733     virtual void InitDragEvent();
1734     void OnAttachToMainTree() override;
1735     void OnAttachToMainTreeMultiThread();
1736     void OnAttachToMainTreeMultiThreadAddition();
1737 
1738     void OnDetachFromMainTree() override;
1739     void OnDetachFromMainTreeMultiThread();
1740 
IsReverse()1741     bool IsReverse() const override
1742     {
1743         return false;
1744     }
1745 
SelectOverlayIsOn()1746     bool SelectOverlayIsOn()
1747     {
1748         return selectOverlay_->SelectOverlayIsOn();
1749     }
1750 
SetIsSingleHandle(bool isSingleHandle)1751     void SetIsSingleHandle(bool isSingleHandle)
1752     {
1753         selectOverlay_->SetIsSingleHandle(isSingleHandle);
1754     }
1755 
1756     int32_t GetTouchIndex(const OffsetF& offset) override;
1757     void OnTextGestureSelectionUpdate(int32_t start, int32_t end, const TouchEventInfo& info) override;
1758     void OnTextGestureSelectionEnd(const TouchLocationInfo& locationInfo) override;
1759     void DoTextSelectionTouchCancel() override;
1760     void StartGestureSelection(int32_t start, int32_t end, const Offset& startOffset) override;
1761     void UpdateSelection(int32_t both);
1762     void UpdateSelection(int32_t start, int32_t end);
1763     virtual bool IsNeedProcessAutoFill();
1764     bool OnThemeScopeUpdate(int32_t themeScopeId) override;
1765 
1766     RefPtr<ContentController> contentController_;
1767     RefPtr<TextSelectController> selectController_;
1768     bool needToRefreshSelectOverlay_ = false;
1769     bool isTextChangedAtCreation_ = false;
1770 
1771     void HandleCloseKeyboard(bool forceClose);
1772 
1773     // 是否独立控制键盘
1774     bool independentControlKeyboard_ = false;
1775     RefPtr<AutoFillController> autoFillController_;
1776     virtual IMEClient GetIMEClientInfo();
1777     RefPtr<TextFieldSelectOverlay> selectOverlay_;
1778 
1779 private:
1780     void OnSyncGeometryNode(const DirtySwapConfig& config) override;
1781     Offset ConvertTouchOffsetToTextOffset(const Offset& touchOffset);
1782     void GetTextSelectRectsInRangeAndWillChange();
1783     bool BeforeIMEInsertValue(const std::u16string& insertValue, int32_t offset);
1784     void AfterIMEInsertValue(const std::u16string& insertValue);
1785     bool BeforeIMEDeleteValue(const std::u16string& deleteValue, TextDeleteDirection direction, int32_t offset);
1786     void AfterIMEDeleteValue(const std::u16string& deleteValue, TextDeleteDirection direction);
1787 
1788     bool FireOnWillChange(const ChangeValueInfo& changeValueInfo);
1789     bool OnWillChangePreSetValue(const std::u16string& newValue);
1790     bool OnWillChangePreDelete(const std::u16string& oldContent, uint32_t start, uint32_t end);
1791     bool OnWillChangePreInsert(const std::u16string& insertValue, const std::u16string& oldContent,
1792         uint32_t start, uint32_t end);
1793     void RecoverTextValueAndCaret(const std::u16string& oldValue, TextRange caretIndex);
1794     void OnAfterModifyDone() override;
1795     void HandleTouchEvent(const TouchEventInfo& info);
1796     void HandleTouchDown(const Offset& offset);
1797     void HandleTouchUp();
1798     void HandleCancelButtonTouchDown(const RefPtr<TextInputResponseArea>& responseArea);
1799     void HandleCancelButtonTouchUp();
1800     void HandleTouchMove(const TouchLocationInfo& info);
1801     void UpdateCaretByTouchMove(const TouchLocationInfo& info);
1802     void InitDisableColor();
1803     void InitFocusEvent();
1804     void InitTouchEvent();
1805     void InitLongPressEvent();
1806     void InitClickEvent();
1807     void InitDragDropEvent();
1808     bool ProcessFocusIndexAction();
1809     std::function<DragDropInfo(const RefPtr<OHOS::Ace::DragEvent>&, const std::string&)> OnDragStart();
1810     std::function<void(const RefPtr<OHOS::Ace::DragEvent>&, const std::string&)> OnDragDrop();
1811     std::string GetDragStyledText();
1812     void ShowSelectAfterDragEvent();
1813     void ClearDragDropEvent();
1814     std::function<void(Offset)> GetThumbnailCallback();
1815     bool HasStateStyle(UIState state) const;
1816 
1817     void OnTextInputScroll(float offset);
1818     void OnTextAreaScroll(float offset);
1819     bool OnScrollCallback(float offset, int32_t source) override;
1820     void OnScrollEndCallback() override;
1821     bool CheckSelectAreaVisible();
1822     void InitMouseEvent();
1823     void InitCancelButtonMouseEvent();
1824     void InitPasswordButtonMouseEvent();
1825     void HandleHoverEffect(MouseInfo& info, bool isHover);
1826     void OnHover(bool isHover, const HoverInfo& info);
1827     void UpdateHoverStyle(bool isHover);
1828     void UpdatePressStyle(bool isPressed);
1829     void PlayAnimationHoverAndPress(const Color& color);
1830     void UpdateTextFieldBgColor(const Color& color);
1831     void ChangeMouseState(const Offset location, int32_t frameId);
1832     void FreeMouseStyleHoldNode(const Offset location);
1833     void HandleMouseEvent(MouseInfo& info);
1834     void FocusAndUpdateCaretByMouse(MouseInfo& info);
1835     void UpdateShiftFlag(const KeyEvent& keyEvent) override;
1836     void UpdateCaretByClick(const Offset& localOffset);
1837     void HandleRightMouseEvent(MouseInfo& info);
1838     void HandleRightMousePressEvent(MouseInfo& info);
1839     void HandleRightMouseReleaseEvent(MouseInfo& info);
1840     void HandleLeftMouseEvent(MouseInfo& info);
1841     void HandleLeftMousePressEvent(MouseInfo& info);
1842     void HandleLeftMouseMoveEvent(MouseInfo& info);
1843     void HandleLeftMouseReleaseEvent(MouseInfo& info);
1844     void StartVibratorByLongPress();
1845     bool IsInResponseArea(const Offset& location);
1846     void HandleLongPress(GestureEvent& info);
1847     bool CanChangeSelectState();
1848     void UpdateCaretPositionWithClamp(const int32_t& pos);
1849     void CursorMoveOnClick(const Offset& offset);
1850 
1851     void DelayProcessOverlay(const OverlayRequest& request = OverlayRequest());
1852     void CancelDelayProcessOverlay();
1853     void ProcessOverlayAfterLayout(const OffsetF& prevOffset);
1854     void ProcessOverlay(const OverlayRequest& request = OverlayRequest());
1855 
1856     // when moving one handle causes shift of textRect, update x position of the other handle
1857     void SetHandlerOnMoveDone();
1858     void OnDetachFromFrameNode(FrameNode* node) override;
1859     void OnDetachFromFrameNodeMultiThread(FrameNode* node);
1860     void OnAttachContext(PipelineContext* context) override;
1861     void OnDetachContext(PipelineContext* context) override;
1862     void UpdateSelectionByMouseDoubleClick();
1863 
1864     void AfterSelection();
1865 
1866     void AutoFillValueChanged();
1867     void FireEventHubOnChange(const std::u16string& text);
1868     // The return value represents whether the editor content has change.
1869     bool FireOnTextChangeEvent();
1870     void AddTextFireOnChange();
1871     void RecordTextInputEvent();
1872 
1873     void UpdateCaretPositionByLastTouchOffset();
1874     bool UpdateCaretPosition();
1875     void UpdateCaretRect(bool isEditorValueChanged);
1876     void AdjustTextInReasonableArea();
1877     bool CharLineChanged(int32_t caretPosition);
1878 
1879     void ScheduleCursorTwinkling();
1880     void OnCursorTwinkling();
1881     void CheckIfNeedToResetKeyboard();
1882 
1883     float PreferredTextHeight(bool isPlaceholder, bool isAlgorithmMeasure = false);
1884 
1885     void SetCaretOffsetForEmptyTextOrPositionZero();
1886     void UpdateTextFieldManager(const Offset& offset, float height);
1887     void OnTextInputActionUpdate(TextInputAction value);
1888 
1889     void OnAutoCapitalizationModeUpdate(AutoCapitalizationMode value);
1890     void Delete(int32_t start, int32_t end);
1891     void CheckAndUpdateRecordBeforeOperation();
1892     void BeforeCreateLayoutWrapper() override;
1893     bool OnDirtyLayoutWrapperSwap(const RefPtr<LayoutWrapper>& dirty, const DirtySwapConfig& config) override;
1894     bool CursorInContentRegion();
1895     bool OffsetInContentRegion(const Offset& offset);
1896     void SetDisabledStyle();
1897 
1898     void CalculateDefaultCursor();
1899     void RequestKeyboardByFocusSwitch();
1900     void TextFieldLostFocusToViewRoot();
1901     bool IsModalCovered();
1902     void SetNeedToRequestKeyboardOnFocus();
1903     void SetAccessibilityAction() override;
1904     void SetAccessibilityActionGetAndSetCaretPosition();
1905     void SetAccessibilityActionOverlayAndSelection();
1906     void SetAccessibilityEditAction();
1907     void SetAccessibilityMoveTextAction();
1908     void SetAccessibilityErrorText();
1909     void SetAccessibilityClearAction();
1910     void SetAccessibilityPasswordIconAction();
1911     void SetAccessibilityUnitAction();
1912 
1913     void UpdateCopyAllStatus();
1914     void RestorePreInlineStates();
1915     void ProcessRectPadding();
1916     void CalcScrollRect(Rect& inlineScrollRect);
1917 
1918     bool ResetObscureTickCountDown();
1919     bool IsAccessibilityClick();
1920     bool IsOnUnitByPosition(const Offset& globalOffset);
1921     bool IsOnPasswordByPosition(const Offset& globalOffset);
1922     bool IsOnCleanNodeByPosition(const Offset& globalOffset);
1923     bool IsTouchAtLeftOffset(float currentOffsetX);
1924     void FilterExistText();
1925     void UpdateErrorTextMargin();
1926     void UpdateSelectController();
1927     void UpdateHandlesOffsetOnScroll(float offset);
1928     void CloseHandleAndSelect() override;
1929     bool RepeatClickCaret(const Offset& offset, int32_t lastCaretIndex);
1930     bool RepeatClickCaret(const Offset& offset, const RectF& lastCaretRect);
1931     void PaintTextRect();
1932     void GetIconPaintRect(const RefPtr<TextInputResponseArea>& responseArea, RoundRect& paintRect);
1933     void GetInnerFocusPaintRect(RoundRect& paintRect);
1934     void GetTextInputFocusPaintRect(RoundRect& paintRect);
1935     void PaintResponseAreaRect();
1936     void PaintCancelRect();
1937     void PaintUnitRect();
1938     void PaintPasswordRect();
CancelNodeIsShow()1939     bool CancelNodeIsShow()
1940     {
1941         auto cleanNodeArea = AceType::DynamicCast<CleanNodeResponseArea>(cleanNodeResponseArea_);
1942         CHECK_NULL_RETURN(cleanNodeArea, false);
1943         return cleanNodeArea->IsShow();
1944     }
1945 
1946     void InitPanEvent();
1947 
1948     void PasswordResponseKeyEvent();
1949     void UnitResponseKeyEvent();
1950     void ProcBorderAndUnderlineInBlurEvent();
1951     void ProcNormalInlineStateInBlurEvent();
1952     bool IsMouseOverScrollBar(const BaseEventInfo* info);
1953 
1954 #if defined(ENABLE_STANDARD_INPUT)
1955     std::optional<MiscServices::TextConfig> GetMiscTextConfig() const;
1956     void GetInlinePositionYAndHeight(double& positionY, double& height) const;
1957 #endif
1958     void NotifyOnEditChanged(bool isChanged);
1959     void ProcessCancelButton();
1960     bool HasInputOperation();
1961     AceAutoFillType ConvertToAceAutoFillType(TextInputType type);
1962     bool CheckAutoFill(bool isFromKeyBoard = false);
1963     void ScrollToSafeArea() const override;
1964     void RecordSubmitEvent() const;
1965     void UpdateCancelNode();
1966     void AdjustTextRectByCleanNode(RectF& textRect);
1967     void RequestKeyboardAfterLongPress();
1968     void UpdatePasswordModeState();
1969     void InitDragDropCallBack();
1970     void InitDragDropEventWithOutDragStart();
1971     void UpdateBlurReason();
1972     AceAutoFillType TextContentTypeToAceAutoFillType(const TextContentType& type);
1973     bool CheckAutoFillType(const AceAutoFillType& aceAutoFillAllType, bool isFromKeyBoard = false);
1974     bool GetAutoFillTriggeredStateByType(const AceAutoFillType& autoFillType);
1975     void SetAutoFillTriggeredStateByType(const AceAutoFillType& autoFillType);
1976     AceAutoFillType GetAutoFillType(bool isNeedToHitType = true);
1977     bool IsAutoFillPasswordType(const AceAutoFillType& autoFillType);
1978     void DoProcessAutoFill(SourceType sourceType = SourceType::NONE);
1979     void KeyboardContentTypeToInputType();
1980     void ProcessScroll();
1981     void ProcessCounter();
1982     void HandleParentGlobalOffsetChange();
1983     HintToTypeWrap GetHintType();
1984     HintToTypeWrap GetAutoFillTypeAndMetaData(bool isNeedToHitType = true);
1985     PaddingProperty GetPaddingByUserValue();
1986     void SetThemeAttr();
1987     void SetThemeBorderAttr();
1988     void ProcessInlinePaddingAndMargin();
1989     Edge GetUnderlinePadding(const RefPtr<TextFieldTheme>& theme, bool processLeftPadding,
1990         bool processRightPadding) const;
1991     Offset ConvertGlobalToLocalOffset(const Offset& globalOffset);
1992     void HandleCountStyle();
1993     void HandleDeleteOnCounterScene();
1994     void HandleContentSizeChange(const RectF& textRect);
UpdatePreviewIndex(int32_t start,int32_t end)1995     void UpdatePreviewIndex(int32_t start, int32_t end)
1996     {
1997         previewTextStart_ = start;
1998         previewTextEnd_ = end;
1999     }
2000 
2001     void CalculatePreviewingTextMovingLimit(const Offset& touchOffset, double& limitL, double& limitR);
2002     void UpdateParam(GestureEvent& info, bool shouldProcessOverlayAfterLayout);
2003     void OnCaretMoveDone(const TouchEventInfo& info);
2004     void HandleCrossPlatformInBlurEvent();
2005     void ModifyInnerStateInBlurEvent();
2006 
2007     void TwinklingByFocus();
2008 
2009     bool FinishTextPreviewByPreview(const std::u16string& insertValue);
2010     bool GetIndependentControlKeyboard();
2011     bool IsMoveFocusOutFromLeft(const KeyEvent& event);
2012     bool IsMoveFocusOutFromRight(const KeyEvent& event);
2013 
2014     bool GetTouchInnerPreviewText(const Offset& offset) const;
2015     bool IsShowMenu(const std::optional<SelectionOptions>& options, bool defaultValue);
2016     bool IsContentRectNonPositive();
2017     void ReportEvent();
2018     void ResetPreviewTextState();
2019     void CalculateBoundsRect();
2020     TextFieldInfo GenerateTextFieldInfo();
2021     void AddTextFieldInfo();
2022     void RemoveTextFieldInfo();
2023     void UpdateTextFieldInfo();
2024     bool IsAutoFillUserName(const AceAutoFillType& autoFillType);
2025     bool HasAutoFillPasswordNode();
2026     bool IsTriggerAutoFillPassword();
2027 
2028     void PauseContentScroll();
2029     void ScheduleContentScroll(float delay);
2030     void UpdateSelectionByLongPress(int32_t start, int32_t end, const Offset& localOffset);
2031     std::optional<float> CalcAutoScrollStepOffset(const Offset& localOffset);
2032     void SetDragMovingScrollback();
2033     float CalcScrollSpeed(float hotAreaStart, float hotAreaEnd, float point);
2034     std::optional<TouchLocationInfo> GetAcceptedTouchLocationInfo(const TouchEventInfo& info);
2035     void ResetTouchAndMoveCaretState();
2036     void UpdateSelectionAndHandleVisibility();
2037     void ResetFirstClickAfterGetFocus();
2038     void ProcessAutoFillOnFocus();
2039     bool IsStopEditWhenCloseKeyboard();
2040     void SetIsEnableSubWindowMenu();
2041     void OnReportPasteEvent(const RefPtr<FrameNode>& frameNode);
2042     void OnReportSubmitEvent(const RefPtr<FrameNode>& frameNode);
2043     void BeforeAutoFillAnimation(const std::u16string& content, const AceAutoFillType& type);
2044     void RemoveFillContentMap();
2045     bool NeedsSendFillContent();
2046     void UpdateSelectOverlay(const RefPtr<OHOS::Ace::TextFieldTheme>& textFieldTheme);
2047     void OnAccessibilityEventTextChange(const std::string& changeType, const std::string& changeString);
2048     void FireOnWillAttachIME();
2049     Offset GetCaretClickLocalOffset(const Offset& offset);
2050     void MoveCaretToContentRectMultiThread(const MoveCaretToContentRectData& value);
2051     bool ShouldSkipUpdateParagraph();
2052     void UpdateParagraphForDragNode(bool skipUpdate);
2053     void UpdateMagnifierWithFloatingCaretPos();
2054 
2055     RectF frameRect_;
2056     RectF textRect_;
2057     float textParagraphIndent_ = 0.0;
2058     RefPtr<Paragraph> paragraph_;
2059     InlineMeasureItem inlineMeasureItem_;
2060 
2061     RefPtr<ClickEvent> clickListener_;
2062     RefPtr<TouchEventImpl> touchListener_;
2063     RefPtr<TouchEventImpl> imageTouchEvent_;
2064     RefPtr<ScrollableEvent> scrollableEvent_;
2065     RefPtr<InputEvent> mouseEvent_;
2066     RefPtr<InputEvent> hoverEvent_;
2067     RefPtr<InputEvent> imageHoverEvent_;
2068     RefPtr<LongPressEvent> longPressEvent_;
2069     CursorPositionType cursorPositionType_ = CursorPositionType::NORMAL;
2070 
2071     // What the keyboard should appears.
2072     TextInputType keyboard_ = TextInputType::UNSPECIFIED;
2073     // Action when "enter" pressed.
2074     TextInputAction action_ = TextInputAction::UNSPECIFIED;
2075     TextDirection textDirection_ = TextDirection::LTR;
2076     // Used to record original caret position for "shift + up/down"
2077     // Less than 0 is invalid, initialized as invalid in constructor
2078     OffsetF originCaretPosition_;
2079 
2080     OffsetF parentGlobalOffset_;
2081     OffsetF lastTouchOffset_;
2082     std::optional<PaddingPropertyF> utilPadding_;
2083 
2084     bool setBorderFlag_ = true;
2085     BorderWidthProperty lastDiffBorderWidth_;
2086     BorderColorProperty lastDiffBorderColor_;
2087 
2088     HandleMoveStatus handleMoveStatus_;
2089     bool cursorVisible_ = false;
2090     bool focusEventInitialized_ = false;
2091     bool isMousePressed_ = false;
2092     bool textObscured_ = true;
2093     bool enableTouchAndHoverEffect_ = true;
2094     bool isOnHover_ = false;
2095     bool needToRequestKeyboardInner_ = false;
2096     bool needToRequestKeyboardOnFocus_ = false;
2097     bool isTransparent_ = false;
2098     bool contChange_ = false;
2099     bool counterChange_ = false;
2100     std::optional<int32_t> surfaceChangedCallbackId_;
2101     std::optional<int32_t> surfacePositionChangedCallbackId_;
2102     RefPtr<TextComponentDecorator> counterDecorator_;
2103     RefPtr<TextComponentDecorator> errorDecorator_;
2104 
2105     SelectionMode selectionMode_ = SelectionMode::NONE;
2106     CaretUpdateType caretUpdateType_ = CaretUpdateType::NONE;
2107     bool scrollable_ = true;
2108     bool blockPress_ = false;
2109     bool isPressSelectedBox_ = false;
2110     float previewWidth_ = 0.0f;
2111     float lastTextRectY_ = 0.0f;
2112     std::optional<DisplayMode> barState_;
2113 
2114     uint32_t twinklingInterval_ = 0;
2115     int32_t obscureTickCountDown_ = 0;
2116     int32_t nakedCharPosition_ = -1;
2117     bool obscuredChange_ = false;
2118     float currentOffset_ = 0.0f;
2119     float countHeight_ = 0.0f;
2120     Dimension underlineWidth_ = 1.0_px;
2121     Color underlineColor_;
2122     UserUnderlineColor userUnderlineColor_ = UserUnderlineColor();
2123     bool scrollBarVisible_ = false;
2124     bool isCounterIdealheight_ = false;
2125     float maxFrameOffsetY_ = 0.0f;
2126     float maxFrameHeight_ = 0.0f;
2127 
2128     CancelableCallback<void()> cursorTwinklingTask_;
2129 
2130     std::list<std::unique_ptr<TextInputFormatter>> textInputFormatters_;
2131 
2132     RefPtr<TextFieldController> textFieldController_;
2133     WeakPtr<Referenced> jsTextEditableController_;
2134     TextEditingValueNG textEditingValue_;
2135     // controls redraw of overlay modifier, update when need to redraw
2136     bool changeSelectedRects_ = false;
2137     RefPtr<TextFieldOverlayModifier> textFieldOverlayModifier_;
2138     RefPtr<TextFieldContentModifier> textFieldContentModifier_;
2139     RefPtr<TextFieldForegroundModifier> textFieldForegroundModifier_;
2140     WeakPtr<TextFieldTheme> textFieldTheme_;
2141     ACE_DISALLOW_COPY_AND_MOVE(TextFieldPattern);
2142 
2143     int32_t dragTextStart_ = 0;
2144     int32_t dragTextEnd_ = 0;
2145     std::u16string dragValue_;
2146     RefPtr<FrameNode> dragNode_;
2147     DragStatus dragStatus_ = DragStatus::NONE;          // The status of the dragged initiator
2148     DragStatus dragRecipientStatus_ = DragStatus::NONE; // Drag the recipient's state
2149     RefPtr<Clipboard> clipboard_;
2150     std::vector<TextEditingValueNG> operationRecords_;
2151     std::vector<TextEditingValueNG> redoOperationRecords_;
2152     std::vector<NG::MenuOptionsParam> menuOptionItems_;
2153     BorderRadiusProperty borderRadius_;
2154     PasswordModeStyle passwordModeStyle_;
2155     SelectMenuInfo selectMenuInfo_;
2156 
2157     RefPtr<PanEvent> boxSelectPanEvent_;
2158 
2159     // inline
2160     bool isTextInput_ = false;
2161     bool inlineSelectAllFlag_ = false;
2162     bool inlineFocusState_ = false;
2163     float inlineSingleLineHeight_ = 0.0f;
2164     float inlinePadding_ = 0.0f;
2165 
2166     bool isOritationListenerRegisted_ = false;
2167 
2168 #if defined(ENABLE_STANDARD_INPUT)
2169     sptr<OHOS::MiscServices::OnTextChangedListener> textChangeListener_;
2170 #else
2171     RefPtr<TextInputConnection> connection_;
2172 #endif
2173 #if defined(OHOS_STANDARD_SYSTEM) && !defined(PREVIEW)
2174     bool imeAttached_ = false;
2175     bool imeShown_ = false;
2176 #endif
2177     bool isFocusedBeforeClick_ = false;
2178     bool isCustomKeyboardAttached_ = false;
2179     bool isCustomFont_ = false;
2180     BlurReason blurReason_ = BlurReason::FOCUS_SWITCH;
2181     std::function<void()> customKeyboardBuilder_;
2182     RefPtr<UINode> customKeyboard_;
2183     RefPtr<OverlayManager> keyboardOverlay_;
2184     TimeStamp lastClickTimeStamp_;
2185     float paragraphWidth_ = 0.0f;
2186 
2187     std::queue<int32_t> deleteBackwardOperations_;
2188     std::queue<int32_t> deleteForwardOperations_;
2189     std::queue<InsertCommandInfo> insertCommands_;
2190     std::queue<InputCommandInfo> inputCommands_;
2191     std::queue<InputOperation> inputOperations_;
2192     bool leftMouseCanMove_ = false;
2193     bool isLongPress_ = false;
2194     bool isEdit_ = false;
2195     bool isSupportCameraInput_ = false;
2196     RefPtr<NG::UINode> unitNode_;
2197     RefPtr<TextInputResponseArea> responseArea_;
2198     RefPtr<TextInputResponseArea> cleanNodeResponseArea_;
2199     std::string lastAutoFillTextValue_;
2200     std::function<void()> processOverlayDelayTask_;
2201     FocuseIndex focusIndex_ = FocuseIndex::TEXT;
2202     TouchAndMoveCaretState moveCaretState_;
2203     FloatingCaretState floatCaretState_;
2204     bool needSelectAll_ = false;
2205     bool isModifyDone_ = false;
2206     bool initTextRect_ = false;
2207     bool isKeyboardClosedByUser_ = false;
2208     bool isFillRequestFinish_ = true;
2209     bool keyboardAvoidance_ = false;
2210     bool hasMousePressed_ = false;
2211     bool showCountBorderStyle_ = false;
2212     OffsetF movingCaretOffset_;
2213     std::string autoFillUserName_;
2214     std::string autoFillNewPassword_;
2215     uint32_t autoFillSessionId_ = 0;
2216     bool autoFillOtherAccount_ = false;
2217 
2218     bool textInputBlurOnSubmit_ = true;
2219     bool textAreaBlurOnSubmit_ = false;
2220     bool isDetachFromMainTree_ = false;
2221 
2222     // 节点是否需要渐隐能力
2223     bool haveTextFadeoutCapacity_ = false;
2224     bool isFocusTextColorSet_ = false;
2225     bool isFocusBGColorSet_ = false;
2226     bool isFocusPlaceholderColorSet_ = false;
2227     bool hoverAndPressBgColorEnabled_ = false;
2228     std::function<void(bool)> isFocusActiveUpdateEvent_;
2229 
2230     Dimension previewUnderlineWidth_ = 2.0_vp;
2231     bool hasSupportedPreviewText_ = true;
2232     bool hasPreviewText_ = false;
2233     std::queue<PreviewTextInfo> previewTextOperation_;
2234     int32_t previewTextStart_ = -1;
2235     int32_t previewTextEnd_ = -1;
2236     std::u16string bodyTextInPreivewing_;
2237     PreviewRange lastCursorRange_ = {};
2238     std::u16string lastTextValue_ = u"";
2239     float lastCursorLeft_ = 0.0f;
2240     float lastCursorTop_ = 0.0f;
2241     bool showKeyBoardOnFocus_ = true;
2242     bool isTextSelectionMenuShow_ = true;
2243     bool isMoveCaretAnywhere_ = false;
2244     bool isTouchPreviewText_ = false;
2245     bool isCaretTwinkling_ = false;
2246     bool isPasswordSymbol_ = true;
2247     bool isEnableHapticFeedback_ = true;
2248     RefPtr<MultipleClickRecognizer> multipleClickRecognizer_ = nullptr;
2249     WeakPtr<AIWriteAdapter> aiWriteAdapter_;
2250     std::optional<Dimension> adaptFontSize_;
2251     uint32_t longPressFingerNum_ = 0;
2252     ContentScroller contentScroller_;
2253     WeakPtr<FrameNode> firstAutoFillContainerNode_;
2254     std::optional<float> lastCaretPos_ = std::nullopt;
2255     bool firstClickAfterLosingFocus_ = true;
2256     CancelableCallback<void()> firstClickResetTask_;
2257     RequestFocusReason requestFocusReason_ = RequestFocusReason::UNKNOWN;
2258     bool directionKeysMoveFocusOut_ = false;
2259     KeyboardAppearance keyboardAppearance_ = KeyboardAppearance::NONE_IMMERSIVE;
2260     TextRange callbackRangeBefore_;
2261     TextRange callbackRangeAfter_;
2262     std::u16string callbackOldContent_;
2263     PreviewText callbackOldPreviewText_;
2264     bool isFilterChanged_ = false;
2265     std::optional<bool> showPasswordState_;
2266     bool cancelButtonTouched_ = false;
2267     KeyboardGradientMode imeGradientMode_ = KeyboardGradientMode::NONE;
2268     KeyboardFluidLightMode imeFluidLightMode_ = KeyboardFluidLightMode::NONE;
2269     OverflowMode lastOverflowMode_ = OverflowMode::SCROLL;
2270     TextOverflow lastTextOverflow_ = TextOverflow::ELLIPSIS;
2271 
2272     // ----- multi thread state variables -----
2273     bool initSurfacePositionChangedCallbackMultiThread_ = false;
2274     bool initSurfaceChangedCallbackMultiThread_ = false;
2275     bool handleCountStyleMultiThread_ = false;
2276     bool startTwinklingMultiThread_ = false;
2277     bool registerWindowSizeCallbackMultiThread_ = false;
2278     bool processDefaultStyleAndBehaviorsMultiThread_ = false;
2279     bool stopEditingMultiThread_ = false;
2280     bool triggerAvoidOnCaretChangeMultiThread_ = false;
2281     bool updateCaretInfoToControllerMultiThread_ = false;
2282     bool setShowKeyBoardOnFocusMultiThread_ = false;
2283     bool setShowKeyBoardOnFocusMultiThreadValue_ = false;
2284     bool setSelectionFlagMultiThread_ = false;
2285     bool setCustomKeyboardWithNodeMultiThread_ = false;
2286     RefPtr<UINode> setCustomKeyboardWithNodeMultiThreadValue_;
2287     bool moveCaretToContentRectMultiThread_ = false;
2288     MoveCaretToContentRectData moveCaretToContentRectMultiThreadValue_;
2289     // ----- multi thread state variables end -----
2290 };
2291 } // namespace OHOS::Ace::NG
2292 
2293 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_TEXT_FIELD_TEXT_FIELD_PATTERN_H
2294