[NUI] Fix Dispose warning error[CA1001] (#2130)
authorhuiyueun <35286162+huiyueun@users.noreply.github.com>
Wed, 28 Oct 2020 09:45:17 +0000 (18:45 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 4 Nov 2020 08:17:17 +0000 (17:17 +0900)
* [NUI] Fix DisposeQueue warning error[CA1001]

CA100: Types that own disposable fields should be disposable
https://docs.microsoft.com/ko-kr/dotnet/fundamentals/code-analysis/quality-rules/ca1001

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* [NUI] Fix Accessibility build warnings

CA100: Types that own disposable fields should be disposable
https://docs.microsoft.com/ko-kr/dotnet/fundamentals/code-analysis/quality-rules/ca1001

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* [NUI] Fix build warnings- 1001

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* [NUI] Add destructor

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
Co-authored-by: WonYoung Choi <wy80.choi@samsung.com>
12 files changed:
src/Tizen.NUI/src/internal/Disposable.cs
src/Tizen.NUI/src/internal/DisposeQueue.cs
src/Tizen.NUI/src/internal/FrameBroker/FrameData.cs
src/Tizen.NUI/src/public/Accessibility/Accessibility.cs
src/Tizen.NUI/src/public/BaseComponents/Style/ViewStyle.cs
src/Tizen.NUI/src/public/KeyValue.cs
src/Tizen.NUI/src/public/Layouting/LayoutItem.cs
src/Tizen.NUI/src/public/Layouting/LayoutTransition.cs
src/Tizen.NUI/src/public/Layouting/LinearLayout.cs
src/Tizen.NUI/src/public/ViewProperty/BackgroundExtraData.cs [changed mode: 0644->0755]
src/Tizen.NUI/src/public/ViewProperty/TextShadow.cs
src/Tizen.NUI/src/public/VisualMaps.cs

index 67be1d3..4c98a34 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -95,6 +95,21 @@ namespace Tizen.NUI
         }
 
         /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        /// <param name="disposing">If true, disposes any disposable objects. If false, does not dispose disposable objects.</param>
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposed) return;
+            if (disposing)
+            {
+            }
+            disposed = true;
+        }
+
+        /// <summary>
         /// Dispose.
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
index b69ed23..45d4c0f 100755 (executable)
@@ -12,7 +12,7 @@ using System.Collections.Generic;
 
 namespace Tizen.NUI
 {
-    internal class DisposeQueue
+    internal class DisposeQueue : IDisposable
     {
         private static readonly DisposeQueue _disposableQueue = new DisposeQueue();
         private List<IDisposable> _disposables = new List<IDisposable>();
@@ -24,10 +24,6 @@ namespace Tizen.NUI
         {
         }
 
-        ~DisposeQueue()
-        {
-        }
-
         public static DisposeQueue Instance
         {
             get { return _disposableQueue; }
@@ -68,5 +64,10 @@ namespace Tizen.NUI
                 _disposables.Clear();
             }
         }
+
+        public void Dispose()
+        {
+            ProcessDisposables();
+        }
     }
 }
index 7dad750..cd89d80 100755 (executable)
@@ -25,20 +25,29 @@ namespace Tizen.NUI
     /// <summary>
     /// Represents the Frame Data.
     /// </summary>
-    internal class FrameData
+    internal class FrameData : Disposable
     {
-        private const string LogTag = "NUI";
-        private readonly IntPtr _frame;
-        private int _fd = -1;
-        private uint _size = 0;
-        private ImageView _image = null;
+        private const string logTag = "NUI";
+        private readonly IntPtr frame;
+        private int fd = -1;
+        private uint size = 0;
+        private ImageView image = null;
 
         private Renderer renderer;
         private TextureSet textureSet;
 
         internal FrameData(IntPtr frame)
         {
-            _frame = frame;
+            this.frame = frame;
+        }
+
+        /// <summary>  
+        /// destructor. This is HiddenAPI. recommended not to use in public.   
+        /// </summary> 
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        ~FrameData()
+        {
+            Dispose();
         }
 
         private Shader CreateShader()
@@ -133,9 +142,9 @@ namespace Tizen.NUI
         {
             get
             {
-                if (_image == null)
+                if (image == null)
                 {
-                    _image = new ImageView();
+                    image = new ImageView();
                     renderer = new Renderer(CreateQuadGeometry(), CreateShader());
                     textureSet = new TextureSet();
                 }
@@ -148,13 +157,13 @@ namespace Tizen.NUI
                         }
                         textureSet.SetTexture(0, new Texture(TbmSurface));
                         renderer.SetTextures(textureSet);
-                        _image.AddRenderer(renderer);
+                        image.AddRenderer(renderer);
                         break;
                     default:
                         break;
                 }
 
-                return _image;
+                return image;
             }
         }
 
@@ -166,10 +175,10 @@ namespace Tizen.NUI
             get
             {
                 Interop.FrameBroker.FrameDirection direction = Interop.FrameBroker.FrameDirection.Backward + 1;
-                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetDirection(_frame, out direction);
+                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetDirection(frame, out direction);
                 if (err != Interop.FrameBroker.ErrorCode.None)
                 {
-                    Log.Error(LogTag, "Failed to get direction");
+                    Log.Error(logTag, "Failed to get direction");
                 }
                 return (direction == Interop.FrameBroker.FrameDirection.Forward);
             }
@@ -183,10 +192,10 @@ namespace Tizen.NUI
             get
             {
                 SafeBundleHandle safeBundle;
-                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetExtraData(_frame, out safeBundle);
+                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetExtraData(frame, out safeBundle);
                 if (err != Interop.FrameBroker.ErrorCode.None)
                 {
-                    Log.Error(LogTag, "Failed to get extra data");
+                    Log.Error(logTag, "Failed to get extra data");
                     return null;
                 }
                 return new Bundle(safeBundle);
@@ -246,11 +255,11 @@ namespace Tizen.NUI
             get
             {
                 IntPtr tbmSurface = IntPtr.Zero;
-                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetTbmSurface(_frame, out tbmSurface);
+                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetTbmSurface(frame, out tbmSurface);
 
                 if (err != Interop.FrameBroker.ErrorCode.None)
                 {
-                    Log.Error(LogTag, "Failed to get tbm surface");
+                    Log.Error(logTag, "Failed to get tbm surface");
                 }
                 return tbmSurface;
             }
@@ -263,15 +272,15 @@ namespace Tizen.NUI
         {
             get
             {
-                if (_fd != -1)
-                    return _fd;
+                if (fd != -1)
+                    return fd;
 
-                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetImageFile(_frame, out _fd, out _size);
+                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetImageFile(frame, out fd, out size);
                 if (err != Interop.FrameBroker.ErrorCode.None)
                 {
-                    Log.Error(LogTag, "Failed to get fd of image file");
+                    Log.Error(logTag, "Failed to get fd of image file");
                 }
-                return _fd;
+                return fd;
             }
         }
 
@@ -282,15 +291,15 @@ namespace Tizen.NUI
         {
             get
             {
-                if (_size != 0)
-                    return _size;
+                if (size != 0)
+                    return size;
 
-                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetImageFile(_frame, out _fd, out _size);
+                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetImageFile(frame, out fd, out size);
                 if (err != Interop.FrameBroker.ErrorCode.None)
                 {
-                    Log.Error(LogTag, "Failed to get size of image file");
+                    Log.Error(logTag, "Failed to get size of image file");
                 }
-                return _size;
+                return size;
             }
         }
 
@@ -302,10 +311,10 @@ namespace Tizen.NUI
             get
             {
                 string filePath = string.Empty;
-                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetFilePath(_frame, out filePath);
+                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetFilePath(frame, out filePath);
                 if (err != Interop.FrameBroker.ErrorCode.None)
                 {
-                    Log.Error(LogTag, "Failed to get file path");
+                    Log.Error(logTag, "Failed to get file path");
                 }
                 return filePath;
             }
@@ -319,10 +328,10 @@ namespace Tizen.NUI
             get
             {
                 string fileGroup = string.Empty;
-                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetFileGroup(_frame, out fileGroup);
+                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetFileGroup(frame, out fileGroup);
                 if (err != Interop.FrameBroker.ErrorCode.None)
                 {
-                    Log.Error(LogTag, "Failed to get file group");
+                    Log.Error(logTag, "Failed to get file group");
                 }
                 return fileGroup;
             }
@@ -336,10 +345,10 @@ namespace Tizen.NUI
             get
             {
                 Interop.FrameBroker.FrameType type = Interop.FrameBroker.FrameType.SplashScreenImage + 1;
-                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetType(_frame, out type);
+                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetType(frame, out type);
                 if (err != Interop.FrameBroker.ErrorCode.None)
                 {
-                    Log.Error(LogTag, "Failed to get frame type");
+                    Log.Error(logTag, "Failed to get frame type");
                 }
                 return (FrameType)type;
             }
@@ -353,10 +362,10 @@ namespace Tizen.NUI
             get
             {
                 int x = -1;
-                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetPositionX(_frame, out x);
+                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetPositionX(frame, out x);
                 if (err != Interop.FrameBroker.ErrorCode.None)
                 {
-                    Log.Error(LogTag, "Failed to get position X");
+                    Log.Error(logTag, "Failed to get position X");
                 }
                 return x;
             }
@@ -370,13 +379,33 @@ namespace Tizen.NUI
             get
             {
                 int y = -1;
-                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetPositionY(_frame, out y);
+                Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetPositionY(frame, out y);
                 if (err != Interop.FrameBroker.ErrorCode.None)
                 {
-                    Log.Error(LogTag, "Failed to get position Y");
+                    Log.Error(logTag, "Failed to get position Y");
                 }
                 return y;
             }
         }
+
+
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void Dispose(DisposeTypes type)
+        {
+            if (disposed)
+            {
+                return;
+            }
+
+            image?.Dispose();
+            renderer?.Dispose();
+            textureSet?.Dispose();
+
+            base.Dispose();
+        }
     }
 }
