• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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_TEXT_FIELD_RENDER_TEXT_FIELD_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_TEXT_FIELD_RENDER_TEXT_FIELD_H
18 
19 #include <functional>
20 
21 #include "base/geometry/dimension.h"
22 #include "base/geometry/offset.h"
23 #include "base/geometry/rect.h"
24 #include "base/geometry/size.h"
25 #include "base/utils/system_properties.h"
26 #include "core/common/clipboard/clipboard.h"
27 #include "core/common/ime/text_edit_controller.h"
28 #include "core/common/ime/text_input_client.h"
29 #include "core/common/ime/text_input_connection.h"
30 #include "core/common/ime/text_input_formatter.h"
31 #include "core/common/ime/text_input_type.h"
32 #include "core/common/ime/text_selection.h"
33 #include "core/components/common/properties/color.h"
34 #include "core/components/common/properties/decoration.h"
35 #include "core/components/common/properties/text_style.h"
36 #include "core/components/image/render_image.h"
37 #include "core/components/text_field/text_field_component.h"
38 #include "core/gestures/click_recognizer.h"
39 #include "core/gestures/long_press_recognizer.h"
40 #include "core/gestures/raw_recognizer.h"
41 #include "core/pipeline/base/overlay_show_option.h"
42 #include "core/pipeline/base/render_node.h"
43 
44 #if defined(ENABLE_STANDARD_INPUT)
45 #include "utils/native/base/include/refbase.h"
46 
47 namespace OHOS::MiscServices {
48 class OnTextChangedListener;
49 }
50 #endif
51 
52 namespace OHOS::Ace {
53 
54 class ClickRecognizer;
55 class ClickInfo;
56 class TextOverlayComponent;
57 struct TextEditingValue;
58 
59 enum class DirectionStatus : uint8_t {
60     LEFT_LEFT = 0, // System direction is LTR, text direction is LTR.
61     LEFT_RIGHT,
62     RIGHT_LEFT,
63     RIGHT_RIGHT,
64 };
65 
66 enum class CursorPositionType {
67     NONE = 0,
68     END,      // end of paragraph
69     BOUNDARY, // boundary of LTR and RTL
70     NORMAL,
71 };
72 
73 // Currently only CHARACTER.
74 enum class CursorMoveSkip {
75     CHARACTER, // Smallest code unit.
76     WORDS,
77     SIBLING_SPACE,
78     PARAGRAPH,
79 };
80 
81 class RenderTextField : public RenderNode, public TextInputClient, public ValueChangeObserver {
82     DECLARE_ACE_TYPE(RenderTextField, RenderNode, TextInputClient, ValueChangeObserver);
83 public:
84     ~RenderTextField() override;
85 
86     static RefPtr<RenderNode> Create();
87 
88     using TapCallback = std::function<bool()>;
89 
90     void Update(const RefPtr<Component>& component) override;
91     void PerformLayout() override;
92     // Override TextInputClient
93     void UpdateEditingValue(const std::shared_ptr<TextEditingValue>& value, bool needFireChangeEvent = true) override;
94     void PerformDefaultAction();
95     void PerformAction(TextInputAction action, bool forceCloseKeyboard = false) override;
96     void OnStatusChanged(RenderStatus renderStatus) override;
97     void OnValueChanged(bool needFireChangeEvent = true, bool needFireSelectChangeEvent = true) override;
98     void OnPaintFinish() override;
99 
100     bool OnKeyEvent(const KeyEvent& event);
101     bool RequestKeyboard(bool isFocusViewChanged, bool needStartTwinkling = false);
102     bool CloseKeyboard(bool forceClose = false);
103     void ShowError(const std::string& errorText, bool resetToStart = true);
104     void ShowTextOverlay(const Offset& showOffset, bool isSingleHandle);
105     void SetOnValueChange(const std::function<void()>& onValueChange);
106     const std::function<void()>& GetOnValueChange() const;
107     void SetOnKeyboardClose(const std::function<void(bool)>& onKeyboardClose);
108     void SetOnClipRectChanged(const std::function<void(const Rect&)>& onClipRectChanged);
109     void SetUpdateHandlePosition(const std::function<void(const OverlayShowOption&)>& updateHandlePosition);
110     void SetUpdateHandleDiameter(const std::function<void(const double&)>& updateHandleDiameter);
111     void SetUpdateHandleDiameterInner(const std::function<void(const double&)>& updateHandleDiameterInner);
112     void SetIsOverlayShowed(bool isOverlayShowed, bool needStartTwinkling = true);
113     void UpdateFocusAnimation();
114     const TextEditingValue& GetEditingValue() const;
115     const TextEditingValue& GetPreEditingValue() const;
116     void Delete(int32_t start, int32_t end);
117     void CursorMoveLeft(CursorMoveSkip skip = CursorMoveSkip::CHARACTER);
118     void CursorMoveRight(CursorMoveSkip skip = CursorMoveSkip::CHARACTER);
119     void CursorMoveUp();
120     void CursorMoveDown();
121     void Insert(const std::string& text);
122     void StartTwinkling();
123     void StopTwinkling();
124 
SetInputFilter(const std::string & inputFilter)125     void SetInputFilter(const std::string& inputFilter)
126     {
127         inputFilter_ = inputFilter;
128     }
129 
SetTextStyle(const TextStyle & style)130     void SetTextStyle(const TextStyle& style)
131     {
132         style_ = style;
133     }
134 
SetOnOverlayFocusChange(const std::function<void (bool)> & onOverlayFocusChange)135     void SetOnOverlayFocusChange(const std::function<void(bool)>& onOverlayFocusChange)
136     {
137         onOverlayFocusChange_ = onOverlayFocusChange;
138     }
139 
140     // Whether textOverlay is showed.
IsOverlayShowed()141     bool IsOverlayShowed() const
142     {
143         return isOverlayShowed_;
144     }
145 
SetOverlayColor(const Color & overlayColor)146     void SetOverlayColor(const Color& overlayColor)
147     {
148         overlayColor_ = overlayColor;
149     }
150 
RegisterTapCallback(const TapCallback & callback)151     void RegisterTapCallback(const TapCallback& callback)
152     {
153         tapCallback_ = callback;
154     }
155 
SetNextFocusEvent(const std::function<void ()> & event)156     void SetNextFocusEvent(const std::function<void()>& event)
157     {
158         moveNextFocusEvent_ = event;
159     }
160 
SetSubmitEvent(std::function<void (const std::string &)> && event)161     void SetSubmitEvent(std::function<void(const std::string&)>&& event)
162     {
163         onSubmitEvent_ = event;
164     }
165 
GetColor()166     const Color& GetColor() const
167     {
168         if (decoration_) {
169             return decoration_->GetBackgroundColor();
170         }
171         return Color::TRANSPARENT;
172     }
173 
SetColor(const Color & color)174     void SetColor(const Color& color)
175     {
176         if (decoration_) {
177             decoration_->SetBackgroundColor(color);
178             MarkNeedRender();
179         }
180     }
181 
GetHeight()182     double GetHeight() const
183     {
184         return height_.Value();
185     }
186 
GetDimensionHeight()187     const Dimension& GetDimensionHeight() const
188     {
189         return height_;
190     }
191 
SetHeight(double height)192     void SetHeight(double height)
193     {
194         if (GreatOrEqual(height, 0.0) && !NearEqual(height_.Value(), height)) {
195             height_.SetValue(height);
196             MarkNeedLayout();
197         }
198     }
199 
GetStackElement()200     const WeakPtr<StackElement> GetStackElement() const
201     {
202         return stackElement_;
203     }
204 
SetWidthReservedForSearch(double widthReservedForSearch)205     void SetWidthReservedForSearch(double widthReservedForSearch)
206     {
207         widthReservedForSearch_ = widthReservedForSearch;
208     }
209 
SetPaddingHorizonForSearch(double paddingHorizon)210     void SetPaddingHorizonForSearch(double paddingHorizon)
211     {
212         paddingHorizonForSearch_ = paddingHorizon;
213     }
214 
HasTextOverlayPushed()215     bool HasTextOverlayPushed() const
216     {
217         return hasTextOverlayPushed_;
218     }
219 
GetPlaceholder()220     const std::string GetPlaceholder() const
221     {
222         return placeholder_;
223     }
224 
GetValue()225     const std::string GetValue() const
226     {
227         return text_;
228     }
229 
GetAction()230     TextInputAction GetAction() const
231     {
232         return action_;
233     }
234 
GetKeyboard()235     TextInputType GetKeyboard() const
236     {
237         return keyboard_;
238     }
239 
GetInactivePlaceholderColor()240     Color GetInactivePlaceholderColor() const
241     {
242         return inactivePlaceholderColor_;
243     }
244 
GetPlaceHoldStyle()245     TextStyle GetPlaceHoldStyle()
246     {
247         return placeHoldStyle_;
248     }
249 
GetTextAlign()250     TextAlign GetTextAlign()
251     {
252         return textAlign_;
253     }
254 
GetCursorColor()255     Color GetCursorColor() const
256     {
257         return cursorColor_;
258     }
259 
GetEditingStyle()260     TextStyle GetEditingStyle()
261     {
262         return editingStyle_;
263     }
264 
GetMaxLength()265     int32_t GetMaxLength()
266     {
267         return maxLength_;
268     }
269 
GetTextInputFilter()270     const std::string GetTextInputFilter() const
271     {
272         return inputFilter_;
273     }
274 
SetTextOverlayPushed(bool hasTextOverlayPushed)275     void SetTextOverlayPushed(bool hasTextOverlayPushed)
276     {
277         hasTextOverlayPushed_ = hasTextOverlayPushed;
278     }
279 
IsSingleHandle()280     bool IsSingleHandle() const
281     {
282         return isSingleHandle_;
283     }
284 
GetInitIndex()285     int32_t GetInitIndex() const
286     {
287         return initIndex_;
288     }
289 
SetInitIndex(int32_t initIndex)290     void SetInitIndex(int32_t initIndex)
291     {
292         initIndex_ = initIndex;
293     }
294 
SetOnTextChangeEvent(const std::function<void (const std::string &)> & onTextChangeEvent)295     void SetOnTextChangeEvent(const std::function<void(const std::string&)>& onTextChangeEvent)
296     {
297         onTextChangeEvent_ = onTextChangeEvent;
298     }
299 
SetOnValueChangeEvent(const std::function<void (const std::string &)> & onTextChangeEvent)300     void SetOnValueChangeEvent(const std::function<void(const std::string&)>& onTextChangeEvent)
301     {
302         onValueChangeEvent_ = onTextChangeEvent;
303     }
304 
SetNeedNotifyChangeEvent(bool needNotifyChangeEvent)305     void SetNeedNotifyChangeEvent(bool needNotifyChangeEvent)
306     {
307         needNotifyChangeEvent_ = needNotifyChangeEvent;
308     }
309 
310 #if defined(OHOS_STANDARD_SYSTEM) && !defined(WINDOWS_PLATFORM) && !defined(MAC_PLATFORM)
SetInputMethodStatus(bool imeAttached)311     void SetInputMethodStatus(bool imeAttached)
312     {
313         imeAttached_ = imeAttached;
314     }
315 
316     void UpdateConfiguration();
317 #endif
318     std::string ProvideRestoreInfo() override;
319 
SetOnIsCurrentFocus(const std::function<bool ()> & onIsCurrentFocus)320     void SetOnIsCurrentFocus(const std::function<bool()>& onIsCurrentFocus)
321     {
322         onIsCurrentFocus_ = onIsCurrentFocus;
323     }
324 
325     int32_t instanceId_ = -1;
326 
327 protected:
328     // Describe where caret is and how tall visually.
329     struct CaretMetrics {
ResetCaretMetrics330         void Reset()
331         {
332             offset.Reset();
333             height = 0.0;
334         }
335 
336         Offset offset;
337         // When caret is close to different glyphs, the height will be different.
338         double height = 0.0;
339     };
340 
341     RenderTextField();
342     virtual Size Measure();
343     virtual int32_t GetCursorPositionForMoveUp() = 0;
344     virtual int32_t GetCursorPositionForMoveDown() = 0;
345     virtual int32_t GetCursorPositionForClick(const Offset& offset) = 0;
346     virtual Offset GetHandleOffset(int32_t extend) = 0;
347     virtual double PreferredLineHeight() = 0;
348     virtual int32_t AdjustCursorAndSelection(int32_t currentCursorPosition) = 0;
349     virtual DirectionStatus GetDirectionStatusOfPosition(int32_t position) const = 0;
350     virtual Size ComputeDeflateSizeOfErrorAndCountText() const = 0;
351 
352     void OnTouchTestHit(
353         const Offset& coordinateOffset, const TouchRestrict& touchRestrict, TouchTestResult& result) override;
354     void OnHiddenChanged(bool hidden) override;
355     void OnAppHide() override;
356     void OnClick(const ClickInfo& clickInfo);
357     void OnDoubleClick(const ClickInfo& clickInfo);
358     void OnLongPress(const LongPressInfo& longPressInfo);
359     bool HandleMouseEvent(const MouseEvent& event) override;
360 
361     void SetEditingValue(TextEditingValue&& newValue, bool needFireChangeEvent = true);
362     std::u16string GetTextForDisplay(const std::string& text) const;
363 
364     void UpdateStartSelection(int32_t end, const Offset& pos, bool isSingleHandle, bool isLongPress);
365     void UpdateEndSelection(int32_t start, const Offset& pos);
366     void UpdateSelection(int32_t both);
367     void UpdateSelection(int32_t start, int32_t end);
368     void UpdateDirectionStatus();
369     Offset GetPositionForExtend(int32_t extend, bool isSingleHandle);
370     /**
371      * Get grapheme cluster length before or after extend.
372      * For example, here is a sentence: 123����
373      * The emoji character contains 2 code unit. Assumpt that the cursor is at the end (that will be 3+2+2 = 7).
374      * When calling GetGraphemeClusterLength(3, false), '��' is not in Utf16Bmp, so result is 2.
375      * When calling GetGraphemeClusterLength(3, true), '3' is in Utf16Bmp, so result is 1.
376      */
377     int32_t GetGraphemeClusterLength(int32_t extend, bool isPrefix) const;
378 
HasConnection()379     bool HasConnection() const
380     {
381 #if defined(OHOS_STANDARD_SYSTEM) && !defined(WINDOWS_PLATFORM) && !defined(MAC_PLATFORM)
382         return imeAttached_;
383 #else
384         return connection_;
385 #endif
386     }
387 
388     bool ShowCounter() const;
389 
IsSelectiveDevice()390     static bool IsSelectiveDevice()
391     {
392         return (SystemProperties::GetDeviceType() != DeviceType::TV &&
393             SystemProperties::GetDeviceType() != DeviceType::WATCH);
394     }
395 
396     // Used for compare to the current value and decide whether to UpdateRemoteEditing().
397     std::shared_ptr<TextEditingValue> lastKnownRemoteEditingValue_;
398 
399     // An outline for caret. It is used by default when the actual size cannot be retrieved.
400     Rect caretProto_;
401     Rect innerRect_;
402     // Click region of password icon.
403     Rect passwordIconRect_;
404 
405     std::string placeholder_;
406     std::string inputFilter_;
407     Color placeholderColor_;
408     // Colors when not focused.
409     Color inactivePlaceholderColor_;
410     Color inactiveBgColor_;
411     Color inactiveTextColor_;
412     // Colors when focused.
413     Color focusPlaceholderColor_;
414     Color focusBgColor_;
415     Color focusTextColor_;
416     // Color when selected.
417     Color selectedColor_;
418     Color cursorColor_;
419     // Overlay color for hover and press.
420     Color overlayColor_ = Color::TRANSPARENT;
421     // The interval for caret twinkling, in ms.
422     uint32_t twinklingInterval = 0;
423     bool showPlaceholder_ = false;
424     bool cursorVisibility_ = false;
425     bool showCursor_ = true;
426     bool cursorColorIsSet_ = false;
427     Dimension cursorRadius_;
428     Dimension fontSize_;
429     // Used under case of [obscure_ == true].
430     // When a character input, it will be displayed naked for a while.
431     // The remaining time to naked display the recent character is indicated by [obscureTickPendings_],
432     // multiply by [twinklingInterval]. For example, 3 * 500ms = 1500ms.
433     int32_t obscureTickPendings_ = 0;
434     // What the keyboard should appears.
435     TextInputType keyboard_ = TextInputType::TEXT;
436     // Action when "enter" pressed.
437     TextInputAction action_ = TextInputAction::UNSPECIFIED;
438     std::string actionLabel_;
439     uint32_t maxLength_ = std::numeric_limits<uint32_t>::max();
440     // Default to the start of text (according to RTL/LTR).
441     TextAlign textAlign_ = TextAlign::START;
442     // RTL/LTR is inherit from parent.
443     TextDirection textDirection_ = TextDirection::INHERIT;
444     TextDirection realTextDirection_ = TextDirection::INHERIT;
445     TextAffinity textAffinity_ = TextAffinity::DOWNSTREAM;
446 
447     TextStyle countTextStyle_;
448     TextStyle overCountStyle_;
449     TextStyle countTextStyleOuter_;
450     TextStyle overCountStyleOuter_;
451     TextStyle style_;
452     TextStyle placeHoldStyle_;
453     TextStyle editingStyle_;
454     std::string text_;
455     std::string errorText_;
456     TextStyle errorTextStyle_;
457     double errorSpacing_ = 0.0;
458     Dimension errorSpacingInDimension_;
459     // Place error text in or under input. In input when device is TV, under input when device is phone.
460     bool errorIsInner_ = false;
461     Dimension errorBorderWidth_;
462     Color errorBorderColor_;
463 
464     RefPtr<Decoration> decoration_;
465     Border originBorder_;
466 
467     // One line TextField is more common in usual cases.
468     uint32_t maxLines_ = 1;
469     size_t textLines_ = 0;
470     int32_t cursorPositionForShow_ = 0;
471     CursorPositionType cursorPositionType_ = CursorPositionType::NORMAL;
472     DirectionStatus directionStatus_ = DirectionStatus::LEFT_LEFT;
473 
474     bool showPasswordIcon_ = true; // Whether show password icon, effect only type is password.
475     bool showCounter_ = false; // Whether show counter, 10/100 means maxlength is 100 and 10 has been inputted.
476     bool overCount_ = false;   // Whether count of text is over limit.
477     bool obscure_ = false;     // Obscure the text, for example, password.
478     bool passwordRecord_ = true;   // Record the status of password display or non-display.
479     bool enabled_ = true;      // Whether input is disable of enable.
480     bool needFade_ = false;    // Fade in/out text when overflow.
481     bool blockRightShade_ = false;
482     bool isValueFromFront_ = false;           // Is value from developer-set.
483     bool isValueFromRemote_ = false;          // Remote value coming form typing, other is from clopboard.
484     bool existStrongDirectionLetter_ = false; // Whether exist strong direction letter in text.
485     bool isVisible_ = true;
486     bool needNotifyChangeEvent_ = false;
487     bool resetToStart_ = true;      // When finish inputting text, whether show header of text.
488     bool showEllipsis_ = false;     // When text is overflow, whether show ellipsis.
489     bool extend_ = false;           // Whether input support extend, this attribute is worked in textarea.
490     bool isCallbackCalled_ = false; // Whether custom font is loaded.
491     bool isOverlayShowed_ = false;  // Whether overlay has showed.
492     double textHeight_ = 0.0;       // Height of text.
493     double iconSize_ = 0.0;
494     double iconHotZoneSize_ = 0.0;
495     double extendHeight_ = 0.0;
496     double widthReservedForSearch_ = 0.0;  // Width reserved for delete icon of search.
497     double paddingHorizonForSearch_ = 0.0; // Width reserved for search button of search.
498     double selectHeight_ = 0.0;
499     Dimension height_;
500     Dimension iconSizeInDimension_;
501     Dimension iconHotZoneSizeInDimension_;
502     Dimension widthReserved_;
503     std::optional<LayoutParam> lastLayoutParam_;
504     std::optional<Color> imageFill_;
505     std::string iconSrc_;
506     std::string showIconSrc_;
507     std::string hideIconSrc_;
508     std::string inputCallBackStr_;
509     int32_t inputCallBackStrSize_ = 0;
510     RefPtr<RenderImage> iconImage_;
511     RefPtr<RenderImage> renderShowIcon_;
512     RefPtr<RenderImage> renderHideIcon_;
513 
514     Offset clickOffset_;
515     // For ensuring caret is visible on screen, we take a strategy that move the whole text painting area.
516     // It maybe seems rough, and doesn't support scrolling smoothly.
517     Offset textOffsetForShowCaret_;
518 
519 private:
520     void SetCallback(const RefPtr<TextFieldComponent>& textField);
521     void StartPressAnimation(bool isPressDown);
522     void ScheduleCursorTwinkling();
523     void OnCursorTwinkling();
524     void CursorMoveOnClick(const Offset& offset);
525     void UpdateRemoteEditing(bool needFireChangeEvent = true);
526     void UpdateObscure(const RefPtr<TextFieldComponent>& textField);
527     void UpdateFormatters();
528     void UpdateFocusStyles();
529     void UpdateIcon(const RefPtr<TextFieldComponent>& textField);
530     void UpdatePasswordIcon(const RefPtr<TextFieldComponent>& textField);
531     void UpdateOverlay();
532     void RegisterFontCallbacks();
533     void HandleOnCut();
534     void HandleOnCopy();
535     void HandleOnPaste();
536     void HandleOnCopyAll(const std::function<void(const Offset&, const Offset&)>& callback);
537     void HandleOnStartHandleMove(int32_t end, const Offset& startHandleOffset,
538         const std::function<void(const Offset&)>& startCallback, bool isSingleHandle = false);
539     void HandleOnEndHandleMove(
540         int32_t start, const Offset& endHandleOffset, const std::function<void(const Offset&)>& endCallback);
541     RefPtr<StackElement> GetLastStack() const;
542     void InitAnimation();
543     void RegisterCallbacksToOverlay();
544     void PushTextOverlayToStack();
545     void UpdateAccessibilityAttr();
546     void InitAccessibilityEventListener();
547     bool HandleKeyEvent(const KeyEvent& event);
548     void ClearEditingValue();
549     virtual bool GetCaretRect(int32_t extent, Rect& caretRect, double caretHeightOffset = 0.0) const = 0;
550     bool SearchAction(const Offset& globalPosition, const Offset& globalOffset);
551     void ChangeCounterStyle(const TextEditingValue& value);
552     void ChangeBorderToErrorStyle();
553     void HandleDeviceOrientationChange();
554     void OnOverlayFocusChange(bool isFocus, bool needCloseKeyboard);
555     void FireSelectChangeIfNeeded(const TextEditingValue& newValue, bool needFireSelectChangeEvent) const;
556     int32_t GetInstanceId() const;
557     void PopTextOverlay();
558 
559     /**
560      * @brief Update remote editing value only if text or selection is changed.
561      */
562     void UpdateRemoteEditingIfNeeded(bool needFireChangeEvent = true);
563 
564     void AttachIme();
565 
566     void ApplyRestoreInfo();
567 
568     int32_t initIndex_ = 0;
569     bool isOverlayFocus_ = false;
570     bool isShiftDown_ = false;
571     bool isCtrlDown_ = false;
572     bool hasFocus_ = false;
573     double fontScale_ = 1.0;
574     bool isSingleHandle_ = false;
575     bool hasTextOverlayPushed_ = false;
576     bool softKeyboardEnabled_ = true;
577     Color pressColor_;
578     TextSelection selection_; // Selection from custom.
579     DeviceOrientation deviceOrientation_ = DeviceOrientation::PORTRAIT;
580     std::function<void()> onValueChange_;
581     std::function<void(bool)> onKeyboardClose_;
582     std::function<void(const Rect&)> onClipRectChanged_;
583     std::function<void(const OverlayShowOption&)> updateHandlePosition_;
584     std::function<void(const double&)> updateHandleDiameter_;
585     std::function<void(const double&)> updateHandleDiameterInner_;
586     std::function<void(const std::string&)> onTextChangeEvent_;
587     std::function<void(std::string)> onChange_;
588     std::function<void(const ClickInfo& clickInfo)> onClick_;
589     std::function<void(const std::string&)> onError_;
590     std::function<void(bool)> onEditChanged_;
591     std::function<void(int32_t)> onSubmit_;
592     std::function<void(const std::string&)> onValueChangeEvent_;
593     std::function<void(const std::string&)> onSelectChangeEvent_;
594     std::function<void(const std::string&)> onFinishInputEvent_;
595     std::function<void(const std::string&)> onSubmitEvent_;
596     std::function<void()> onTapEvent_;
597     std::function<void()> onLongPressEvent_;
598     std::function<void()> moveNextFocusEvent_;
599     std::function<void(bool)> onOverlayFocusChange_;
600     std::function<bool()> onIsCurrentFocus_;
601     std::function<void(std::string)> onCopy_;
602     std::function<void(std::string)> onCut_;
603     std::function<void(std::string)> onPaste_;
604     EventMarker onOptionsClick_;
605     EventMarker onTranslate_;
606     EventMarker onShare_;
607     EventMarker onSearch_;
608     bool catchMode_ = true;
609     TapCallback tapCallback_;
610     CancelableCallback<void()> cursorTwinklingTask_;
611 
612     std::vector<InputOption> inputOptions_;
613     std::list<std::unique_ptr<TextInputFormatter>> textInputFormatters_;
614     RefPtr<TextEditController> controller_;
615     RefPtr<TextFieldController> textFieldController_;
616     RefPtr<TextInputConnection> connection_;
617     RefPtr<Clipboard> clipboard_;
618     RefPtr<TextOverlayComponent> textOverlay_;
619     WeakPtr<StackElement> stackElement_;
620     RefPtr<ClickRecognizer> clickRecognizer_;
621     RefPtr<ClickRecognizer> doubleClickRecognizer_;
622     RefPtr<LongPressRecognizer> longPressRecognizer_;
623     RefPtr<RawRecognizer> rawRecognizer_;
624     RefPtr<Animator> pressController_;
625     RefPtr<Animator> animator_;
626 #if defined(OHOS_STANDARD_SYSTEM) && !defined(WINDOWS_PLATFORM) && !defined(MAC_PLATFORM)
627     bool imeAttached_ = false;
628 #endif
629 
630 #if defined(ENABLE_STANDARD_INPUT)
631     sptr<OHOS::MiscServices::OnTextChangedListener> textChangeListener_;
632 #endif
633 };
634 
635 } // namespace OHOS::Ace
636 
637 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_TEXT_FIELD_RENDER_TEXT_FIELD_H
638