Fix SVACE issue
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / actor-impl.cpp
index 5a97133..a7be0fc 100644 (file)
@@ -213,7 +213,7 @@ DALI_PROPERTY( "opacity",                   FLOAT,    true,  true,  true,  Dali:
 DALI_PROPERTY( "screenPosition",            VECTOR2,  false, false, false, Dali::DevelActor::Property::SCREEN_POSITION )
 DALI_PROPERTY( "positionUsesAnchorPoint",   BOOLEAN,  true,  false, false, Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT )
 DALI_PROPERTY( "layoutDirection",           STRING,  true,  false, false, Dali::DevelActor::Property::LAYOUT_DIRECTION )
-DALI_PROPERTY( "layoutDirectionInheritance",    BOOLEAN,  true,  false, false, Dali::DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE )
+DALI_PROPERTY( "inheritLayoutDirection",    BOOLEAN,  true,  false, false, Dali::DevelActor::Property::INHERIT_LAYOUT_DIRECTION )
 DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX )
 
 // Signals
@@ -2124,7 +2124,7 @@ Actor::Actor( DerivedType derivedType )
   mInheritScale( true ),
   mPositionUsesAnchorPoint( true ),
   mVisible( true ),
-  mLayoutDirectionInheritance( true ),
+  mInheritLayoutDirection( true ),
   mLayoutDirection( DevelActor::LayoutDirection::LTR ),
   mDrawMode( DrawMode::NORMAL ),
   mPositionInheritanceMode( Node::DEFAULT_POSITION_INHERITANCE_MODE ),
@@ -2887,24 +2887,21 @@ void Actor::SetDefaultProperty( Property::Index index, const Property::Value& pr
     case Dali::DevelActor::Property::LAYOUT_DIRECTION:
     {
       Dali::DevelActor::LayoutDirection::Type direction = mLayoutDirection;
-      bool flag = false;
 
       if( Scripting::GetEnumerationProperty< DevelActor::LayoutDirection::Type >( property, LAYOUT_DIRECTION_TABLE, LAYOUT_DIRECTION_TABLE_COUNT, direction ) )
       {
-        flag = mLayoutDirectionInheritance;
-        mLayoutDirectionInheritance = true;
-        InheritLayoutDirectionRecursively( this, direction );
-        mLayoutDirectionInheritance = flag;
+        mInheritLayoutDirection = false;
+        InheritLayoutDirectionRecursively( this, direction, true );
       }
       break;
     }
 
-    case Dali::DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE:
+    case Dali::DevelActor::Property::INHERIT_LAYOUT_DIRECTION:
     {
       bool value = false;
-      if( property.Get( value ) && value != mLayoutDirectionInheritance )
+      if( property.Get( value ) )
       {
-        mLayoutDirectionInheritance = value;
+        SetInheritLayoutDirection( value );
       }
       break;
     }
@@ -4153,13 +4150,13 @@ bool Actor::GetCachedPropertyValue( Property::Index index, Property::Value& valu
 
     case Dali::DevelActor::Property::LAYOUT_DIRECTION:
     {
-      value = Scripting::GetLinearEnumerationName< DevelActor::LayoutDirection::Type >( mLayoutDirection, LAYOUT_DIRECTION_TABLE, LAYOUT_DIRECTION_TABLE_COUNT );
+      value = mLayoutDirection;
       break;
     }
 
-    case Dali::DevelActor::Property::LAYOUT_DIRECTION_INHERITANCE:
+    case Dali::DevelActor::Property::INHERIT_LAYOUT_DIRECTION:
     {
-      value = mLayoutDirectionInheritance;
+      value = IsLayoutDirectionInherited();
       break;
     }
 
@@ -5212,7 +5209,7 @@ void Actor::Lower()
     ActorContainer& siblings = *(mParent->mChildren);
     if( siblings.front() != this ) // If not already at beginning
     {
-      for( size_t i=0; i<siblings.size(); ++i )
+      for( size_t i=1; i<siblings.size(); ++i )
       {
         if( siblings[i] == this )
         {
@@ -5333,9 +5330,27 @@ void Actor::LowerBelow( Internal::Actor& target )
   }
 }
 
-void Actor::InheritLayoutDirectionRecursively( ActorPtr actor, Dali::DevelActor::LayoutDirection::Type direction )
+void Actor::SetInheritLayoutDirection( bool inherit )
+{
+  if( mInheritLayoutDirection != inherit )
+  {
+    mInheritLayoutDirection = inherit;
+
+    if( inherit && mParent )
+    {
+      InheritLayoutDirectionRecursively( this, mParent->mLayoutDirection );
+    }
+  }
+}
+
+bool Actor::IsLayoutDirectionInherited() const
 {
-  if( actor && actor->mLayoutDirectionInheritance )
+  return mInheritLayoutDirection;
+}
+
+void Actor::InheritLayoutDirectionRecursively( ActorPtr actor, Dali::DevelActor::LayoutDirection::Type direction, bool set )
+{
+  if( actor && ( actor->mInheritLayoutDirection || set ) )
   {
     if( actor->mLayoutDirection != direction)
     {
@@ -5353,7 +5368,6 @@ void Actor::InheritLayoutDirectionRecursively( ActorPtr actor, Dali::DevelActor:
       }
     }
   }
-
 }
 
 } // namespace Internal