index 4643d16..e1b1ef2 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@ namespace Tizen.NUI.Accessibility
     /// </summary>
     // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
     [EditorBrowsable(EditorBrowsableState.Never)]
-    public class Accessibility
+    public class Accessibility : Disposable
     {
         #region Constructor, Distructor, Dispose
         private Accessibility()
@@ -38,15 +38,16 @@ namespace Tizen.NUI.Accessibility
             dummy = new View();
             dummy.Name = "dali-atspi-singleton";
         }
-        /// <summary>
-        /// destructor. This is HiddenAPI. recommended not to use in public.
-        /// </summary>
+
+        /// <summary>  
+        /// destructor. This is HiddenAPI. recommended not to use in public.   
+        /// </summary> 
         ~Accessibility()
         {
+            Dispose();
         }
         #endregion Constructor, Distructor, Dispose
 
-
         #region Property
         /// <summary>
         /// Instance for singleton
@@ -217,6 +218,24 @@ namespace Tizen.NUI.Accessibility
             _sayFinishedEventHandler?.Invoke(this, new SayFinishedEventArgs(result));
         }
 
+
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void Dispose(DisposeTypes type)
+        {
+            if (disposed)
+            {
+                return;
+            }
+
+            dummy?.Dispose();
+
+            base.Dispose();
+        }
+
         private View dummy;
 
         private static string tag = "NUITEST";
index 19e3113..4a48c17 100755 (executable)
@@ -26,8 +26,10 @@ namespace Tizen.NUI.BaseComponents
     /// </summary>
     /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
     [EditorBrowsable(EditorBrowsableState.Never)]
-    public partial class ViewStyle : BindableObject
+    public partial class ViewStyle : BindableObject, IDisposable
     {
+        private bool disposed = false;
+
         private string styleName;
         private View.States? state;
         private View.States? subState;
@@ -84,12 +86,21 @@ namespace Tizen.NUI.BaseComponents
         private Selector<Rectangle> backgroundImageBorderSelector;
         private Selector<Color> colorSelector;
 
-        static ViewStyle() {}
+        static ViewStyle() { }
 
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
         public ViewStyle() { }
 
+        /// <summary>  
+        /// destructor. This is HiddenAPI. recommended not to use in public.   
+        /// </summary> 
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        ~ViewStyle()
+        {
+            Dispose();
+        }
+
         /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
         public ViewStyle(ViewStyle viewAttributes)
@@ -697,9 +708,9 @@ namespace Tizen.NUI.BaseComponents
         {
             if (view == null) return;
 
-            BindableProperty.GetBindablePropertysOfType(GetType(), out var styleProperties);            
+            BindableProperty.GetBindablePropertysOfType(GetType(), out var styleProperties);
             BindableProperty.GetBindablePropertysOfType(view.GetType(), out var viewProperties);
-            
+
 
             if (styleProperties == null || viewProperties == null) return;
 
@@ -735,5 +746,51 @@ namespace Tizen.NUI.BaseComponents
         {
             Margin = new Extents(start, end, top, bottom);
         }
+
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        /// <param name="disposing">If true, disposes any disposable objects. If false, does not dispose disposable objects.</param>
+        /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposed)
+                return;
+
+            if (disposing)
+            {
+                cellIndex?.Dispose();
+                downFocusableView?.Dispose();
+                flexMargin?.Dispose();
+                leftFocusableView?.Dispose();
+                margin?.Dispose();
+                maximumSize?.Dispose();
+                minimumSize?.Dispose();
+                orientation?.Dispose();
+                padding?.Dispose();
+                parentOrigin?.Dispose();
+                pivotPoint?.Dispose();
+                position?.Dispose();
+                rightFocusableView?.Dispose();
+                scale?.Dispose();
+                size?.Dispose();
+                sizeModeFactor?.Dispose();
+                upFocusableView?.Dispose();
+            }
+            disposed = true;
+        }
+
+        /// <summary>
+        /// Dispose the window resources
+        /// </summary>
+        /// <returns></returns>
+        /// <since_tizen> 6 </since_tizen>
+        /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void Dispose()
+        {
+            Dispose(true);
+        }
     }
 }
index c6c3029..a60e76f 100755 (executable)
@@ -1,5 +1,5 @@
 ï»¿/*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
  */
 
 using System;
+using System.ComponentModel;
 using Tizen.NUI.Binding;
 
 namespace Tizen.NUI
@@ -23,7 +24,7 @@ namespace Tizen.NUI
     /// <summary>
     /// KeyValue class.
     /// </summary>
-    public class KeyValue
+    public class KeyValue : Disposable
     {
         /// <summary>
         /// Int key.
@@ -50,6 +51,15 @@ namespace Tizen.NUI
         public KeyValue()
         { }
 
+        /// <summary>  
+        /// destructor. This is HiddenAPI. recommended not to use in public.   
+        /// </summary> 
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        ~KeyValue()
+        {
+            Dispose();
+        }
+
         /// <summary>
         /// Key property.
         /// </summary>
@@ -346,5 +356,22 @@ namespace Tizen.NUI
                 KeyString = Key;
             }
         }
+
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void Dispose(DisposeTypes type)
+        {
+            if (disposed)
+            {
+                return;
+            }
+
+            TrueValue?.Dispose();
+
+            base.Dispose();
+        }
     }
 }
index 022c63b..770f1d1 100755 (executable)
@@ -27,17 +27,17 @@ namespace Tizen.NUI
     [FlagsAttribute]
     enum LayoutFlags : short
     {
-      None = 0,
-      ForceLayout = 1,
-      LayoutRequired = 2,
-      MeasuredDimensionSet = 4
+        None = 0,
+        ForceLayout = 1,
+        LayoutRequired = 2,
+        MeasuredDimensionSet = 4
     };
 
     /// <summary>
     /// [Draft] Base class for layouts. It is used to layout a View
     /// It can be laid out by a LayoutGroup.
     /// </summary>
-    public class LayoutItem
+    public class LayoutItem : Disposable
     {
         static bool LayoutDebugFrameData = false; // Debug flag
         private MeasureSpecification OldWidthMeasureSpec; // Store measure specification to compare against later
@@ -47,23 +47,23 @@ namespace Tizen.NUI
 
         private ILayoutParent Parent;
 
-        LayoutData _layoutPositionData;
+        LayoutData layoutPositionData;
 
-        private Extents _padding;
-        private Extents _margin;
+        private Extents padding;
+        private Extents margin;
 
         private bool parentReplacement = false;
 
         /// <summary>
         /// [Draft] Condition event that is causing this Layout to transition.
         /// </summary>
-        internal TransitionCondition ConditionForAnimation{get; set;}
+        internal TransitionCondition ConditionForAnimation { get; set; }
 
         /// <summary>
         /// [Draft] The View that this Layout has been assigned to.
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
-        public View Owner{get; set;}  // Should not keep a View alive.
+        public View Owner { get; set; }  // Should not keep a View alive.
 
         /// <summary>
         /// [Draft] Use transition for layouting child
@@ -71,13 +71,13 @@ namespace Tizen.NUI
         /// <since_tizen> 6 </since_tizen>
         /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
         [EditorBrowsable(EditorBrowsableState.Never)]
-         public bool LayoutWithTransition{get; set;}
+        public bool LayoutWithTransition { get; set; }
 
         /// <summary>
         /// [Draft] Set position by layouting result
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
-        public bool SetPositionByLayout{get;set;} = true;
+        public bool SetPositionByLayout { get; set; } = true;
 
         /// <summary>
         /// [Draft] Margin for this LayoutItem
@@ -87,11 +87,11 @@ namespace Tizen.NUI
         {
             get
             {
-                return _margin;
+                return margin;
             }
             set
             {
-                _margin = value;
+                margin = value;
                 RequestLayout();
             }
         }
@@ -104,11 +104,11 @@ namespace Tizen.NUI
         {
             get
             {
-                return _padding;
+                return padding;
             }
             set
             {
-                _padding = value;
+                padding = value;
                 RequestLayout();
             }
         }
@@ -122,11 +122,20 @@ namespace Tizen.NUI
             Initialize();
         }
 
+        /// <summary>  
+        /// destructor. This is HiddenAPI. recommended not to use in public.   
+        /// </summary> 
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        ~LayoutItem()
+        {
+            Dispose();
+        }
+
         /// <summary>
         /// [Draft] Set parent to this layout.
         /// </summary>
         /// <param name="parent">Parent to set on this Layout.</param>
-        internal void SetParent( ILayoutParent parent)
+        internal void SetParent(ILayoutParent parent)
         {
             Parent = parent as LayoutGroup;
         }
@@ -140,7 +149,7 @@ namespace Tizen.NUI
             OnUnparent();
 
             // Remove myself from parent
-            Parent?.Remove( this );
+            Parent?.Remove(this);
 
             // Remove parent reference
             Parent = null;
@@ -152,9 +161,9 @@ namespace Tizen.NUI
         private void Initialize()
         {
             LayoutWithTransition = false;
-            _layoutPositionData = new LayoutData(this,TransitionCondition.Unspecified,0,0,0,0);
-            _padding = new Extents(0,0,0,0);
-            _margin = new Extents(0,0,0,0);
+            layoutPositionData = new LayoutData(this, TransitionCondition.Unspecified, 0, 0, 0, 0);
+            padding = new Extents(0, 0, 0, 0);
+            margin = new Extents(0, 0, 0, 0);
         }
 
         /// <summary>
@@ -168,7 +177,7 @@ namespace Tizen.NUI
             OnAttachedToOwner();
             // Add layout to parent layout if a layout container
             View parent = Owner.GetParent() as View;
-            (parent?.Layout as LayoutGroup)?.Add( this );
+            (parent?.Layout as LayoutGroup)?.Add(this);
 
             // If Add or ChangeOnAdd then do not update condition
             if (ConditionForAnimation.Equals(TransitionCondition.Unspecified))
