[jit] Enable partial generic sharing when not using AOT as an experiment.
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / TextBoxBase.cs
index 3dea48f5111313000653d0f8724bbe0d0c56b576..e3c1a70f5cfa98867c03c559fb6c6b8c3afcb28b 100644 (file)
@@ -237,8 +237,8 @@ namespace System.Windows.Forms
                                if (value != auto_size) {
                                        auto_size = value;
                                        if (auto_size) {
-                                               if (PreferredHeight != ClientSize.Height) {
-                                                       ClientSize = new Size(ClientSize.Width, PreferredHeight);
+                                               if (PreferredHeight != Height) {
+                                                       Height = PreferredHeight;
                                                }
                                        }
                                }
@@ -466,14 +466,16 @@ namespace System.Windows.Forms
                [Browsable(false)]
                [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
                [EditorBrowsable(EditorBrowsableState.Advanced)]
+               // This returns the preferred outer height, not the client height.
                public int PreferredHeight {
                        get {
+                               int clientDelta = Height - ClientSize.Height;
                                if (BorderStyle != BorderStyle.None)
-                                       return Font.Height + 7;
+                                       return Font.Height + 7 + clientDelta;
 
                                // usually in borderless mode the top margin is 0, but
                                // try to access it, in case it was set manually, as ToolStrip* controls do
-                               return Font.Height + TopMargin;
+                               return Font.Height + TopMargin + clientDelta;
                        }
                }
 
@@ -510,6 +512,9 @@ namespace System.Windows.Forms
                        }
 
                        set {
+                               if (value == null)
+                                       value = String.Empty;
+
                                document.ReplaceSelection(CaseAdjust(value), false);
 
                                ScrollToCaret();
@@ -990,7 +995,7 @@ namespace System.Windows.Forms
                        base.OnFontChanged (e);
 
                        if (auto_size && !document.multiline) {
-                               if (PreferredHeight != ClientSize.Height) {
+                               if (PreferredHeight != Height) {
                                        Height = PreferredHeight;
                                }
                        }
@@ -1660,9 +1665,13 @@ namespace System.Windows.Forms
                }
 
                // XXX should this not manipulate base.Paint?
+#pragma warning disable 0067
+               [MonoTODO]
                [Browsable(false)]
                [EditorBrowsable(EditorBrowsableState.Never)]
                public new event PaintEventHandler Paint;
+#pragma warning restore 0067
+
                #endregion      // Events
 
                #region Private Methods
@@ -1759,8 +1768,8 @@ namespace System.Windows.Forms
                {
                        if (!richtext) {
                                if (!document.multiline) {
-                                       if (PreferredHeight != ClientSize.Height) {
-                                               ClientSize = new Size (ClientSize.Width, PreferredHeight);
+                                       if (PreferredHeight != Height) {
+                                               Height = PreferredHeight;
                                        }
                                }
                        }