From 835ef5103e6a44b106a9b04b9326984a3d8c6361 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Tue, 23 Nov 2021 15:18:13 +0900 Subject: [PATCH] [Tizen] ActorSizer::RelayoutDependentOnXXX return default value Before refactoring, when mRelayoutData doesn't exist, RelayoutDependentOnChildrenBase return true. Because DEFAULT state is "ResizePolicy::USE_NATURAL_SIZE" and It's case s.t. RelayoutDependentOnChildrenBase is true. After refactoring, if mRelayoutData is null, it always return false. This patch just sync with previous behavior. Change-Id: I8e5c9ba7a456baa2a8d8c0473c06feb6da469a87 Signed-off-by: Eunki, Hong --- dali/internal/event/actors/actor-sizer.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/dali/internal/event/actors/actor-sizer.cpp b/dali/internal/event/actors/actor-sizer.cpp index d5c00ea..3953d4c 100644 --- a/dali/internal/event/actors/actor-sizer.cpp +++ b/dali/internal/event/actors/actor-sizer.cpp @@ -62,6 +62,20 @@ constexpr float GetDimensionValue(const Dali::Vector2& values, const Dali::Dimen } return 0.0f; } + +/** + * @brief Default relayout dependent on parent when relayout is not setuped before. + */ +static constexpr bool DEFAULT_RELAYOUT_DEPENDENT_ON_PARENT = ((Dali::ResizePolicy::DEFAULT == Dali::ResizePolicy::FILL_TO_PARENT) || + (Dali::ResizePolicy::DEFAULT == Dali::ResizePolicy::SIZE_RELATIVE_TO_PARENT) || + (Dali::ResizePolicy::DEFAULT == Dali::ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT)); + +/** + * @brief Default relayout dependent on child when relayout is not setuped before. + */ +static constexpr bool DEFAULT_RELAYOUT_DEPENDENT_ON_CHILD = ((Dali::ResizePolicy::DEFAULT == Dali::ResizePolicy::FIT_TO_CHILDREN) || + (Dali::ResizePolicy::DEFAULT == Dali::ResizePolicy::USE_NATURAL_SIZE)); + } // namespace namespace Dali::Internal @@ -322,12 +336,12 @@ ActorSizer::Relayouter& ActorSizer::EnsureRelayouter() bool ActorSizer::RelayoutDependentOnParent(Dimension::Type dimension) { - return mRelayoutData && mRelayoutData->GetRelayoutDependentOnParent(dimension); + return mRelayoutData ? mRelayoutData->GetRelayoutDependentOnParent(dimension) : DEFAULT_RELAYOUT_DEPENDENT_ON_PARENT; } bool ActorSizer::RelayoutDependentOnChildrenBase(Dimension::Type dimension) { - return mRelayoutData && mRelayoutData->GetRelayoutDependentOnChildren(dimension); + return mRelayoutData ? mRelayoutData->GetRelayoutDependentOnChildren(dimension) : DEFAULT_RELAYOUT_DEPENDENT_ON_CHILD; } bool ActorSizer::RelayoutDependentOnDimension(Dimension::Type dimension, Dimension::Type dependentDimension) -- 2.7.4