fixing some of the comments and changing copy-by-value to by reference in size negoti...
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / public-api / controls / control-impl.cpp
index 8a924f9..e6ba7db 100644 (file)
@@ -865,7 +865,7 @@ bool Control::OnAccessibilityValueChange(bool isIncrease)
   return false; // Accessibility value change action is not handled by default
 }
 
-void Control::NegotiateSize( Vector2 allocatedSize, ActorSizeContainer& container )
+void Control::NegotiateSize( const Vector2& allocatedSize, ActorSizeContainer& container )
 {
   Vector2 size;
 
@@ -967,7 +967,12 @@ void Control::NegotiateSize( Vector2 allocatedSize, ActorSizeContainer& containe
                  allocatedSize.x, allocatedSize.y,
                  size.x, size.y );
 
-  Relayout( size, container );
+  // Avoids relayout again when OnSizeSet callback arrives as a function of us or deriving class calling SetSize()
+  mImpl->mInsideRelayout = true;
+  Self().SetSize( size );
+  // Only relayout controls which requested to be relaid out.
+  OnRelayout( size, container );
+  mImpl->mInsideRelayout = false;
 }
 
 void Control::SetAsKeyboardFocusGroup(bool isFocusGroup)
@@ -1178,7 +1183,7 @@ void Control::RelayoutRequest()
   }
 }
 
-void Control::Relayout( Actor actor, Vector2 size, ActorSizeContainer& container )
+void Control::Relayout( Actor actor, const Vector2& size, ActorSizeContainer& container )
 {
   if ( actor )
   {
@@ -1259,7 +1264,7 @@ void Control::OnControlSizeSet( const Vector3& size )
 {
 }
 
-void Control::OnRelaidOut( Vector2 size, ActorSizeContainer& container )
+void Control::OnRelayout( const Vector2& size, ActorSizeContainer& container )
 {
   unsigned int numChildren = Self().GetChildCount();
 
@@ -1393,18 +1398,6 @@ void Control::DoStyleChange( Toolkit::StyleManager styleManager, StyleChange cha
   }
 }
 
-void Control::Relayout(Vector2 size, ActorSizeContainer& container)
-{
-  // Avoids relayout again when OnSizeSet callback arrives.
-  mImpl->mInsideRelayout = true;
-  Self().SetSize( size );
-  // @todo this really needs to be at the end of method but not sure why the scope used to be only the SetSize, needs to be cleaned up in size negotiation rework
-  mImpl->mInsideRelayout = false;
-
-  // Only relayout controls which requested to be relaid out.
-  OnRelaidOut( size, container );
-}
-
 } // namespace Internal
 
 } // namespace Toolkit