internal TextInputBase()
            {
                isReadOnly = false;
                focusable  = true;

                AddToClassList(inputUssClassName);
                m_Text = string.Empty;
                name   = TextField.textInputUssName;

                requireMeasureFunction = true;

                editorEngine = new TextEditorEngine(OnDetectFocusChange, OnCursorIndexChange);

                if (touchScreenTextField)
                {
                    editorEventHandler = new TouchScreenTextEditorEventHandler(editorEngine, this);
                }
                else
                {
                    // TODO: Default values should come from GUI.skin.settings
                    doubleClickSelectsWord = true;
                    tripleClickSelectsLine = true;

                    editorEventHandler = new KeyboardTextEditorEventHandler(editorEngine, this);
                }

                // Make the editor style unique across all textfields
                editorEngine.style = new GUIStyle(editorEngine.style);

                RegisterCallback <CustomStyleResolvedEvent>(OnCustomStyleResolved);
                RegisterCallback <AttachToPanelEvent>(OnAttachToPanel);
                this.generateVisualContent += OnGenerateVisualContent;
            }
            internal void DrawWithTextSelectionAndCursor(MeshGenerationContext mgc, string newText, float pixelsPerPoint)
            {
                Color playmodeTintColor = (base.panel.contextType == ContextType.Editor) ? UIElementsUtility.editorPlayModeTintColor : Color.white;
                KeyboardTextEditorEventHandler keyboardTextEditorEventHandler = this.editorEventHandler as KeyboardTextEditorEventHandler;
                bool flag = keyboardTextEditorEventHandler == null;

                if (!flag)
                {
                    keyboardTextEditorEventHandler.PreDrawCursor(newText);
                    int     cursorIndex   = this.editorEngine.cursorIndex;
                    int     selectIndex   = this.editorEngine.selectIndex;
                    Rect    localPosition = this.editorEngine.localPosition;
                    Vector2 scrollOffset  = this.editorEngine.scrollOffset;
                    float   scaling       = TextHandle.ComputeTextScaling(base.worldTransform, pixelsPerPoint);
                    MeshGenerationContextUtils.TextParams textParams = MeshGenerationContextUtils.TextParams.MakeStyleBased(this, this.text);
                    textParams.text          = " ";
                    textParams.wordWrapWidth = 0f;
                    textParams.wordWrap      = false;
                    float num           = this.m_TextHandle.ComputeTextHeight(textParams, scaling);
                    float wordWrapWidth = 0f;
                    bool  flag2         = this.editorEngine.multiline && base.resolvedStyle.whiteSpace == WhiteSpace.Normal;
                    if (flag2)
                    {
                        wordWrapWidth = base.contentRect.width;
                    }
                    Vector2 p = this.editorEngine.graphicalCursorPos - scrollOffset;
                    p.y += num;
                    GUIUtility.compositionCursorPos = this.LocalToWorld(p);
                    Color cursorColor = this.cursorColor;
                    int   num2        = string.IsNullOrEmpty(GUIUtility.compositionString) ? selectIndex : (cursorIndex + GUIUtility.compositionString.Length);
                    bool  flag3       = cursorIndex != num2 && !this.isDragging;
                    if (flag3)
                    {
                        int cursorIndex2 = (cursorIndex < num2) ? cursorIndex : num2;
                        int cursorIndex3 = (cursorIndex > num2) ? cursorIndex : num2;
                        CursorPositionStylePainterParameters @default = CursorPositionStylePainterParameters.GetDefault(this, this.text);
                        @default.text          = this.editorEngine.text;
                        @default.wordWrapWidth = wordWrapWidth;
                        @default.cursorIndex   = cursorIndex2;
                        Vector2 vector = this.m_TextHandle.GetCursorPosition(@default, scaling);
                        @default.cursorIndex = cursorIndex3;
                        Vector2 vector2 = this.m_TextHandle.GetCursorPosition(@default, scaling);
                        vector  -= scrollOffset;
                        vector2 -= scrollOffset;
                        bool flag4 = Mathf.Approximately(vector.y, vector2.y);
                        if (flag4)
                        {
                            mgc.Rectangle(new MeshGenerationContextUtils.RectangleParams
                            {
                                rect              = new Rect(vector.x, vector.y, vector2.x - vector.x, num),
                                color             = this.selectionColor,
                                playmodeTintColor = playmodeTintColor
                            });
                        }
                        else
                        {
                            mgc.Rectangle(new MeshGenerationContextUtils.RectangleParams
                            {
                                rect              = new Rect(vector.x, vector.y, base.contentRect.xMax - vector.x, num),
                                color             = this.selectionColor,
                                playmodeTintColor = playmodeTintColor
                            });
                            float num3  = vector2.y - vector.y - num;
                            bool  flag5 = num3 > 0f;
                            if (flag5)
                            {
                                mgc.Rectangle(new MeshGenerationContextUtils.RectangleParams
                                {
                                    rect              = new Rect(base.contentRect.xMin, vector.y + num, base.contentRect.width, num3),
                                    color             = this.selectionColor,
                                    playmodeTintColor = playmodeTintColor
                                });
                            }
                            bool flag6 = vector2.x != base.contentRect.x;
                            if (flag6)
                            {
                                mgc.Rectangle(new MeshGenerationContextUtils.RectangleParams
                                {
                                    rect              = new Rect(base.contentRect.xMin, vector2.y, vector2.x, num),
                                    color             = this.selectionColor,
                                    playmodeTintColor = playmodeTintColor
                                });
                            }
                        }
                    }
                    bool flag7 = !string.IsNullOrEmpty(this.editorEngine.text) && base.contentRect.width > 0f && base.contentRect.height > 0f;
                    if (flag7)
                    {
                        textParams      = MeshGenerationContextUtils.TextParams.MakeStyleBased(this, this.text);
                        textParams.rect = new Rect(base.contentRect.x - scrollOffset.x, base.contentRect.y - scrollOffset.y, base.contentRect.width + scrollOffset.x, base.contentRect.height + scrollOffset.y);
                        textParams.text = this.editorEngine.text;
                        mgc.Text(textParams, this.m_TextHandle, base.scaledPixelsPerPoint);
                    }
                    bool flag8 = !this.isReadOnly && !this.isDragging;
                    if (flag8)
                    {
                        bool flag9 = cursorIndex == num2 && base.computedStyle.unityFont.value != null;
                        if (flag9)
                        {
                            CursorPositionStylePainterParameters @default = CursorPositionStylePainterParameters.GetDefault(this, this.text);
                            @default.text          = this.editorEngine.text;
                            @default.wordWrapWidth = wordWrapWidth;
                            @default.cursorIndex   = cursorIndex;
                            Vector2 vector3 = this.m_TextHandle.GetCursorPosition(@default, scaling);
                            vector3 -= scrollOffset;
                            mgc.Rectangle(new MeshGenerationContextUtils.RectangleParams
                            {
                                rect              = new Rect(vector3.x, vector3.y, 1f, num),
                                color             = cursorColor,
                                playmodeTintColor = playmodeTintColor
                            });
                        }
                        bool flag10 = this.editorEngine.altCursorPosition != -1;
                        if (flag10)
                        {
                            CursorPositionStylePainterParameters @default = CursorPositionStylePainterParameters.GetDefault(this, this.text);
                            @default.text          = this.editorEngine.text.Substring(0, this.editorEngine.altCursorPosition);
                            @default.wordWrapWidth = wordWrapWidth;
                            @default.cursorIndex   = this.editorEngine.altCursorPosition;
                            Vector2 vector4 = this.m_TextHandle.GetCursorPosition(@default, scaling);
                            vector4 -= scrollOffset;
                            mgc.Rectangle(new MeshGenerationContextUtils.RectangleParams
                            {
                                rect              = new Rect(vector4.x, vector4.y, 1f, num),
                                color             = cursorColor,
                                playmodeTintColor = playmodeTintColor
                            });
                        }
                    }
                    keyboardTextEditorEventHandler.PostDrawCursor();
                }
            }