@@ -200,7 +209,7 @@ namespace Tizen.NUI
             bool matchesSpecSize = (MeasuredWidth.Size == widthMeasureSpec.Size) &&
                                    (MeasuredHeight.Size == heightMeasureSpec.Size);
 
-            bool needsLayout = specChanged && ( !isSpecExactly || !matchesSpecSize);
+            bool needsLayout = specChanged && (!isSpecExactly || !matchesSpecSize);
             needsLayout = needsLayout || ((Flags & LayoutFlags.ForceLayout) == LayoutFlags.ForceLayout);
 
             if (needsLayout)
@@ -258,31 +267,31 @@ namespace Tizen.NUI
             switch (specMode)
             {
                 case MeasureSpecification.ModeType.Unspecified:
-                {
-                    result = size;
-                    break;
-                }
-                case MeasureSpecification.ModeType.AtMost:
-                {
-                    // Ensure the default size does not exceed the spec size unless the default size is 0.
-                    // Another container could provide a default size of 0.
-
-                    // Do not set size to 0, use specSize in this case as could be a legacy container
-                    if( ( size.AsDecimal() < specSize.AsDecimal()) && ( size.AsDecimal() >  0) )
                     {
                         result = size;
+                        break;
                     }
-                    else
+                case MeasureSpecification.ModeType.AtMost:
                     {
-                        result = specSize;
+                        // Ensure the default size does not exceed the spec size unless the default size is 0.
+                        // Another container could provide a default size of 0.
+
+                        // Do not set size to 0, use specSize in this case as could be a legacy container
+                        if ((size.AsDecimal() < specSize.AsDecimal()) && (size.AsDecimal() > 0))
+                        {
+                            result = size;
+                        }
+                        else
+                        {
+                            result = specSize;
+                        }
+                        break;
                     }
-                    break;
-                }
                 case MeasureSpecification.ModeType.Exactly:
-                {
-                    result = specSize;
-                    break;
-                }
+                    {
+                        result = specSize;
+                        break;
+                    }
             }
 
             return result;
@@ -308,13 +317,13 @@ namespace Tizen.NUI
             Flags = Flags | LayoutFlags.ForceLayout;
             if (Parent != null)
             {
-                 LayoutGroup layoutGroup =  Parent as LayoutGroup;
-                 if(! layoutGroup.LayoutRequested)
-                 {
+                LayoutGroup layoutGroup = Parent as LayoutGroup;
+                if (!layoutGroup.LayoutRequested)
+                {
                     layoutGroup.RequestLayout();
-                 }
+                }
             }
-                       
+
         }
 
         /// <summary>
@@ -325,7 +334,7 @@ namespace Tizen.NUI
         {
             get
             {
-                return ( Flags & LayoutFlags.ForceLayout) == LayoutFlags.ForceLayout;
+                return (Flags & LayoutFlags.ForceLayout) == LayoutFlags.ForceLayout;
             }
         }
 
@@ -349,14 +358,14 @@ namespace Tizen.NUI
         /// This method should be used only during measurement and layout calculations.<br />
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
-        public MeasuredSize MeasuredWidth{ get; set; } = new MeasuredSize( new LayoutLength(-3), MeasuredSize.StateType.MeasuredSizeOK);
+        public MeasuredSize MeasuredWidth { get; set; } = new MeasuredSize(new LayoutLength(-3), MeasuredSize.StateType.MeasuredSizeOK);
 
         /// <summary>
         /// Get the measured height (without any measurement flags).<br />
         /// This method should be used only during measurement and layout calculations.<br />
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
-        public MeasuredSize MeasuredHeight{ get; set; } = new MeasuredSize( new LayoutLength(-3), MeasuredSize.StateType.MeasuredSizeOK);
+        public MeasuredSize MeasuredHeight { get; set; } = new MeasuredSize(new LayoutLength(-3), MeasuredSize.StateType.MeasuredSizeOK);
 
         /// <summary>
         /// Returns the suggested minimum width that the layout should use.<br />
@@ -370,7 +379,7 @@ namespace Tizen.NUI
                 float maximumWidth = Owner.MaximumSize.Width;
                 float minimumWidth = Owner.MinimumSize.Width;
 
-                float baseHeight = Owner.MaximumSize.Height > 0 ? Math.Min(Owner.MaximumSize.Height,Owner.NaturalSize.Height) : Owner.NaturalSize.Height;
+                float baseHeight = Owner.MaximumSize.Height > 0 ? Math.Min(Owner.MaximumSize.Height, Owner.NaturalSize.Height) : Owner.NaturalSize.Height;
                 float baseWidth = Owner.GetWidthForHeight(baseHeight);
 
                 float result = minimumWidth > 0 ? Math.Max(baseWidth, minimumWidth) : baseWidth;
@@ -392,7 +401,7 @@ namespace Tizen.NUI
                 float maximumHeight = Owner.MaximumSize.Height;
                 float minimumHeight = Owner.MinimumSize.Height;
 
-                float baseWidth = Owner.MaximumSize.Width > 0 ? Math.Min(Owner.MaximumSize.Width,Owner.NaturalSize.Width) : Owner.NaturalSize.Width;
+                float baseWidth = Owner.MaximumSize.Width > 0 ? Math.Min(Owner.MaximumSize.Width, Owner.NaturalSize.Width) : Owner.NaturalSize.Width;
                 float baseHeight = Owner.GetHeightForWidth(baseWidth);
 
                 float result = minimumHeight > 0 ? Math.Max(baseHeight, minimumHeight) : baseHeight;
@@ -410,7 +419,7 @@ namespace Tizen.NUI
         /// 2. If the owner's View.WidthSpecification is set to View.LayoutParamPolicies.WrapContent, then the view's width is set based on the suggested minimum width. (@see GetSuggestedMinimumWidth()).<br />
         /// 3. If the owner's View.WidthSpecification is set to View.LayoutParamPolicies.MatchParent, then the parent width takes precedence over the minimum width.<br />
         /// </summary>
-        internal LayoutLength MinimumWidth {get; set;}
+        internal LayoutLength MinimumWidth { get; set; }
 
         /// <summary>
         /// Sets the minimum height of the layout.<br />
@@ -420,7 +429,7 @@ namespace Tizen.NUI
         /// 2. If the owner's View.HeightSpecification is set to View.LayoutParamPolicies.WrapContent, then the view's height is set based on the suggested minimum height. (@see GetSuggestedMinimumHeight()).<br />
         /// 3. If the owner's View.HeightSpecification is set to View.LayoutParamPolicies.MatchParent, then the parent height takes precedence over the minimum height.<br />
         /// </summary>
-        internal LayoutLength MinimumHeight {get; set;}
+        internal LayoutLength MinimumHeight { get; set; }
 
         ///<summary>
         /// Utility to reconcile a desired size and state, with constraints imposed by a MeasureSpecification.
@@ -430,34 +439,34 @@ namespace Tizen.NUI
         /// <param name="childMeasuredState"> Size information bit mask for the layout's children.</param>
         /// <returns> A measured size, which may indicate that it is too small. </returns>
         /// <since_tizen> 6 </since_tizen>
-        protected MeasuredSize ResolveSizeAndState( LayoutLength size, MeasureSpecification measureSpecification, MeasuredSize.StateType childMeasuredState )
+        protected MeasuredSize ResolveSizeAndState(LayoutLength size, MeasureSpecification measureSpecification, MeasuredSize.StateType childMeasuredState)
         {
             var specMode = measureSpecification.Mode;
             LayoutLength specSize = measureSpecification.Size;
-            MeasuredSize result = new MeasuredSize( size, childMeasuredState );
+            MeasuredSize result = new MeasuredSize(size, childMeasuredState);
 
-            switch( specMode )
+            switch (specMode)
             {
                 case MeasureSpecification.ModeType.AtMost:
-                {
-                    if (specSize.AsRoundedValue() < size.AsRoundedValue())
                     {
-                        result = new MeasuredSize( specSize, MeasuredSize.StateType.MeasuredSizeTooSmall);
+                        if (specSize.AsRoundedValue() < size.AsRoundedValue())
+                        {
+                            result = new MeasuredSize(specSize, MeasuredSize.StateType.MeasuredSizeTooSmall);
+                        }
+                        break;
                     }
-                    break;
-                }
 
                 case MeasureSpecification.ModeType.Exactly:
-                {
-                    result.Size = specSize;
-                    break;
-                }
+                    {
+                        result.Size = specSize;
+                        break;
+                    }
 
                 case MeasureSpecification.ModeType.Unspecified:
                 default:
-                {
-                    break;
-                }
+                    {
+                        break;
+                    }
             }
             return result;
         }
@@ -468,7 +477,7 @@ namespace Tizen.NUI
         /// <param name="measuredWidth">The measured width of this layout.</param>
         /// <param name="measuredHeight">The measured height of this layout.</param>
         /// <since_tizen> 6 </since_tizen>
