[NUI] Fix crash when background color of webview is set. (#3078)
authorhuayongxu <49056704+huayongxu@users.noreply.github.com>
Wed, 26 May 2021 09:36:51 +0000 (17:36 +0800)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Thu, 27 May 2021 02:40:59 +0000 (11:40 +0900)
src/Tizen.NUI/src/internal/Interop/Interop.WebContext.cs
src/Tizen.NUI/src/internal/WebView/WebContext.cs
src/Tizen.NUI/src/internal/WebView/WebView.cs

index c7eaa99..2d1c3a1 100755 (executable)
@@ -85,19 +85,19 @@ namespace Tizen.NUI
             public static extern string GetCertificateFilePath(global::System.Runtime.InteropServices.HandleRef jarg1);
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebContext_SetContextAppId")]
-            public static extern void SetContextAppId(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
+            public static extern void SetAppId(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebContext_SetContextAppVersion")]
-            public static extern bool SetContextAppVersion(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
+            public static extern bool SetAppVersion(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebContext_SetContextApplicationType")]
-            public static extern void SetContextApplicationType(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
+            public static extern void SetApplicationType(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebContext_SetContextTimeOffset")]
-            public static extern void SetContextTimeOffset(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2);
+            public static extern void SetTimeOffset(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2);
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebContext_SetContextTimeZoneOffset")]
-            public static extern void SetContextTimeZoneOffset(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3);
+            public static extern void SetTimeZoneOffset(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3);
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebContext_RegisterUrlSchemesAsCorsEnabled")]
             public static extern void RegisterUrlSchemesAsCorsEnabled(global::System.Runtime.InteropServices.HandleRef jarg1, string[] jarg2, uint jarg3);
@@ -127,10 +127,10 @@ namespace Tizen.NUI
             public static extern void DeleteAllFormCandidateData(global::System.Runtime.InteropServices.HandleRef jarg1);
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebContext_GetContextProxy")]
-            public static extern string GetContextProxy(global::System.Runtime.InteropServices.HandleRef jarg1);
+            public static extern string GetProxyUri(global::System.Runtime.InteropServices.HandleRef jarg1);
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebContext_SetContextProxy")]
-            public static extern void SetContextProxy(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3);
+            public static extern void SetProxyBypassRule(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3);
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebContext_GetProxyBypassRule")]
             public static extern string GetProxyBypassRule(global::System.Runtime.InteropServices.HandleRef jarg1);
index 0e10227..729b205 100755 (executable)
@@ -27,7 +27,6 @@ namespace Tizen.NUI
     [EditorBrowsable(EditorBrowsableState.Never)]
     public class WebContext : Disposable
     {
-        private string proxyUrl;
         private string appId;
         private string appVersion;
         private float timeOffset;
@@ -165,7 +164,7 @@ namespace Tizen.NUI
         {
             get
             {
-                return proxyUrl;
+                return Interop.WebContext.GetProxyUri(SwigCPtr);
             }
             set
             {
@@ -173,7 +172,6 @@ namespace Tizen.NUI
                 {
                     Interop.WebContext.SetProxyUri(SwigCPtr, value);
                     if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-                    proxyUrl = value;
                 }
             }
         }
@@ -224,7 +222,7 @@ namespace Tizen.NUI
             }
             set
             {
-                Interop.WebContext.SetContextAppId(SwigCPtr, value);
+                Interop.WebContext.SetAppId(SwigCPtr, value);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
                 appId = value;
             }
@@ -242,7 +240,7 @@ namespace Tizen.NUI
             }
             set
             {
-                Interop.WebContext.SetContextAppVersion(SwigCPtr, value);
+                Interop.WebContext.SetAppVersion(SwigCPtr, value);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
                 appVersion = value;
             }
@@ -260,7 +258,7 @@ namespace Tizen.NUI
             }
             set
             {
-                Interop.WebContext.SetContextApplicationType(SwigCPtr, (int)value);
+                Interop.WebContext.SetApplicationType(SwigCPtr, (int)value);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
                 applicationType = value;
             }
@@ -278,7 +276,7 @@ namespace Tizen.NUI
             }
             set
             {
-                Interop.WebContext.SetContextTimeOffset(SwigCPtr, value);
+                Interop.WebContext.SetTimeOffset(SwigCPtr, value);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
                 timeOffset = value;
             }
@@ -302,14 +300,14 @@ namespace Tizen.NUI
         }
 
         /// <summary>
-        /// Gets context proxy.
+        /// Deprecated. Gets context proxy.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
         public string ContextProxy
         {
             get
             {
-                return Interop.WebContext.GetContextProxy(SwigCPtr);
+                return Interop.WebContext.GetProxyUri(SwigCPtr);
             }
         }
 
@@ -496,36 +494,47 @@ namespace Tizen.NUI
         /// <param name="time">Daylight saving time</param>
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public void SetContextTimeZoneOffset(float offset, float time)
+        public void SetTimeZoneOffset(float offset, float time)
         {
-            Interop.WebContext.SetContextTimeZoneOffset(SwigCPtr, offset, time);
+            Interop.WebContext.SetTimeZoneOffset(SwigCPtr, offset, time);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
         /// <summary>
+        /// Deprecated. Sets context time zone offset.
+        /// <param name="offset">Time offset</param>
+        /// <param name="time">Daylight saving time</param>
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SetContextTimeZoneOffset(float offset, float time)
+        {
+            SetTimeZoneOffset(offset, time);
+        }
+
+        /// <summary>
         /// Registers url schemes enabled.
-        /// <param name="strArray">The string array of schemes</param>
+        /// <param name="schemes">The string array of schemes</param>
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public void RegisterUrlSchemesAsCorsEnabled(string[] strArray)
+        public void RegisterUrlSchemesAsCorsEnabled(string[] schemes)
         {
-            if (strArray != null)
+            if (schemes != null)
             {
-                Interop.WebContext.RegisterUrlSchemesAsCorsEnabled(SwigCPtr, strArray, (uint)strArray.Length);
+                Interop.WebContext.RegisterUrlSchemesAsCorsEnabled(SwigCPtr, schemes, (uint)schemes.Length);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             }
         }
 
         /// <summary>
         /// Registers js plugin mime types.
-        /// <param name="strArray">The string array of types</param>
+        /// <param name="mimes">The string array of types</param>
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public void RegisterJsPluginMimeTypes(string[] strArray)
+        public void RegisterJsPluginMimeTypes(string[] mimes)
         {
-            if (strArray != null)
+            if (mimes != null)
             {
-                Interop.WebContext.RegisterJsPluginMimeTypes(SwigCPtr, strArray, (uint)strArray.Length);
+                Interop.WebContext.RegisterJsPluginMimeTypes(SwigCPtr, mimes, (uint)mimes.Length);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             }
         }
@@ -554,14 +563,14 @@ namespace Tizen.NUI
 
         /// <summary>
         /// Deletes password dataList.
-        /// <param name="strArray">The string array of dataList</param>
+        /// <param name="passwords">The string array of data list</param>
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public void DeleteFormPasswordDataList(string[] strArray)
+        public void DeleteFormPasswordDataList(string[] passwords)
         {
-            if (strArray != null)
+            if (passwords != null)
             {
-                Interop.WebContext.DeleteFormPasswordDataList(SwigCPtr, strArray, (uint)strArray.Length);
+                Interop.WebContext.DeleteFormPasswordDataList(SwigCPtr, passwords, (uint)passwords.Length);
                 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
             }
         }
@@ -587,18 +596,29 @@ namespace Tizen.NUI
         }
 
         /// <summary>
-        /// Sets context proxy.
-        /// <param name="proxy">The string array of dataList</param>
+        /// Sets proxy bypass rule.
+        /// <param name="proxy">The proxy string</param>
         /// <param name="rule">Bypass rule</param>
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public void SetContextProxy(string proxy, string rule)
+        public void SetProxyBypassRule(string proxy, string rule)
         {
-            Interop.WebContext.SetContextProxy(SwigCPtr, proxy, rule);
+            Interop.WebContext.SetProxyBypassRule(SwigCPtr, proxy, rule);
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
         /// <summary>
+        /// Deprecated. Sets proxy bypass rule.
+        /// <param name="proxy">The proxy string</param>
+        /// <param name="rule">Bypass rule</param>
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SetContextProxy(string proxy, string rule)
+        {
+            SetProxyBypassRule(proxy, rule);
+        }
+
+        /// <summary>
         /// Frees unused memory.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
index 3c303f4..fe45549 100755 (executable)
@@ -30,7 +30,7 @@ namespace Tizen.NUI
     [EditorBrowsable(EditorBrowsableState.Never)]
     public class WebView : View
     {
-        private Vector4 contentBackgroundColor;
+        private Color contentBackgroundColor;
         private bool tilesClearedWhenHidden;
         private float tileCoverAreaMultiplier;
         private bool cursorEnabledByClient;
@@ -1381,13 +1381,13 @@ namespace Tizen.NUI
             return temp;
         });
 
-        private static readonly BindableProperty ContentBackgroundColorProperty = BindableProperty.Create(nameof(ContentBackgroundColor), typeof(Vector4), typeof(WebView), null, propertyChanged: (bindable, oldValue, newValue) =>
+        private static readonly BindableProperty ContentBackgroundColorProperty = BindableProperty.Create(nameof(ContentBackgroundColor), typeof(Color), typeof(WebView), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
             var webview = (WebView)bindable;
             if (newValue != null)
             {
-                webview.contentBackgroundColor = (Vector4)newValue;
-                Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.DocumentBackgroundColor, new Tizen.NUI.PropertyValue((Vector4)newValue));
+                webview.contentBackgroundColor = (Color)newValue;
+                Tizen.NUI.Object.SetProperty(webview.SwigCPtr, WebView.Property.DocumentBackgroundColor, new Tizen.NUI.PropertyValue((Color)newValue));
             }
         },
         defaultValueCreator: (bindable) =>