[NUI] remove redundant private field in View class (#2513)
authorYeongJong Lee <cleanlyj@naver.com>
Tue, 12 Jan 2021 03:03:19 +0000 (12:03 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Tue, 19 Jan 2021 05:32:11 +0000 (14:32 +0900)
* [NUI] remove redundant private field in View class

No logical changes.

src/Tizen.NUI/src/public/BaseComponents/View.cs

index 81ce0a5ce3137eeac4a5c36cd05a2c09555e8f03..930fa1a6cfdece56bc8702218c6ab24ac0a2eb9d 100755 (executable)
@@ -39,8 +39,6 @@ namespace Tizen.NUI.BaseComponents
         private Dictionary<TransitionCondition, TransitionList> layoutTransitions;
         private int widthPolicy = LayoutParamPolicies.WrapContent; // Layout width policy
         private int heightPolicy = LayoutParamPolicies.WrapContent; // Layout height policy
-        private int oldWidthPolicy = LayoutParamPolicies.MatchParent; // // Store Layout width to compare against later
-        private int oldHeightPolicy = LayoutParamPolicies.MatchParent; // Store Layout height to compare against later
         private float weight = 0.0f; // Weighting of child View in a Layout
         private bool backgroundImageSynchronosLoading = false;
         private Dictionary<string, Transition> transDictionary = new Dictionary<string, Transition>();
@@ -2000,20 +1998,19 @@ namespace Tizen.NUI.BaseComponents
             }
             set
             {
+                if (value == widthPolicy)
+                    return;
+
                 widthPolicy = value;
-                if (oldWidthPolicy != widthPolicy)
+                if (widthPolicy >= 0)
                 {
-                    if (widthPolicy >= 0)
+                    if (heightPolicy >= 0) // Policy an exact value
                     {
-                        if (heightPolicy >= 0) // Policy an exact value
-                        {
-                            // Create Size2D only both _widthPolicy and _heightPolicy are set.
-                            Size2D = new Size2D(widthPolicy, heightPolicy);
-                        }
+                        // Create Size2D only both _widthPolicy and _heightPolicy are set.
+                        Size2D = new Size2D(widthPolicy, heightPolicy);
                     }
-                    layout?.RequestLayout();
-                    oldWidthPolicy = widthPolicy;
                 }
+                layout?.RequestLayout();
             }
         }
 
@@ -2029,21 +2026,19 @@ namespace Tizen.NUI.BaseComponents
             }
             set
             {
+                if (value == heightPolicy)
+                    return;
+
                 heightPolicy = value;
-                if (oldHeightPolicy != heightPolicy)
+                if (heightPolicy >= 0)
                 {
-                    if (heightPolicy >= 0)
+                    if (widthPolicy >= 0) // Policy an exact value
                     {
-                        if (widthPolicy >= 0) // Policy an exact value
-                        {
-                            // Create Size2D only both _widthPolicy and _heightPolicy are set.
-                            Size2D = new Size2D(widthPolicy, heightPolicy);
-                        }
-
+                        // Create Size2D only both _widthPolicy and _heightPolicy are set.
+                        Size2D = new Size2D(widthPolicy, heightPolicy);
                     }
-                    layout?.RequestLayout();
-                    oldHeightPolicy = heightPolicy;
                 }
+                layout?.RequestLayout();
             }
         }