-        protected void SetMeasuredDimensions( MeasuredSize measuredWidth, MeasuredSize measuredHeight )
+        protected void SetMeasuredDimensions(MeasuredSize measuredWidth, MeasuredSize measuredHeight)
         {
             MeasuredWidth = measuredWidth;
             MeasuredHeight = measuredHeight;
@@ -490,8 +499,8 @@ namespace Tizen.NUI
         protected virtual void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
         {
             // GetDefaultSize will limit the MeasureSpec to the suggested minimumWidth and minimumHeight
-            SetMeasuredDimensions( GetDefaultSize( SuggestedMinimumWidth, widthMeasureSpec ),
-                                   GetDefaultSize( SuggestedMinimumHeight, heightMeasureSpec ) );
+            SetMeasuredDimensions(GetDefaultSize(SuggestedMinimumWidth, widthMeasureSpec),
+                                   GetDefaultSize(SuggestedMinimumHeight, heightMeasureSpec));
         }
 
         /// <summary>
@@ -530,18 +539,18 @@ namespace Tizen.NUI
         {
             bool changed = false;
 
-            if ( _layoutPositionData.Left != left ||
-                 _layoutPositionData.Right != right ||
-                 _layoutPositionData.Top != top ||
-                 _layoutPositionData.Bottom != bottom  )
+            if (layoutPositionData.Left != left ||
+                 layoutPositionData.Right != right ||
+                 layoutPositionData.Top != top ||
+                 layoutPositionData.Bottom != bottom)
             {
                 changed = true;
 
-                float oldWidth = _layoutPositionData.Right - _layoutPositionData.Left;
-                float oldHeight = _layoutPositionData.Bottom - _layoutPositionData.Top;
+                float oldWidth = layoutPositionData.Right - layoutPositionData.Left;
+                float oldHeight = layoutPositionData.Bottom - layoutPositionData.Top;
                 float newWidth = right - left;
                 float newHeight = bottom - top;
-                bool sizeChanged = ( newWidth != oldWidth ) || ( newHeight != oldHeight );
+                bool sizeChanged = (newWidth != oldWidth) || (newHeight != oldHeight);
 
                 // Set condition to layout changed as currently unspecified. Add, Remove would have specified a condition.
                 if (ConditionForAnimation.Equals(TransitionCondition.Unspecified))
@@ -550,22 +559,22 @@ namespace Tizen.NUI
                 }
 
                 // Store new layout position data
-                _layoutPositionData = new LayoutData(this, ConditionForAnimation, left, top, right, bottom);
+                layoutPositionData = new LayoutData(this, ConditionForAnimation, left, top, right, bottom);
 
-                Debug.WriteLineIf( LayoutDebugFrameData, "LayoutItem FramePositionData View:" + _layoutPositionData.Item.Owner.Name +
-                                                         " left:" + _layoutPositionData.Left +
-                                                         " top:" + _layoutPositionData.Top +
-                                                         " right:" + _layoutPositionData.Right +
-                                                         " bottom:" + _layoutPositionData.Bottom );
+                Debug.WriteLineIf(LayoutDebugFrameData, "LayoutItem FramePositionData View:" + layoutPositionData.Item.Owner.Name +
+                                                         " left:" + layoutPositionData.Left +
+                                                         " top:" + layoutPositionData.Top +
+                                                         " right:" + layoutPositionData.Right +
+                                                         " bottom:" + layoutPositionData.Bottom);
 
                 if (Owner.Parent != null && Owner.Parent.Layout != null && Owner.Parent.Layout.LayoutWithTransition)
                 {
-                    NUIApplication.GetDefaultWindow().LayoutController.AddTransitionDataEntry(_layoutPositionData);
+                    NUIApplication.GetDefaultWindow().LayoutController.AddTransitionDataEntry(layoutPositionData);
                 }
                 else
                 {
                     Owner.SetSize(right - left, bottom - top, Owner.Position.Z);
-                    if(SetPositionByLayout)
+                    if (SetPositionByLayout)
                     {
                         Owner.SetPosition(left, top, Owner.Position.Z);
                     }
@@ -578,5 +587,24 @@ namespace Tizen.NUI
 
             return changed;
         }
+
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void Dispose(DisposeTypes type)
+        {
+            if (disposed)
+            {
+                return;
+            }
+
+            margin?.Dispose();
+            padding?.Dispose();
+            Owner?.Dispose();
+
+            base.Dispose();
+        }
     }
 }
index a33da6f..faa14c9 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
 
 using System.Collections.Generic;
 using System;
+using System.ComponentModel;
 
 namespace Tizen.NUI
 {
@@ -24,13 +25,14 @@ namespace Tizen.NUI
     /// Define a List of LayoutTransitions
     /// </summary>
     /// <since_tizen> 6 </since_tizen>
-    public class TransitionList : List<LayoutTransition> {}
+    public class TransitionList : List<LayoutTransition> { }
 
     /// <summary>
     /// The conditions for transitions.
     /// </summary>
     /// <since_tizen> 6 </since_tizen>
-    [FlagsAttribute] public enum TransitionCondition
+    [FlagsAttribute]
+    public enum TransitionCondition
     {
         /// <summary>
         /// Default when a condition has not been set.
@@ -99,7 +101,7 @@ namespace Tizen.NUI
     /// Parts of the transition that can be configured to provide a custom effect.
     /// </summary>
     /// <since_tizen> 6 </since_tizen>
-    public class TransitionComponents
+    public class TransitionComponents : Disposable
     {
         /// <summary>
         /// TransitionComponents default constructor.
@@ -112,6 +114,15 @@ namespace Tizen.NUI
             AlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear);
         }
 
+        /// <summary>  
+        /// destructor. This is HiddenAPI. recommended not to use in public.   
+        /// </summary> 
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        ~TransitionComponents()
+        {
+            Dispose();
+        }
+
         /// <summary>
         /// TransitionComponents constructor. Stores delay, duration and AlphaFunction.
         /// </summary>
@@ -142,6 +153,22 @@ namespace Tizen.NUI
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
         public AlphaFunction AlphaFunction;
+
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void Dispose(DisposeTypes type)
+        {
+            if (disposed)
+            {
+                return;
+            }
+
+            AlphaFunction.Dispose();
+            base.Dispose();
+        }
     }
 
     /// <summary>
@@ -155,10 +182,10 @@ namespace Tizen.NUI
         /// <since_tizen> 6 </since_tizen>
         public LayoutTransition()
         {
-          Condition = TransitionCondition.Unspecified;
-          AnimatableProperty = AnimatableProperties.Position;
-          Animator = null;
-          TargetValue = 0;
+            Condition = TransitionCondition.Unspecified;
+            AnimatableProperty = AnimatableProperties.Position;
+            Animator = null;
+            TargetValue = 0;
         }
         /// <summary>
         /// LayoutTransition constructor.
@@ -168,7 +195,7 @@ namespace Tizen.NUI
         /// <param name="targetValue">target value of the property.</param>
         /// <param name="animator">Components to define the animator.</param>
         /// <since_tizen> 6 </since_tizen>
-        public LayoutTransition( TransitionCondition condition,
+        public LayoutTransition(TransitionCondition condition,
                                  AnimatableProperties animatableProperty,
                                  object targetValue,
                                  TransitionComponents animator)
@@ -184,25 +211,25 @@ namespace Tizen.NUI
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
 
-        public TransitionCondition Condition{get; set;}
+        public TransitionCondition Condition { get; set; }
         /// <summary>
         /// Property to animate.
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
 
-        public AnimatableProperties AnimatableProperty{get; set;}
+        public AnimatableProperties AnimatableProperty { get; set; }
         /// <summary>
         /// Components of the Animator.
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
 
-        public TransitionComponents Animator{get; set;}
+        public TransitionComponents Animator { get; set; }
         /// <summary>
         /// Target value to animate to.
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
 
-        public object TargetValue{get; set;}
+        public object TargetValue { get; set; }
     }
 
 
