[Tizen] ActorSizer::RelayoutDependentOnXXX return default value 61/266961/2 accepted/tizen/unified/20211125.003845 submit/tizen/20211123.152301
authorEunki, Hong <eunkiki.hong@samsung.com>
Tue, 23 Nov 2021 06:18:13 +0000 (15:18 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Tue, 23 Nov 2021 06:34:23 +0000 (15:34 +0900)
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 <eunkiki.hong@samsung.com>
dali/internal/event/actors/actor-sizer.cpp

index d5c00ea..3953d4c 100644 (file)
@@ -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)