[NUI] Use IsSet replace changedPropertiesSet
authorXianbing Teng <xb.teng@samsung.com>
Tue, 21 Jun 2022 12:10:05 +0000 (20:10 +0800)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 28 Jun 2022 10:14:54 +0000 (19:14 +0900)
src/Tizen.NUI/src/public/XamlBinding/BindableObject.cs

index 8127a5d..792fcdb 100755 (executable)
@@ -94,14 +94,10 @@ namespace Tizen.NUI.Binding
                 {
                     nameToBindableProperty2.TryGetValue(keyValuePair.Key, out var bindableProperty);
 
-                    if (null != bindableProperty && (ChangedPropertiesSet.Contains(bindableProperty) || other.ChangedPropertiesSet.Contains(bindableProperty)))
+                    if (null != bindableProperty && other.IsSet(bindableProperty))
                     {
                         object value = other.GetValue(bindableProperty);
-
-                        if (null != value)
-                        {
-                            InternalSetValue(keyValuePair.Value, value);
-                        }
+                        InternalSetValue(keyValuePair.Value, value);
                     }
                 }
             }
@@ -323,43 +319,20 @@ namespace Tizen.NUI.Binding
                     throw new ArgumentNullException(nameof(property));
                 }
 
+                object oldvalue = null;
                 BindablePropertyContext context = GetOrCreateContext(property);
                 if (null != context)
                 {
                     context.Attributes |= BindableContextAttributes.IsManuallySet;
-                }
-                object oldvalue = null;
-                if (null == property.DefaultValueCreator)
-                {
                     oldvalue = context.Value;
                     context.Value = value;
                 }
-                else
-                {
-                    oldvalue = property.DefaultValueCreator.Invoke(this);
-                }
 
                 property.PropertyChanged?.Invoke(this, oldvalue, value);
 
                 OnPropertyChanged(property.PropertyName);
                 OnPropertyChangedWithData(property);
             }
-
-            ChangedPropertiesSet.Add(property);
-        }
-
-        private HashSet<BindableProperty> changedPropertiesSet;
-        private HashSet<BindableProperty> ChangedPropertiesSet
-        {
-            get
-            {
-                if (null == changedPropertiesSet)
-                {
-                    changedPropertiesSet = new HashSet<BindableProperty>();
-                }
-
-                return changedPropertiesSet;
-            }
         }
 
         private HashSet<BindableProperty> changedPropertiesSetExcludingStyle;