[dali_1.4.8] Merge branch 'devel/master'
[platform/core/uifw/dali-core.git] / dali / internal / event / size-negotiation / relayout-controller-impl.cpp
index eebc981..35190fe 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,7 +21,6 @@
 // EXTERNAL INCLUDES
 #if defined(DEBUG_ENABLED)
 #include <sstream>
-#include <dali/internal/event/common/system-overlay-impl.h>
 #endif // defined(DEBUG_ENABLED)
 
 // INTERNAL INCLUDES
@@ -31,7 +30,6 @@
 #include <dali/public-api/object/object-registry.h>
 #include <dali/internal/event/actors/actor-impl.h>
 #include <dali/internal/event/common/stage-impl.h>
-#include <dali/internal/event/common/system-overlay-impl.h>
 #include <dali/internal/event/common/thread-local-storage.h>
 
 namespace Dali
@@ -76,8 +74,8 @@ void PrintChildren( Dali::Actor actor, int level )
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, output.str().c_str() );
 
   ++level;
-  unsigned int numChildren = actor.GetChildCount();
-  for( unsigned int i=0; i<numChildren; ++i )
+  uint32_t numChildren = actor.GetChildCount();
+  for( uint32_t i=0; i<numChildren; ++i )
   {
     PrintChildren( actor.GetChildAt(i), level );
   }
@@ -132,10 +130,10 @@ RelayoutController* RelayoutController::Get()
   return &ThreadLocalStorage::Get().GetRelayoutController();
 }
 
-void RelayoutController::SetStageSize( unsigned int width, unsigned int height )
+void RelayoutController::SetStageSize( uint32_t width, uint32_t height )
 {
-  mStageSize.width = width;
-  mStageSize.height = height;
+  mStageSize.width = static_cast<float>( width );
+  mStageSize.height = static_cast<float>( height );
 }
 
 void RelayoutController::QueueActor( Dali::Actor& actor, RelayoutContainer& actors, Vector2 size )
@@ -159,7 +157,7 @@ void RelayoutController::RequestRelayout( Dali::Actor& actor, Dimension::Type di
   topOfSubTreeStack.push_back( actor );
 
   // Propagate on all dimensions
-  for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+  for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
   {
     if( dimension & ( 1 << i ) )
     {
@@ -199,7 +197,7 @@ void RelayoutController::RequestRelayout( Dali::Actor& actor, Dimension::Type di
 
   if ( !mProcessingCoreEvents )
   {
-    mRenderController.RequestProcessEventsOnIdle();
+    mRenderController.RequestProcessEventsOnIdle( false );
   }
 }
 
@@ -216,15 +214,6 @@ void RelayoutController::OnApplicationSceneCreated()
   Dali::Actor rootLayer = stage.GetRootLayer();
   RequestRelayoutTree( rootLayer );
 
-  // Also add request on the root of system overlay
-  Dali::Internal::SystemOverlay* systemOverlay = GetImplementation(stage).GetSystemOverlayInternal();
-  if( systemOverlay )
-  {
-    Dali::Internal::Actor& systemOverlayInternalRoot = systemOverlay->GetDefaultRootActor();
-    Dali::Actor systemOverlayRoot = Dali::Actor(&systemOverlayInternalRoot);
-    RequestRelayoutTree( systemOverlayRoot );
-  }
-
   // Flag request for end of frame
   Request();
 }
@@ -253,7 +242,7 @@ void RelayoutController::RequestRelayoutTree( Dali::Actor& actor )
   }
 
   // Propagate down to children
-  for( unsigned int i = 0; i < actor.GetChildCount(); ++i )
+  for( uint32_t i = 0; i < actor.GetChildCount(); ++i )
   {
     Dali::Actor child = actor.GetChildAt( i );
 
@@ -273,7 +262,7 @@ void RelayoutController::PropagateAll( Dali::Actor& actor, Dimension::Type dimen
 
     // Check for dimension dependecy: width for height/height for width etc
     // Check each possible dimension and see if it is dependent on the input one
-    for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+    for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
     {
       Dimension::Type dimensionToCheck = static_cast< Dimension::Type >( 1 << i );
 
@@ -293,9 +282,9 @@ void RelayoutController::PropagateAll( Dali::Actor& actor, Dimension::Type dimen
       {
         // Store the highest parent reached
         bool found = false;
-        for( unsigned int i = 0, count = topOfSubTreeStack.size(); i < count; ++i )
+        for( auto&& element : topOfSubTreeStack )
         {
-          if( topOfSubTreeStack[ i ] == parent )
+          if( element == parent )
           {
             found = true;
             break;
@@ -347,7 +336,7 @@ void RelayoutController::PropagateFlags( Dali::Actor& actor, Dimension::Type dim
 
     // Check for dimension dependecy: width for height/height for width etc
     // Check each possible dimension and see if it is dependent on the input one
-    for( unsigned int i = 0; i < Dimension::DIMENSION_COUNT; ++i )
+    for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i )
     {
       Dimension::Type dimensionToCheck = static_cast< Dimension::Type >( 1 << i );
 
@@ -370,7 +359,7 @@ void RelayoutController::PropagateFlags( Dali::Actor& actor, Dimension::Type dim
     }
 
     // Propagate down to children
-    for( unsigned int i = 0, childCount = actor.GetChildCount(); i < childCount; ++i )
+    for( uint32_t i = 0, childCount = actor.GetChildCount(); i < childCount; ++i )
     {
       Dali::Actor child = actor.GetChildAt( i );
       Actor& childImpl = GetImplementation( child );
@@ -389,9 +378,9 @@ void RelayoutController::AddRequest( Dali::Actor& actor )
 
   // Only add the rootActor if it is not already recorded
   bool found = false;
-  for( unsigned int i = 0, count = mDirtyLayoutSubTrees.Size(); i < count; ++i )
+  for( auto&& item : mDirtyLayoutSubTrees )
   {
-    if( mDirtyLayoutSubTrees[ i ] == actorPtr )
+    if( item == actorPtr )
     {
       found = true;
       break;
@@ -492,6 +481,9 @@ void RelayoutController::Relayout()
           //    has to fill with all the actors it has not done any size negotiation for.
 
           actorImpl.NegotiateSize( size, *mRelayoutStack );
+
+          // Reset the flag so that size negotiation will respect the actor's original resize policy
+          actorImpl.SetUseAssignedSize( false );
         }
       }