Revert "[NUI] Ignore ResizePolicy when View size is calculated by Layout"
authorJaehyun Cho <jae_hyun.cho@samsung.com>
Fri, 12 Nov 2021 10:55:11 +0000 (19:55 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 17 Nov 2021 08:08:13 +0000 (17:08 +0900)
This reverts commit eeaaecd33da254f5447910ecd9b0cab89407d4ba.

By applying the original PR, TextLabel size could not be calculated
correctly because TextLabel size should be calculated in DALi.

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

index 25ad045..cb3f1c0 100755 (executable)
@@ -1948,9 +1948,6 @@ namespace Tizen.NUI.BaseComponents
             }
             set
             {
-                // Store ResizePolicy to restore it when Layout is unset.
-                widthResizePolicy = value;
-
                 SetValue(WidthResizePolicyProperty, value);
                 NotifyPropertyChanged();
             }
@@ -1968,9 +1965,6 @@ namespace Tizen.NUI.BaseComponents
             }
             set
             {
-                // Store ResizePolicy to restore it when Layout is unset.
-                heightResizePolicy = value;
-
                 SetValue(HeightResizePolicyProperty, value);
                 NotifyPropertyChanged();
             }
@@ -2703,13 +2697,6 @@ namespace Tizen.NUI.BaseComponents
             }
             set
             {
-                // ResizePolicy is restored when Layout is unset and it is considered when View size is calculated.
-                // SetValue(LayoutProperty, value) sets InternalLayout only if layout is not null.
-                if (value == null)
-                {
-                    RestoreResizePolicy();
-                }
-
                 SetValue(LayoutProperty, value);
             }
         }
index 064a2c4..319d96b 100755 (executable)
@@ -31,14 +31,6 @@ namespace Tizen.NUI.BaseComponents
     public partial class View
     {
         private MergedStyle mergedStyle = null;
-
-        // Ignore WidthResizePolicy and HeightResizePolicy when Layout is set.
-        // Restore WidthResizePolicy and HeightResizePolicy when Layout is unset.
-        // See also IgnoreResizePolicy() and RestoreResizePolicy().
-        private ResizePolicyType widthResizePolicy = ResizePolicyType.Fixed;
-        private ResizePolicyType heightResizePolicy = ResizePolicyType.Fixed;
-        private bool isIgnoredResizePolicy = false;
-
         internal string styleName;
 
         internal MergedStyle MergedStyle
@@ -197,17 +189,6 @@ namespace Tizen.NUI.BaseComponents
 
         internal void SetLayout(LayoutItem layout)
         {
-            // ResizePolicy is restored when Layout is unset and it is considered when View size is calculated.
-            if (layout == null)
-            {
-                RestoreResizePolicy();
-            }
-            // ResizePolicy is stored when Layout is set and it is ignored when View size is calculated.
-            else
-            {
-                IgnoreResizePolicy();
-            }
-
             Window.Instance.LayoutController.CreateProcessCallback();
             this.layout = layout;
             this.layout?.AttachToOwner(this);
@@ -1029,8 +1010,6 @@ namespace Tizen.NUI.BaseComponents
         /// </summary>
         internal void ResetLayout()
         {
-            // ResizePolicy is restored when Layout is unset and it is considered when View size is calculated.
-            RestoreResizePolicy();
             layout = null;
         }
 
@@ -1509,32 +1488,5 @@ namespace Tizen.NUI.BaseComponents
 
             return themeData.selectorData ?? (themeData.selectorData = new ViewSelectorData());
         }
-
-        // ResizePolicy is stored when Layout is set and it is ignored when View size is calculated.
-        private void IgnoreResizePolicy()
-        {
-            if (isIgnoredResizePolicy) return;
-            isIgnoredResizePolicy = true;
-
-            widthResizePolicy = WidthResizePolicy;
-            heightResizePolicy = HeightResizePolicy;
-
-            // Set bindable property directly not to store width/heightResizePolicy duplicately.
-            SetValue(WidthResizePolicyProperty, ResizePolicyType.Fixed);
-            SetValue(HeightResizePolicyProperty, ResizePolicyType.Fixed);
-            NotifyPropertyChanged();
-        }
-
-        // ResizePolicy is restored when Layout is unset and it is considered when View size is calculated.
-        private void RestoreResizePolicy()
-        {
-            if (!isIgnoredResizePolicy) return;
-            isIgnoredResizePolicy = false;
-
-            // Set bindable property directly not to store width/heightResizePolicy duplicately.
-            SetValue(WidthResizePolicyProperty, widthResizePolicy);
-            SetValue(HeightResizePolicyProperty, heightResizePolicy);
-            NotifyPropertyChanged();
-        }
     }
 }