[Tizen] ActorSizer::RelayoutDependentOnXXX return default value 62/266962/3 accepted/tizen/6.5/unified/20211125.060611 submit/tizen_6.5/20211124.102337
authorEunki, Hong <eunkiki.hong@samsung.com>
Tue, 23 Nov 2021 06:19:16 +0000 (15:19 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Tue, 23 Nov 2021 06:33:12 +0000 (15:33 +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: I3023b97a68c96178a1dfaccd9acd56e4dff8e8b6
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)