@@ -231,7 +258,7 @@ namespace Tizen.NUI
             {
                 if (transitionListMatchingCondition != null)
                 {
-                    for (var index = 0; index < transitionListMatchingCondition.Count; index++ )
+                    for (var index = 0; index < transitionListMatchingCondition.Count; index++)
                     {
                         if (transitionListMatchingCondition[index].AnimatableProperty == transition.AnimatableProperty)
                         {
@@ -279,7 +306,7 @@ namespace Tizen.NUI
         static public bool GetTransitionsListForCondition(
                               Dictionary<TransitionCondition, TransitionList> sourceTransitionCollection,
                               TransitionCondition condition,
-                              TransitionList transitionsForCondition )
+                              TransitionList transitionsForCondition)
         {
             TransitionCondition resolvedCondition = condition;
             bool matched = false;
@@ -303,8 +330,8 @@ namespace Tizen.NUI
         /// </summary>
         /// <param name="sourceTransitionList">The source transition list.</param>
         /// <param name="targetTransitionList">The target transition list to copy to.</param>
-        static public void CopyTransitions( TransitionList sourceTransitionList,
-                                            TransitionList targetTransitionList )
+        static public void CopyTransitions(TransitionList sourceTransitionList,
+                                            TransitionList targetTransitionList)
         {
             targetTransitionList.Clear();
             foreach (LayoutTransition transitionToApply in sourceTransitionList)
index 5d246e0..47eb453 100755 (executable)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2019 Samsung Electronics Co., Ltd.
+/* Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 using System;
 using Tizen.NUI.BaseComponents;
 using System.Collections.Generic;
+using System.ComponentModel;
 
 namespace Tizen.NUI
 {
     /// <summary>
     /// [Draft] This class implements a linear box layout, automatically handling right to left or left to right direction change.
     /// </summary>
-    public class LinearLayout : LayoutGroup
+    public class LinearLayout : LayoutGroup, IDisposable
     {
+        private bool disposed = false;
+
         /// <summary>
         /// [Draft] Enumeration for the direction in which the content is laid out
         /// </summary>
@@ -50,31 +53,31 @@ namespace Tizen.NUI
             /// <summary>
             /// At the left/right edge of the container (maps to LTR/RTL direction for horizontal orientation)
             /// </summary>
-            Begin              = 0x1,
+            Begin = 0x1,
             /// <summary>
             /// At the right/left edge of the container (maps to LTR/RTL direction for horizontal orientation)
             /// </summary>
-            End                = 0x2,
+            End = 0x2,
             /// <summary>
             /// At the horizontal center of the container
             /// </summary>
-            CenterHorizontal   = 0x4,
+            CenterHorizontal = 0x4,
             /// <summary>
             /// At the top edge of the container
             /// </summary>
-            Top                = 0x8,
+            Top = 0x8,
             /// <summary>
             /// At the bottom edge of the container
             /// </summary>
-            Bottom             = 0x10,
+            Bottom = 0x10,
             /// <summary>
             /// At the vertical center of the container
             /// </summary>
-            CenterVertical     = 0x20,
+            CenterVertical = 0x20,
             /// <summary>
             /// At the vertical and horizontal center of the container
             /// </summary>
-            Center             = 0x40
+            Center = 0x40
         }
 
         struct HeightAndWidthState
@@ -82,7 +85,7 @@ namespace Tizen.NUI
             public MeasuredSize.StateType widthState;
             public MeasuredSize.StateType heightState;
 
-            public HeightAndWidthState( MeasuredSize.StateType width, MeasuredSize.StateType height)
+            public HeightAndWidthState(MeasuredSize.StateType width, MeasuredSize.StateType height)
             {
                 widthState = width;
                 heightState = height;
@@ -97,11 +100,11 @@ namespace Tizen.NUI
         {
             get
             {
-                return _linearOrientation;
+                return linearOrientation;
             }
             set
             {
-                _linearOrientation = value;
+                linearOrientation = value;
                 RequestLayout();
             }
         }
@@ -114,11 +117,11 @@ namespace Tizen.NUI
         {
             get
             {
-                return _cellPadding;
+                return cellPadding;
             }
             set
             {
-                _cellPadding = value;
+                cellPadding = value;
                 RequestLayout();
             }
         }
@@ -128,11 +131,11 @@ namespace Tizen.NUI
         /// [Draft] Get/Set the alignment in the layout
         /// </summary>
         /// <since_tizen> 6 </since_tizen>
-        public LinearLayout.Alignment LinearAlignment{ get; set; } = Alignment.Top;
+        public LinearLayout.Alignment LinearAlignment { get; set; } = Alignment.Top;
 
-        private float _totalLength = 0.0f;
-        private Size2D _cellPadding  = new Size2D(0,0);
-        private Orientation _linearOrientation = Orientation.Horizontal;
+        private float totalLength = 0.0f;
+        private Size2D cellPadding = new Size2D(0, 0);
+        private Orientation linearOrientation = Orientation.Horizontal;
 
         /// <summary>
         /// [Draft] Constructor
@@ -142,6 +145,15 @@ namespace Tizen.NUI
         {
         }
 
+        /// <summary>  
+        /// destructor. This is HiddenAPI. recommended not to use in public.   
+        /// </summary> 
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        ~LinearLayout()
+        {
+            Dispose();
+        }
+
         /// <summary>
         /// Measure the layout and its content to determine the measured width and the measured height.
         /// </summary>
@@ -150,7 +162,7 @@ namespace Tizen.NUI
         /// <since_tizen> 6 </since_tizen>
         protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
         {
-            if (_linearOrientation == Orientation.Horizontal)
+            if (linearOrientation == Orientation.Horizontal)
             {
                 MeasureHorizontal(widthMeasureSpec, heightMeasureSpec);
             }
@@ -171,7 +183,7 @@ namespace Tizen.NUI
         /// <since_tizen> 6 </since_tizen>
         protected override void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom)
         {
-            if (_linearOrientation == Orientation.Horizontal)
+            if (linearOrientation == Orientation.Horizontal)
             {
                 LayoutHorizontal(left, top, right, bottom);
             }
@@ -182,9 +194,9 @@ namespace Tizen.NUI
         }
 
 
-        private void MeasureWeightedChild( LayoutItem childLayout, float remainingExcess, float remainingWeight, float childWeight,
+        private void MeasureWeightedChild(LayoutItem childLayout, float remainingExcess, float remainingWeight, float childWeight,
                                            MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec,
-                                           HeightAndWidthState childState, Orientation orientation )
+                                           HeightAndWidthState childState, Orientation orientation)
         {
             bool horizontal = false;
             if (orientation == Orientation.Horizontal)
@@ -192,7 +204,7 @@ namespace Tizen.NUI
                 horizontal = true;
             }
 
-            float childsShare = ( childWeight * remainingExcess ) / remainingWeight;
+            float childsShare = (childWeight * remainingExcess) / remainingWeight;
             remainingExcess -= childsShare;
             remainingWeight -= childWeight;
 
@@ -202,7 +214,7 @@ namespace Tizen.NUI
 
             // Always lay out weighted elements with intrinsic size regardless of the parent spec.
             // for consistency between specs.
-            if( ( horizontal && ( desiredWidth == 0 )) || ( !horizontal && ( desiredHeight == 0 )) )
+            if ((horizontal && (desiredWidth == 0)) || (!horizontal && (desiredHeight == 0)))
             {
                 // This child needs to be laid out from scratch using
                 // only its share of excess space.
@@ -227,8 +239,8 @@ namespace Tizen.NUI
 
             if (horizontal)
             {
-                childWidthMeasureSpec = new MeasureSpecification( new LayoutLength(childLength), MeasureSpecification.ModeType.Exactly );
-                childHeightMeasureSpec = GetChildMeasureSpecification( 
+                childWidthMeasureSpec = new MeasureSpecification(new LayoutLength(childLength), MeasureSpecification.ModeType.Exactly);
+                childHeightMeasureSpec = GetChildMeasureSpecification(
                                             new MeasureSpecification(
                                                 new LayoutLength(heightMeasureSpec.Size - (childLayout.Owner.Margin.Top + childLayout.Owner.Margin.Bottom)),
                                                 heightMeasureSpec.Mode),
@@ -244,19 +256,19 @@ namespace Tizen.NUI
                                             new LayoutLength(Padding.Start + Padding.End),
                                             new LayoutLength(desiredWidth));
 
-                childHeightMeasureSpec = new MeasureSpecification( new LayoutLength(childLength), MeasureSpecification.ModeType.Exactly);
+                childHeightMeasureSpec = new MeasureSpecification(new LayoutLength(childLength), MeasureSpecification.ModeType.Exactly);
             }
 
-            childLayout.Measure( childWidthMeasureSpec, childHeightMeasureSpec );
+            childLayout.Measure(childWidthMeasureSpec, childHeightMeasureSpec);
 
             // Child may now not fit in horizontal dimension.
-            ifchildLayout.MeasuredWidth.State == MeasuredSize.StateType.MeasuredSizeTooSmall)
+            if (childLayout.MeasuredWidth.State == MeasuredSize.StateType.MeasuredSizeTooSmall)
             {
                 childState.widthState = MeasuredSize.StateType.MeasuredSizeTooSmall;
             }
 
             // Child may now not fit in vertical dimension.
-            ifchildLayout.MeasuredHeight.State == MeasuredSize.StateType.MeasuredSizeTooSmall)
+            if (childLayout.MeasuredHeight.State == MeasuredSize.StateType.MeasuredSizeTooSmall)
             {
                 childState.heightState = MeasuredSize.StateType.MeasuredSizeTooSmall;
             }
@@ -266,7 +278,7 @@ namespace Tizen.NUI
         {
             var widthMode = widthMeasureSpec.Mode;
             var heightMode = heightMeasureSpec.Mode;
-            bool isExactly = ( widthMode == MeasureSpecification.ModeType.Exactly );
+            bool isExactly = (widthMode == MeasureSpecification.ModeType.Exactly);
             bool matchHeight = false;
             bool allFillParent = true;
             float maxHeight = 0.0f;
@@ -275,7 +287,7 @@ namespace Tizen.NUI
             float totalWeight = 0.0f;
 
             // Reset measure variables
-            _totalLength = 0.0f;
+            totalLength = 0.0f;
             float usedExcessSpace = 0.0f;
             HeightAndWidthState childState = new HeightAndWidthState(MeasuredSize.StateType.MeasuredSizeOK,
                                                                      MeasuredSize.StateType.MeasuredSizeOK);
@@ -294,11 +306,11 @@ namespace Tizen.NUI
                 Extents childMargin = childLayout.Margin;
                 totalWeight += childWeight;
 
-                bool useExcessSpace = (childLayout.Owner.WidthSpecification == 0 ) && (childWeight > 0);
-                if( isExactly && useExcessSpace )
+                bool useExcessSpace = (childLayout.Owner.WidthSpecification == 0) && (childWeight > 0);
+                if (isExactly && useExcessSpace)
                 {
                     // Children to be laid out with excess space can be measured later
-                    _totalLength = Math.Max( _totalLength, (_totalLength + childMargin.Start + childMargin.End) );
+                    totalLength = Math.Max(totalLength, (totalLength + childMargin.Start + childMargin.End));
                 }
                 else
                 {
@@ -323,7 +335,7 @@ namespace Tizen.NUI
                                                 new LayoutLength(Padding.Top + Padding.Bottom),
                                                 new LayoutLength(childDesiredHeight));
 
-                        childLayout.Measure( childWidthMeasureSpec, childHeightMeasureSpec);
+                        childLayout.Measure(childWidthMeasureSpec, childHeightMeasureSpec);
                         usedExcessSpace += childLayout.MeasuredWidth.Size.AsDecimal();
                     }
                     else
@@ -336,11 +348,11 @@ namespace Tizen.NUI
 
                     if (isExactly)
                     {
-                        _totalLength += length.AsDecimal();
+                        totalLength += length.AsDecimal();
                     }
                     else
                     {
-                        _totalLength = Math.Max(_totalLength, _totalLength + length.AsDecimal() + (i < LayoutChildren.Count - 1 ? CellPadding.Width : 0));
+                        totalLength = Math.Max(totalLength, totalLength + length.AsDecimal() + (i < LayoutChildren.Count - 1 ? CellPadding.Width : 0));
                     }
                 }
 
@@ -365,39 +377,39 @@ namespace Tizen.NUI
                     childState.heightState = MeasuredSize.StateType.MeasuredSizeTooSmall;
                 }
 
-                maxHeight = Math.Max( maxHeight, childHeight);
-                allFillParent = ( allFillParent && childDesiredHeight == LayoutParamPolicies.MatchParent);
+                maxHeight = Math.Max(maxHeight, childHeight);
+                allFillParent = (allFillParent && childDesiredHeight == LayoutParamPolicies.MatchParent);
 
                 if (childWeight > 0)
                 {
-                  // Heights of weighted Views are invalid if we end up remeasuring, so store them separately.
-                  weightedMaxHeight = Math.Max( weightedMaxHeight, matchHeightLocally ? marginHeight : childHeight);
+                    // Heights of weighted Views are invalid if we end up remeasuring, so store them separately.
+                    weightedMaxHeight = Math.Max(weightedMaxHeight, matchHeightLocally ? marginHeight : childHeight);
                 }
                 else
                 {
-                  alternativeMaxHeight = Math.Max( alternativeMaxHeight, matchHeightLocally ? marginHeight : childHeight );
+                    alternativeMaxHeight = Math.Max(alternativeMaxHeight, matchHeightLocally ? marginHeight : childHeight);
                 }
             } // foreach
 
-            float widthSize = _totalLength;
-            widthSize = Math.Max( widthSize, SuggestedMinimumWidth.AsDecimal());
-            MeasuredSize widthSizeAndState = ResolveSizeAndState( new LayoutLength(widthSize + Padding.Start + Padding.End), widthMeasureSpec, MeasuredSize.StateType.MeasuredSizeOK);
+            float widthSize = totalLength;
+            widthSize = Math.Max(widthSize, SuggestedMinimumWidth.AsDecimal());
+            MeasuredSize widthSizeAndState = ResolveSizeAndState(new LayoutLength(widthSize + Padding.Start + Padding.End), widthMeasureSpec, MeasuredSize.StateType.MeasuredSizeOK);
             widthSize = widthSizeAndState.Size.AsDecimal();
 
             // 2nd phase:
             // Expand children with weight to take up available space
             // We cycle through weighted children now (children with weight > 0).
             // The children are measured with exact size equal to their share of the available space based on their weights.
-            // _totalLength is updated to include weighted children measured sizes.
-            float remainingExcess = widthSize - _totalLength + usedExcessSpace - (Padding.Start + Padding.End);
-            if( remainingExcess != 0 && totalWeight > 0 )
+            // totalLength is updated to include weighted children measured sizes.
+            float remainingExcess = widthSize - totalLength + usedExcessSpace - (Padding.Start + Padding.End);
+            if (remainingExcess != 0 && totalWeight > 0)
             {
                 float remainingWeight = totalWeight;
                 maxHeight = 0;
-                _totalLength = 0;
+                totalLength = 0;
 
                 int numberOfChildren = LayoutChildren.Count;
-                for( int i = 0; i < numberOfChildren; ++i )
+                for (int i = 0; i < numberOfChildren; ++i)
                 {
                     LayoutItem childLayout = LayoutChildren[i];
 
@@ -406,38 +418,38 @@ namespace Tizen.NUI
                     float childWeight = childLayout.Owner.Weight;
                     Extents childMargin = childLayout.Margin;
 
-                    if( childWeight > 0 )
+                    if (childWeight > 0)
                     {
                         MeasureWeightedChild(childLayout, remainingExcess, remainingWeight, childWeight,
                                              widthMeasureSpec, heightMeasureSpec, childState,
-                                             Orientation.Horizontal );
+                                             Orientation.Horizontal);
                     }
 
                     float length = childLayout.MeasuredWidth.Size.AsDecimal() + childMargin.Start + childMargin.End;
                     float cellPadding = i < numberOfChildren - 1 ? CellPadding.Width : 0;
-                    if( isExactly )
+                    if (isExactly)
                     {
-                        _totalLength += length;
+                        totalLength += length;
                     }
                     else
                     {
-                        float totalLength = _totalLength;
-                        _totalLength = Math.Max( _totalLength, _totalLength + length + cellPadding );
+                        float totalLength = this.totalLength;
+                        totalLength = Math.Max(totalLength, totalLength + length + cellPadding);
                     }
 
                     bool matchHeightLocally = (heightMode != MeasureSpecification.ModeType.Exactly) && (desiredChildHeight == LayoutParamPolicies.MatchParent);
                     float marginHeight = childMargin.Top + childMargin.Bottom;
                     float childHeight = childLayout.MeasuredHeight.Size.AsDecimal() + marginHeight;
 
-                    maxHeight = Math.Max( maxHeight, childHeight );
-                    alternativeMaxHeight = Math.Max( alternativeMaxHeight, matchHeightLocally ? marginHeight : childHeight );
+                    maxHeight = Math.Max(maxHeight, childHeight);
+                    alternativeMaxHeight = Math.Max(alternativeMaxHeight, matchHeightLocally ? marginHeight : childHeight);
                     allFillParent = (allFillParent && desiredChildHeight == LayoutParamPolicies.MatchParent);
                 } // for loop
             }
             else
             {
                 // No excess space or no weighted children
-                alternativeMaxHeight = Math.Max( alternativeMaxHeight, weightedMaxHeight );
+                alternativeMaxHeight = Math.Max(alternativeMaxHeight, weightedMaxHeight);
             }
 
             if (!allFillParent && heightMode != MeasureSpecification.ModeType.Exactly)
@@ -448,13 +460,13 @@ namespace Tizen.NUI
 
 
             // Padding should be concerned when specification is Wrapcontent.
-            maxHeight += (Owner.HeightSpecification == LayoutParamPolicies.WrapContent)?(Padding.Top + Padding.Bottom):0;
-            maxHeight = Math.Max( maxHeight, SuggestedMinimumHeight.AsRoundedValue() );
+            maxHeight += (Owner.HeightSpecification == LayoutParamPolicies.WrapContent) ? (Padding.Top + Padding.Bottom) : 0;
+            maxHeight = Math.Max(maxHeight, SuggestedMinimumHeight.AsRoundedValue());
 
             widthSizeAndState.State = childState.widthState;
 
             SetMeasuredDimensions(widthSizeAndState,
-                                  ResolveSizeAndState( new LayoutLength(maxHeight + Padding.Top + Padding.Bottom), heightMeasureSpec, childState.heightState ));
+                                  ResolveSizeAndState(new LayoutLength(maxHeight + Padding.Top + Padding.Bottom), heightMeasureSpec, childState.heightState));
 
             if (matchHeight)
             {
@@ -462,11 +474,11 @@ namespace Tizen.NUI
             }
         } // MeasureHorizontal
 
-        private void MeasureVertical( MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec )
+        private void MeasureVertical(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
         {
             var widthMode = widthMeasureSpec.Mode;
             var heightMode = heightMeasureSpec.Mode;
-            bool isExactly = ( heightMode == MeasureSpecification.ModeType.Exactly);
+            bool isExactly = (heightMode == MeasureSpecification.ModeType.Exactly);
             bool matchWidth = false;
             bool allFillParent = true;
             float maxWidth = 0.0f;
@@ -475,8 +487,8 @@ namespace Tizen.NUI
             float totalWeight = 0.0f;
 
             // Reset total length
-            _totalLength = 0.0f;
-            float usedExcessSpace =0.0f;
+            totalLength = 0.0f;
+            float usedExcessSpace = 0.0f;
             HeightAndWidthState childState = new HeightAndWidthState(MeasuredSize.StateType.MeasuredSizeOK,
                                                                      MeasuredSize.StateType.MeasuredSizeOK);
 
@@ -497,13 +509,13 @@ namespace Tizen.NUI
                 totalWeight += childWeight;
 
                 bool useExcessSpace = (childLayout.Owner.HeightSpecification == 0) && (childWeight > 0);
-                if( isExactly && useExcessSpace )
+                if (isExactly && useExcessSpace)
                 {
-                   _totalLength = Math.Max( _totalLength, (_totalLength + childMargin.Top + childMargin.Bottom) );
+                    totalLength = Math.Max(totalLength, (totalLength + childMargin.Top + childMargin.Bottom));
                 }
                 else
                 {
-                    if( useExcessSpace )
+                    if (useExcessSpace)
                     {
                         // The heightMode is either Unspecified or AtMost, and
                         // this child is only laid out using excess space. Measure
@@ -538,16 +550,16 @@ namespace Tizen.NUI
 
                     if (isExactly)
                     {
-                        _totalLength += length.AsDecimal();
+                        totalLength += length.AsDecimal();
                     }
                     else
                     {
-                        _totalLength = Math.Max(_totalLength, _totalLength + length.AsDecimal() + (i < LayoutChildren.Count - 1 ? CellPadding.Height : 0));
+                        totalLength = Math.Max(totalLength, totalLength + length.AsDecimal() + (i < LayoutChildren.Count - 1 ? CellPadding.Height : 0));
                     }
                 }
 
                 bool matchWidthLocally = false;
-                if( widthMode != MeasureSpecification.ModeType.Exactly && childDesiredWidth ==  LayoutParamPolicies.MatchParent)
+                if (widthMode != MeasureSpecification.ModeType.Exactly && childDesiredWidth == LayoutParamPolicies.MatchParent)
                 {
                     // Will have to re-measure at least this child when we know exact height.
                     matchWidth = true;
@@ -566,39 +578,39 @@ namespace Tizen.NUI
                     childState.heightState = MeasuredSize.StateType.MeasuredSizeTooSmall;
                 }
 
-                maxWidth = Math.Max( maxWidth, childWidth);
-                allFillParent = ( allFillParent && childDesiredWidth == LayoutParamPolicies.MatchParent);
+                maxWidth = Math.Max(maxWidth, childWidth);
+                allFillParent = (allFillParent && childDesiredWidth == LayoutParamPolicies.MatchParent);
 
                 if (childWeight > 0)
                 {
                     // Widths of weighted Views are bogus if we end up remeasuring, so keep them separate.
-                    weightedMaxWidth = Math.Max( weightedMaxWidth,  matchWidthLocally ? marginWidth : childWidth);
+                    weightedMaxWidth = Math.Max(weightedMaxWidth, matchWidthLocally ? marginWidth : childWidth);
                 }
                 else
                 {
-                    alternativeMaxWidth = Math.Max( alternativeMaxWidth, matchWidthLocally ? marginWidth : childWidth);
+                    alternativeMaxWidth = Math.Max(alternativeMaxWidth, matchWidthLocally ? marginWidth : childWidth);
                 }
             } // foreach
 
 
-            float heightSize = _totalLength;
-            heightSize = Math.Max( heightSize, SuggestedMinimumHeight.AsDecimal());
-            MeasuredSize heightSizeAndState = ResolveSizeAndState( new LayoutLength(heightSize + Padding.Top + Padding.Bottom), heightMeasureSpec, MeasuredSize.StateType.MeasuredSizeOK );
+            float heightSize = totalLength;
+            heightSize = Math.Max(heightSize, SuggestedMinimumHeight.AsDecimal());
+            MeasuredSize heightSizeAndState = ResolveSizeAndState(new LayoutLength(heightSize + Padding.Top + Padding.Bottom), heightMeasureSpec, MeasuredSize.StateType.MeasuredSizeOK);
             heightSize = heightSizeAndState.Size.AsDecimal();
 
             // 2nd phase:
             // We cycle through weighted children now (children with weight > 0).
             // The children are measured with exact size equal to their share of the available space based on their weights.
-            // _totalLength is updated to include weighted children measured sizes.
-            float remainingExcess = heightSize - _totalLength + usedExcessSpace - (Padding.Top + Padding.Bottom);
-            if( remainingExcess != 0 && totalWeight > 0.0f )
+            // totalLength is updated to include weighted children measured sizes.
+            float remainingExcess = heightSize - totalLength + usedExcessSpace - (Padding.Top + Padding.Bottom);
+            if (remainingExcess != 0 && totalWeight > 0.0f)
             {
                 float remainingWeight = totalWeight;
                 maxWidth = 0;
-                _totalLength = 0;
+                totalLength = 0;
 
                 int numberOfChildren = LayoutChildren.Count;
-                for( int i = 0; i < numberOfChildren; ++i )
+                for (int i = 0; i < numberOfChildren; ++i)
                 {
                     LayoutItem childLayout = LayoutChildren[i];
 
@@ -607,7 +619,7 @@ namespace Tizen.NUI
                     float childWeight = childLayout.Owner.Weight;
                     Extents childMargin = childLayout.Margin;
 
-                    if( childWeight > 0 )
+                    if (childWeight > 0)
                     {
                         MeasureWeightedChild(childLayout, remainingExcess, remainingWeight, childWeight,
                                                 widthMeasureSpec, heightMeasureSpec, childState,
@@ -617,28 +629,28 @@ namespace Tizen.NUI
                     float length = childLayout.MeasuredHeight.Size.AsDecimal() + childMargin.Top + childMargin.Bottom;
                     float cellPadding = i < numberOfChildren - 1 ? CellPadding.Height : 0;
 
-                    if( isExactly )
+                    if (isExactly)
                     {
-                        _totalLength += length;
+                        totalLength += length;
                     }
                     else
                     {
-                        float totalLength = _totalLength;
-                        _totalLength = Math.Max( _totalLength, _totalLength + length + cellPadding );
+                        float totalLength = this.totalLength;
+                        totalLength = Math.Max(totalLength, totalLength + length + cellPadding);
                     }
 
                     bool matchWidthLocally = (widthMode != MeasureSpecification.ModeType.Exactly) && (desiredChildWidth == LayoutParamPolicies.MatchParent);
                     float marginWidth = childMargin.Start + childMargin.End;
                     float childWidth = childLayout.MeasuredWidth.Size.AsDecimal() + marginWidth;
 
-                    maxWidth = Math.Max( maxWidth, childWidth );
-                    alternativeMaxWidth = Math.Max( alternativeMaxWidth, matchWidthLocally ? marginWidth : childWidth );
+                    maxWidth = Math.Max(maxWidth, childWidth);
+                    alternativeMaxWidth = Math.Max(alternativeMaxWidth, matchWidthLocally ? marginWidth : childWidth);
                     allFillParent = (allFillParent && desiredChildWidth == LayoutParamPolicies.MatchParent);
                 } // for loop
             }
             else
             {
-                alternativeMaxWidth = Math.Max( alternativeMaxWidth, weightedMaxWidth );
+                alternativeMaxWidth = Math.Max(alternativeMaxWidth, weightedMaxWidth);
             }
 
             if (!allFillParent && widthMode != MeasureSpecification.ModeType.Exactly)
@@ -646,17 +658,17 @@ namespace Tizen.NUI
                 maxWidth = alternativeMaxWidth;
             }
 
-            maxWidth += (Owner.WidthSpecification == LayoutParamPolicies.WrapContent)?(Padding.Start + Padding.End):0;
-            maxWidth = Math.Max( maxWidth, SuggestedMinimumWidth.AsRoundedValue());
+            maxWidth += (Owner.WidthSpecification == LayoutParamPolicies.WrapContent) ? (Padding.Start + Padding.End) : 0;
+            maxWidth = Math.Max(maxWidth, SuggestedMinimumWidth.AsRoundedValue());
 
             heightSizeAndState.State = childState.heightState;
 
-            SetMeasuredDimensions( ResolveSizeAndState( new LayoutLength(maxWidth + Padding.Top + Padding.Bottom), widthMeasureSpec, childState.widthState ),
-                                  heightSizeAndState );
+            SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(maxWidth + Padding.Top + Padding.Bottom), widthMeasureSpec, childState.widthState),
+                                  heightSizeAndState);
 
             if (matchWidth)
             {
-                ForceUniformWidth(heightMeasureSpec );
+                ForceUniformWidth(heightMeasureSpec);
             }
         } // MeasureVertical
 
@@ -671,7 +683,7 @@ namespace Tizen.NUI
             LayoutLength height = new LayoutLength(bottom - top);
 
             // Space available for child
-            LayoutLength childSpace = new LayoutLength( height - Padding.Top - Padding.Bottom);
+            LayoutLength childSpace = new LayoutLength(height - Padding.Top - Padding.Bottom);
 
             int count = LayoutChildren.Count;
 
@@ -686,13 +698,13 @@ namespace Tizen.NUI
                     }
                     else
                     {
-                        childLeft = new LayoutLength(Padding.Start + right.AsDecimal() - left.AsDecimal() - _totalLength);
+                        childLeft = new LayoutLength(Padding.Start + right.AsDecimal() - left.AsDecimal() - totalLength);
                     }
                     break;
                 case Alignment.CenterHorizontal: // FALL THROUGH
                 case Alignment.Center:
                     // totalLength contains the padding already
-                    childLeft = new LayoutLength(Padding.Start + (right.AsDecimal() - left.AsDecimal() - _totalLength) / 2.0f);
+                    childLeft = new LayoutLength(Padding.Start + (right.AsDecimal() - left.AsDecimal() - totalLength) / 2.0f);
                     break;
                 case Alignment.Begin: // FALL THROUGH (default)
                 default:
@@ -700,7 +712,7 @@ namespace Tizen.NUI
                     // In case of RTL map BEGIN alignment to the right edge
                     if (isLayoutRtl)
                     {
-                        childLeft = new LayoutLength(Padding.Start  + right.AsDecimal() - left.AsDecimal() - _totalLength);
+                        childLeft = new LayoutLength(Padding.Start + right.AsDecimal() - left.AsDecimal() - totalLength);
                     }
                     else
                     {
@@ -719,25 +731,25 @@ namespace Tizen.NUI
                 dir = -1;
             }
 
-            forint i = 0; i < count; i++)
+            for (int i = 0; i < count; i++)
             {
                 int childIndex = start + dir * i;
                 // Get a reference to the childLayout at the given index
                 LayoutItem childLayout = LayoutChildren[childIndex];
-                if( childLayout != null )
+                if (childLayout != null)
                 {
                     LayoutLength childWidth = childLayout.MeasuredWidth.Size;
                     LayoutLength childHeight = childLayout.MeasuredHeight.Size;
                     Extents childMargin = childLayout.Margin;
 
-                    switch ( LinearAlignment )
+                    switch (LinearAlignment)
                     {
                         case Alignment.Bottom:
                             childTop = new LayoutLength(height - Padding.Bottom - childHeight - childMargin.Bottom);
                             break;
                         case Alignment.CenterVertical:
                         case Alignment.Center: // FALLTHROUGH
-                            childTop = new LayoutLength(Padding.Top + ( ( childSpace - childHeight ).AsDecimal() / 2.0f ) + childMargin.Top - childMargin.Bottom);
+                            childTop = new LayoutLength(Padding.Top + ((childSpace - childHeight).AsDecimal() / 2.0f) + childMargin.Top - childMargin.Bottom);
                             break;
                         case Alignment.Top: // FALLTHROUGH default
                         default:
@@ -760,59 +772,59 @@ namespace Tizen.NUI
             LayoutLength width = new LayoutLength(right - left);
 
             // Space available for child
-            LayoutLength childSpace = new LayoutLength( width - Padding.Start - Padding.End);
+            LayoutLength childSpace = new LayoutLength(width - Padding.Start - Padding.End);
 
             int count = LayoutChildren.Count;
 
             switch (LinearAlignment)
             {
-              case Alignment.Bottom:
-                // totalLength contains the padding already
-                childTop = new LayoutLength( Padding.Top + bottom.AsDecimal() - top.AsDecimal() - _totalLength);
-                break;
-              case Alignment.CenterVertical: // FALL THROUGH
-              case Alignment.Center:
-                // totalLength contains the padding already
-                childTop = new LayoutLength(Padding.Top + ( bottom.AsDecimal() - top.AsDecimal() - _totalLength ) / 2.0f);
-                break;
-              case Alignment.Top:  // FALL THROUGH (default)
-              default:
-                // totalLength contains the padding already
-                childTop = new LayoutLength( Padding.Top );
-                break;
+                case Alignment.Bottom:
+                    // totalLength contains the padding already
+                    childTop = new LayoutLength(Padding.Top + bottom.AsDecimal() - top.AsDecimal() - totalLength);
+                    break;
+                case Alignment.CenterVertical: // FALL THROUGH
+                case Alignment.Center:
+                    // totalLength contains the padding already
+                    childTop = new LayoutLength(Padding.Top + (bottom.AsDecimal() - top.AsDecimal() - totalLength) / 2.0f);
+                    break;
+                case Alignment.Top:  // FALL THROUGH (default)
+                default:
+                    // totalLength contains the padding already
+                    childTop = new LayoutLength(Padding.Top);
+                    break;
             }
 
-            forint i = 0; i < count; i++)
+            for (int i = 0; i < count; i++)
             {
                 LayoutItem childLayout = LayoutChildren[i];
-                if( childLayout != null )
+                if (childLayout != null)
                 {
                     LayoutLength childWidth = childLayout.MeasuredWidth.Size;
                     LayoutLength childHeight = childLayout.MeasuredHeight.Size;
                     Extents childMargin = childLayout.Margin;
 
                     childTop += childMargin.Top;
-                    switch ( LinearAlignment )
+                    switch (LinearAlignment)
                     {
-                      case Alignment.Begin:
-                      default:
-                      {
-                        childLeft = new LayoutLength(Padding.Start + childMargin.Start);
-                        break;
-                      }
-                      case Alignment.End:
-                      {
-                        childLeft = new LayoutLength(width - Padding.End - childWidth - childMargin.End);
-                        break;
-                      }
-                      case Alignment.CenterHorizontal:
-                      case Alignment.Center: // FALL THROUGH
-                      {
-                        childLeft = new LayoutLength(Padding.Start + (( childSpace - childWidth ).AsDecimal() / 2.0f) + childMargin.Start - childMargin.End);
-                        break;
-                      }
+                        case Alignment.Begin:
+                        default:
+                            {
+                                childLeft = new LayoutLength(Padding.Start + childMargin.Start);
+                                break;
+                            }
+                        case Alignment.End:
+                            {
+                                childLeft = new LayoutLength(width - Padding.End - childWidth - childMargin.End);
+                                break;
+                            }
+                        case Alignment.CenterHorizontal:
+                        case Alignment.Center: // FALL THROUGH
+                            {
+                                childLeft = new LayoutLength(Padding.Start + ((childSpace - childWidth).AsDecimal() / 2.0f) + childMargin.Start - childMargin.End);
+                                break;
+                            }
                     }
-                    childLayout.Layout( childLeft, childTop, childLeft + childWidth, childTop + childHeight );
+                    childLayout.Layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight);
                     childTop += childHeight + childMargin.Bottom + ((i < count - 1) ? CellPadding.Height : 0);
                 }
             }
@@ -820,51 +832,81 @@ namespace Tizen.NUI
 
         private void ForceUniformHeight(MeasureSpecification widthMeasureSpec)
         {
-          // Pretend that the linear layout has an exact size. This is the measured height of
-          // ourselves. The measured height should be the max height of the children, changed
-          // to accommodate the heightMeasureSpec from the parent
-          MeasureSpecification uniformMeasureSpec = new MeasureSpecification( MeasuredHeight.Size, MeasureSpecification.ModeType.Exactly);
-          foreach (LayoutItem childLayout in LayoutChildren)
-          {
-              int desiredChildHeight = childLayout.Owner.HeightSpecification;
-              int desiredChildWidth = childLayout.Owner.WidthSpecification;
-
-              if (desiredChildHeight == LayoutParamPolicies.MatchParent)
-              {
-                  // Temporarily force children to reuse their original measured width
-                  int originalWidth = desiredChildWidth;
-                  childLayout.Owner.WidthSpecification = (int)childLayout.MeasuredWidth.Size.AsRoundedValue();
-                  // Remeasure with new dimensions
-                  MeasureChildWithMargins( childLayout, widthMeasureSpec, new LayoutLength(0),
-                                           uniformMeasureSpec, new LayoutLength(0) );
-                  // Restore width specification
-                  childLayout.Owner.WidthSpecification =  originalWidth;
-              }
-          }
+            // Pretend that the linear layout has an exact size. This is the measured height of
+            // ourselves. The measured height should be the max height of the children, changed
+            // to accommodate the heightMeasureSpec from the parent
+            MeasureSpecification uniformMeasureSpec = new MeasureSpecification(MeasuredHeight.Size, MeasureSpecification.ModeType.Exactly);
+            foreach (LayoutItem childLayout in LayoutChildren)
+            {
+                int desiredChildHeight = childLayout.Owner.HeightSpecification;
+                int desiredChildWidth = childLayout.Owner.WidthSpecification;
+
+                if (desiredChildHeight == LayoutParamPolicies.MatchParent)
+                {
+                    // Temporarily force children to reuse their original measured width
+                    int originalWidth = desiredChildWidth;
+                    childLayout.Owner.WidthSpecification = (int)childLayout.MeasuredWidth.Size.AsRoundedValue();
+                    // Remeasure with new dimensions
+                    MeasureChildWithMargins(childLayout, widthMeasureSpec, new LayoutLength(0),
+                                             uniformMeasureSpec, new LayoutLength(0));
+                    // Restore width specification
+                    childLayout.Owner.WidthSpecification = originalWidth;
+                }
+            }
         }
 
         private void ForceUniformWidth(MeasureSpecification heightMeasureSpec)
         {
             // Pretend that the linear layout has an exact size.
-            MeasureSpecification uniformMeasureSpec = new MeasureSpecification( MeasuredWidth.Size, MeasureSpecification.ModeType.Exactly);
+            MeasureSpecification uniformMeasureSpec = new MeasureSpecification(MeasuredWidth.Size, MeasureSpecification.ModeType.Exactly);
             foreach (LayoutItem childLayout in LayoutChildren)
             {
                 int desiredChildWidth = childLayout.Owner.WidthSpecification;
                 int desiredChildHeight = childLayout.Owner.WidthSpecification;
 
-                if (desiredChildWidth  == LayoutParamPolicies.MatchParent)
+                if (desiredChildWidth == LayoutParamPolicies.MatchParent)
                 {
                     // Temporarily force children to reuse their original measured height
                     int originalHeight = desiredChildHeight;
-                    childLayout.Owner.HeightSpecification =  (int)childLayout.MeasuredHeight.Size.AsRoundedValue();
+                    childLayout.Owner.HeightSpecification = (int)childLayout.MeasuredHeight.Size.AsRoundedValue();
 
                     // Remeasure with new dimensions
-                    MeasureChildWithMargins( childLayout, uniformMeasureSpec, new LayoutLength(0),
+                    MeasureChildWithMargins(childLayout, uniformMeasureSpec, new LayoutLength(0),
                                              heightMeasureSpec, new LayoutLength(0));
                     // Restore height specification
                     childLayout.Owner.HeightSpecification = originalHeight;
                 }
             }
         }
+
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        /// <param name="disposing">If true, disposes any disposable objects. If false, does not dispose disposable objects.</param>
+        /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposed)
+                return;
+
+            if (disposing)
+            {
+                cellPadding?.Dispose();
+            }
+            disposed = true;
+        }
+
+        /// <summary>
+        /// Dispose the window resources
+        /// </summary>
+        /// <returns></returns>
+        /// <since_tizen> 6 </since_tizen>
+        /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void Dispose()
+        {
+            Dispose(true);
+        }
     } //LinearLayout
 } // namespace
old mode 100644 (file)
new mode 100755 (executable)
index 621e531..df4132d
@@ -20,7 +20,7 @@ namespace Tizen.NUI
     /// <summary>
     /// The class storing Background extra properties such as CornerRadius, ImageBorder.
     /// </summary>
-    internal class BackgroundExtraData
+    internal class BackgroundExtraData : Disposable
     {
         internal BackgroundExtraData()
         {
index 210ff98..98d0936 100755 (executable)
@@ -24,7 +24,7 @@ namespace Tizen.NUI
     /// The Text Shadow for TextLabel.
     /// </summary>
     [EditorBrowsable(EditorBrowsableState.Never)]
-    public class TextShadow : ICloneable
+    public class TextShadow : Disposable, ICloneable
     {
         private readonly PropertyMap propertyMap = null;
 
@@ -48,6 +48,15 @@ namespace Tizen.NUI
             propertyMap["blurRadius"] = new PropertyValue(BlurRadius);
         }
 
+        /// <summary>  
+        /// destructor. This is HiddenAPI. recommended not to use in public.   
+        /// </summary> 
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        ~TextShadow()
+        {
+            Dispose();
+        }
+
         /// <summary>
         /// Deep copy method
         /// </summary>
@@ -113,5 +122,25 @@ namespace Tizen.NUI
 
             return new PropertyValue(instance.propertyMap);
         }
+
+
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void Dispose(DisposeTypes type)
+        {
+            if (disposed)
+            {
+                return;
+            }
+
+            propertyMap?.Dispose();
+            Color?.Dispose();
+            Offset?.Dispose();
+
+            base.Dispose();
+        }
     }
 }
index c5d63a3..5631d01 100755 (executable)
@@ -23,7 +23,7 @@ namespace Tizen.NUI
     /// A class encapsulating the transform map of the visual.
     /// </summary>
     /// <since_tizen> 3 </since_tizen>
-    public class VisualMap
+    public class VisualMap : Disposable
     {
         /// <summary>
         /// outputVisualMap.
@@ -684,5 +684,32 @@ namespace Tizen.NUI
             if (_visualOrigin != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Origin, new PropertyValue((int)_visualOrigin)); }
             if (_visualAnchorPoint != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)_visualAnchorPoint)); }
         }
+
+
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        protected override void Dispose(DisposeTypes type)
+        {
+            if (disposed)
+            {
+                return;
+            }
+
+            _commonlyUsedMap.Dispose();
+            _mixColor.Dispose();
+            _outputVisualMap.Dispose();
+            _shader.Dispose();
+            _visualOffset.Dispose();
+            _visualOffsetPolicy.Dispose();
+            _visualSize.Dispose();
+            _visualSizePolicy.Dispose();
+            _visualTransformMap.Dispose();
+            Parent.Dispose();
+
+            base.Dispose();
+        }
     }
 }