From: Bowon Ryu Date: Tue, 16 Mar 2021 02:30:34 +0000 (+0900) Subject: Revert "[NUI] Create TextLayout when parent has layout" X-Git-Tag: accepted/tizen/6.0/unified/20210316.081001~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=173dcb872cb2fc43f8040deaa3e26231c7011c99;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git Revert "[NUI] Create TextLayout when parent has layout" This patch causes issue that TextLabel margin to become zero. Revert this patch to fix issue. we need to fix layout performance issue later. This reverts commit b78d9bf284c27e065b7d194ae9124e34258d18b9. --- diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs index 54dbbeb..fd7636f 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs @@ -97,12 +97,14 @@ namespace Tizen.NUI.BaseComponents public TextLabel() : this(Interop.TextLabel.TextLabel_New__SWIG_0(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Layout = new TextLayout(); } /// This will be public opened in next release of tizen after ACR done. Before ACR, it is used as HiddenAPI (InhouseAPI). [EditorBrowsable(EditorBrowsableState.Never)] public TextLabel(TextLabelStyle viewStyle) : this(Interop.TextLabel.TextLabel_New__SWIG_0(), true, viewStyle) { + Layout = new TextLayout(); } /// @@ -114,6 +116,7 @@ namespace Tizen.NUI.BaseComponents public TextLabel(bool shown) : this(Interop.TextLabel.TextLabel_New__SWIG_0(), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Layout = new TextLayout(); SetVisible(shown); } @@ -125,6 +128,7 @@ namespace Tizen.NUI.BaseComponents public TextLabel(string text) : this(Interop.TextLabel.TextLabel_New__SWIG_1(text), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Layout = new TextLayout(); } /// @@ -137,6 +141,7 @@ namespace Tizen.NUI.BaseComponents public TextLabel(string text, bool shown) : this(Interop.TextLabel.TextLabel_New__SWIG_1(text), true) { if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Layout = new TextLayout(); SetVisible(shown); } @@ -167,14 +172,6 @@ namespace Tizen.NUI.BaseComponents } /// - /// Create internal layout of TextLabel - /// - internal LayoutItem CreateTextLayout() - { - return new TextLayout(); - } - - /// /// The TranslatableText property.
/// The text can set the SID value.
///
diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index 7bd991a..294d7ae 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -2167,23 +2167,20 @@ namespace Tizen.NUI.BaseComponents // Do not try to set Margins or Padding on a null Layout (when a layout is being removed from a View) if (value !=null) { - if (false == (this is TextLabel)) + if (Margin.Top != 0 || Margin.Bottom !=0 || Margin.Start !=0 || Margin.End != 0) { - if (Margin.Top != 0 || Margin.Bottom != 0 || Margin.Start != 0 || Margin.End != 0) - { - // If View already has a margin set then store it in Layout instead. - value.Margin = Margin; - SetValue(MarginProperty, new Extents(0, 0, 0, 0)); - NotifyPropertyChanged(); - } - - if (Padding.Top != 0 || Padding.Bottom != 0 || Padding.Start != 0 || Padding.End != 0) - { - // If View already has a padding set then store it in Layout instead. - value.Padding = Padding; - SetValue(PaddingProperty, new Extents(0, 0, 0, 0)); - NotifyPropertyChanged(); - } + // If View already has a margin set then store it in Layout instead. + value.Margin = Margin; + SetValue(MarginProperty, new Extents(0,0,0,0)); + NotifyPropertyChanged(); + } + + if (Padding.Top != 0 || Padding.Bottom !=0 || Padding.Start !=0 || Padding.End != 0) + { + // If View already has a padding set then store it in Layout instead. + value.Padding = Padding; + SetValue(PaddingProperty, new Extents(0,0,0,0)); + NotifyPropertyChanged(); } } } diff --git a/src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs b/src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs index 091824e..6d28894 100755 --- a/src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs +++ b/src/Tizen.NUI/src/public/Layouting/LayoutGroup.cs @@ -166,7 +166,7 @@ namespace Tizen.NUI { // If child of this layout is a pure View then assign it a LayoutGroup // If the child is derived from a View then it may be a legacy or existing container hence will do layouting itself. - child.Layout = (child as TextLabel)?.CreateTextLayout() ?? new AbsoluteLayout(); + child.Layout = new AbsoluteLayout(); } } else @@ -442,10 +442,6 @@ namespace Tizen.NUI // Layout takes ownership of it's owner's children. foreach (View view in Owner.Children) { - if (view is TextLabel) - { - view.Layout = (view as TextLabel)?.CreateTextLayout(); - } AddChildToLayoutGroup(view); }