X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fsize-negotiation%2Frelayout-controller-impl.cpp;h=497f5154ecd7fc00cd04c95d3c5d768b918cd6a3;hb=6628a6f026addb0c8547141f8b0817783bccf2e0;hp=0d6b927a429d419b697a6e3d4db3151f0b6c4dd4;hpb=805869e5d222f4c49c655564c7574e06beb0fcf3;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/size-negotiation/relayout-controller-impl.cpp b/dali/internal/event/size-negotiation/relayout-controller-impl.cpp index 0d6b927..497f515 100644 --- a/dali/internal/event/size-negotiation/relayout-controller-impl.cpp +++ b/dali/internal/event/size-negotiation/relayout-controller-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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,29 +21,26 @@ // EXTERNAL INCLUDES #if defined(DEBUG_ENABLED) #include -#include #endif // defined(DEBUG_ENABLED) // INTERNAL INCLUDES #include #include -#include -#include #include #include #include +#include +#include namespace Dali { - namespace Internal { - namespace { #if defined(DEBUG_ENABLED) -Integration::Log::Filter* gLogFilter( Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_RELAYOUT_CONTROLLER") ); +Integration::Log::Filter* gLogFilter(Integration::Log::Filter::New(Debug::NoLogging, false, "LOG_RELAYOUT_CONTROLLER")); /** * Prints out all the children of the given actor when debug is enabled. @@ -51,34 +48,34 @@ Integration::Log::Filter* gLogFilter( Integration::Log::Filter::New(Debug::NoLog * @param[in] actor The actor whose children to print. * @param[in] level The number of " | " to put in front of the children. */ -void PrintChildren( Dali::Actor actor, int level ) +void PrintChildren(Dali::Actor actor, int level) { std::ostringstream output; - for ( int t = 0; t < level; ++t ) + for(int t = 0; t < level; ++t) { output << " | "; } output << actor.GetTypeName(); - output << ", " << actor.GetName(); + output << ", " << actor.GetProperty(Dali::Actor::Property::NAME); - output << " - Pos: " << actor.GetCurrentPosition() << " Size: " << actor.GetTargetSize(); + output << " - Pos: " << actor.GetCurrentProperty(Dali::Actor::Property::POSITION) << " Size: " << actor.GetTargetSize(); - output << ", Dirty: (" << ( GetImplementation( actor ).IsLayoutDirty( Dimension::WIDTH ) ? "TRUE" : "FALSE" ) << "," << ( GetImplementation( actor ).IsLayoutDirty( Dimension::HEIGHT ) ? "TRUE" : "FALSE" ) << ")"; - output << ", Negotiated: (" << ( GetImplementation( actor ).IsLayoutNegotiated( Dimension::WIDTH ) ? "TRUE" : "FALSE" ) << "," << ( GetImplementation( actor ).IsLayoutNegotiated( Dimension::HEIGHT ) ? "TRUE" : "FALSE" ) << ")"; - output << ", Enabled: " << ( GetImplementation( actor ).IsRelayoutEnabled() ? "TRUE" : "FALSE" ); + output << ", Dirty: (" << (GetImplementation(actor).IsLayoutDirty(Dimension::WIDTH) ? "TRUE" : "FALSE") << "," << (GetImplementation(actor).IsLayoutDirty(Dimension::HEIGHT) ? "TRUE" : "FALSE") << ")"; + output << ", Negotiated: (" << (GetImplementation(actor).IsLayoutNegotiated(Dimension::WIDTH) ? "TRUE" : "FALSE") << "," << (GetImplementation(actor).IsLayoutNegotiated(Dimension::HEIGHT) ? "TRUE" : "FALSE") << ")"; + output << ", Enabled: " << (GetImplementation(actor).IsRelayoutEnabled() ? "TRUE" : "FALSE"); output << ", (" << actor.GetObjectPtr() << ")" << std::endl; - DALI_LOG_INFO( gLogFilter, Debug::Verbose, output.str().c_str() ); + DALI_LOG_INFO(gLogFilter, Debug::Verbose, output.str().c_str()); ++level; - unsigned int numChildren = actor.GetChildCount(); - for( unsigned int i=0; iIsEnabledFor( Debug::Verbose ) ) + if(gLogFilter->IsEnabledFor(Debug::Verbose)) { - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "---------- ROOT LAYER ----------\n" ); - PrintChildren( Stage::GetCurrent()->GetRootLayer(), 0 ); + DALI_LOG_INFO(gLogFilter, Debug::Verbose, "---------- ROOT LAYER ----------\n"); + + PrintChildren(Stage::GetCurrent()->GetRootLayer(), 0); } } @@ -105,20 +103,19 @@ void PrintHierarchy() } // unnamed namespace -RelayoutController::RelayoutController( Integration::RenderController& controller ) -: mRenderController( controller ), +RelayoutController::RelayoutController(Integration::RenderController& controller) +: mRenderController(controller), mRelayoutInfoAllocator(), - mSlotDelegate( this ), - mRelayoutStack( new MemoryPoolRelayoutContainer( mRelayoutInfoAllocator ) ), - mStageSize(), // zero initialized - mRelayoutConnection( false ), - mRelayoutFlag( false ), - mEnabled( false ), - mPerformingRelayout( false ), - mProcessingCoreEvents( false ) + mSlotDelegate(this), + mRelayoutStack(new MemoryPoolRelayoutContainer(mRelayoutInfoAllocator)), + mRelayoutConnection(false), + mRelayoutFlag(false), + mEnabled(false), + mPerformingRelayout(false), + mProcessingCoreEvents(false) { // Make space for 32 controls to avoid having to copy construct a lot in the beginning - mRelayoutStack->Reserve( 32 ); + mRelayoutStack->Reserve(32); } RelayoutController::~RelayoutController() @@ -128,332 +125,308 @@ RelayoutController::~RelayoutController() RelayoutController* RelayoutController::Get() { - return &ThreadLocalStorage::Get().GetRelayoutController(); -} + // There was crash when destroying actors and the ResizePolicy is USE_NATURAL_SIZE + // The ThreadLocalStorage::Get() only retrieve STL without checking if it exists. + // The caller of RelayoutController::Get() should check if RelayoutController is not null. + if(ThreadLocalStorage::Created()) + { + return &ThreadLocalStorage::Get().GetRelayoutController(); + } -void RelayoutController::SetStageSize( unsigned int width, unsigned int height ) -{ - mStageSize.width = width; - mStageSize.height = height; + return nullptr; } -void RelayoutController::QueueActor( Dali::Actor& actor, RelayoutContainer& actors, Vector2 size ) +void RelayoutController::QueueActor(Internal::Actor* actor, RelayoutContainer& actors, Vector2 size) { - if( GetImplementation( actor ).RelayoutRequired() ) + if(actor && actor->RelayoutRequired()) { - actors.Add( actor, size ); + Dali::Actor actorHandle = Dali::Actor(actor); + actors.Add(actorHandle, size); } } -void RelayoutController::RequestRelayout( Dali::Actor& actor, Dimension::Type dimension ) +void RelayoutController::RequestRelayout(Dali::Actor& actor, Dimension::Type dimension) { - if( !mEnabled ) + if(!mEnabled) { return; } - std::vector< Dali::Actor > potentialRedundantSubRoots; - std::vector< Dali::Actor > topOfSubTreeStack; + std::vector potentialRedundantSubRoots; + std::vector topOfSubTreeStack; - topOfSubTreeStack.push_back( actor ); + 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 ) ) + if(dimension & (1 << i)) { // Do the propagation - PropagateAll( actor, static_cast< Dimension::Type >( 1 << i ), topOfSubTreeStack, potentialRedundantSubRoots ); + PropagateAll(actor, static_cast(1 << i), topOfSubTreeStack, potentialRedundantSubRoots); } } - while( !topOfSubTreeStack.empty() ) + while(!topOfSubTreeStack.empty()) { // Request this actor as head of sub-tree if it is not dependent on a parent that is dirty Dali::Actor subTreeActor = topOfSubTreeStack.back(); topOfSubTreeStack.pop_back(); Dali::Actor parent = subTreeActor.GetParent(); - if( !parent || !( GetImplementation( subTreeActor ).RelayoutDependentOnParent() && GetImplementation( parent ).RelayoutRequired() ) ) + if(!parent || !(GetImplementation(subTreeActor).RelayoutDependentOnParent() && GetImplementation(parent).RelayoutRequired())) { // Add sub tree root to relayout list - AddRequest( subTreeActor ); + AddRequest(subTreeActor); // Flag request for end of frame Request(); } else { - potentialRedundantSubRoots.push_back( subTreeActor ); + potentialRedundantSubRoots.push_back(subTreeActor); } } // Remove any redundant sub-tree heads - for( std::vector< Dali::Actor >::iterator it = potentialRedundantSubRoots.begin(), itEnd = potentialRedundantSubRoots.end(); it != itEnd; ++it ) + for(auto& subRoot : potentialRedundantSubRoots) { - Dali::Actor subRoot = *it; - - RemoveRequest( subRoot ); + RemoveRequest(subRoot); } - if ( !mProcessingCoreEvents ) + if(!mProcessingCoreEvents) { - mRenderController.RequestProcessEventsOnIdle(); + mRenderController.RequestProcessEventsOnIdle(false); } } void RelayoutController::OnApplicationSceneCreated() { - DALI_LOG_INFO( gLogFilter, Debug::General, "[Internal::RelayoutController::OnApplicationSceneCreated]\n" ); + DALI_LOG_INFO(gLogFilter, Debug::General, "[Internal::RelayoutController::OnApplicationSceneCreated]\n"); // Open relayout controller to receive relayout requests mEnabled = true; - // Spread the dirty flag through whole tree - don't need to explicity - // add request on rootLayer as it will automatically be added below. - Dali::Actor rootLayer = Dali::Stage::GetCurrent().GetRootLayer(); - RequestRelayoutTree( rootLayer ); - // Flag request for end of frame Request(); } -void RelayoutController::RequestRelayoutTree( Dali::Actor& actor ) +void RelayoutController::RequestRelayoutTree(Dali::Actor& actor) { - if( !mEnabled ) + if(!mEnabled) { return; } // Only set dirty flag if doing relayout and not already marked as dirty - Actor& actorImpl = GetImplementation( actor ); - if( actorImpl.RelayoutPossible() ) + Actor& actorImpl = GetImplementation(actor); + if(actorImpl.RelayoutPossible()) { // If parent is not in relayout we are at the top of a new sub-tree Dali::Actor parent = actor.GetParent(); - if( !parent || !GetImplementation( parent ).IsRelayoutEnabled() ) + if(!parent || !GetImplementation(parent).IsRelayoutEnabled()) { - AddRequest( actor ); + AddRequest(actor); } // Set dirty flag on actors that are enabled - actorImpl.SetLayoutDirty( true ); - actorImpl.SetLayoutNegotiated( false ); // Reset this flag ready for next relayout + actorImpl.SetLayoutDirty(true); + actorImpl.SetLayoutNegotiated(false); // Reset this flag ready for next relayout } // 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 ); + Dali::Actor child = actor.GetChildAt(i); - RequestRelayoutTree( child ); + RequestRelayoutTree(child); } } -void RelayoutController::PropagateAll( Dali::Actor& actor, Dimension::Type dimension, std::vector< Dali::Actor >& topOfSubTreeStack, std::vector< Dali::Actor >& potentialRedundantSubRoots ) +void RelayoutController::PropagateAll(Dali::Actor& actor, Dimension::Type dimension, std::vector& topOfSubTreeStack, std::vector& potentialRedundantSubRoots) { // Only set dirty flag if doing relayout and not already marked as dirty - Actor& actorImpl = GetImplementation( actor ); - if( actorImpl.RelayoutPossible( dimension ) ) + Actor& actorImpl = GetImplementation(actor); + if(actorImpl.RelayoutPossible(dimension)) { // Set dirty and negotiated flags - actorImpl.SetLayoutDirty( true, dimension ); - actorImpl.SetLayoutNegotiated( false, dimension ); // Reset this flag ready for next relayout + actorImpl.SetLayoutDirty(true, dimension); + actorImpl.SetLayoutNegotiated(false, dimension); // Reset this flag ready for next relayout // 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 ); + Dimension::Type dimensionToCheck = static_cast(1 << i); - if( actorImpl.RelayoutDependentOnDimension( dimension, dimensionToCheck ) && - !actorImpl.IsLayoutDirty( dimensionToCheck ) ) + if(actorImpl.RelayoutDependentOnDimension(dimension, dimensionToCheck) && + !actorImpl.IsLayoutDirty(dimensionToCheck)) { - PropagateAll( actor, dimensionToCheck, topOfSubTreeStack, potentialRedundantSubRoots ); + PropagateAll(actor, dimensionToCheck, topOfSubTreeStack, potentialRedundantSubRoots); } } // Propagate up to parent Dali::Actor parent = actor.GetParent(); - if( parent ) + if(parent) { - Actor& parentImpl = GetImplementation( parent ); - if( parentImpl.RelayoutDependentOnChildren( dimension ) && !parentImpl.IsLayoutDirty( dimension ) ) + Actor& parentImpl = GetImplementation(parent); + if(parentImpl.RelayoutDependentOnChildren(dimension) && !parentImpl.IsLayoutDirty(dimension)) { // 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; } } - if( !found ) + if(!found) { - topOfSubTreeStack.push_back( parent ); + topOfSubTreeStack.push_back(parent); } // Propagate up - PropagateAll( parent, dimension, topOfSubTreeStack, potentialRedundantSubRoots ); + PropagateAll(parent, dimension, topOfSubTreeStack, potentialRedundantSubRoots); } } // Propagate down to children - for( unsigned int i = 0, childCount = actor.GetChildCount(); i < childCount; ++i ) + for(unsigned int i = 0, childCount = actor.GetChildCount(); i < childCount; ++i) { - Dali::Actor child = actor.GetChildAt( i ); - Actor& childImpl = GetImplementation( child ); + Dali::Actor child = actor.GetChildAt(i); + Actor& childImpl = GetImplementation(child); - if( childImpl.IsRelayoutEnabled() && childImpl.RelayoutDependentOnParent( dimension ) ) + if(childImpl.IsRelayoutEnabled() && childImpl.RelayoutDependentOnParent(dimension)) { - if( childImpl.IsLayoutDirty( dimension ) ) + if(childImpl.IsLayoutDirty(dimension)) { // We have found a child that could potentially have already been collected for relayout - potentialRedundantSubRoots.push_back( child ); + potentialRedundantSubRoots.push_back(child); } else { - PropagateAll( child, dimension, topOfSubTreeStack, potentialRedundantSubRoots ); + PropagateAll(child, dimension, topOfSubTreeStack, potentialRedundantSubRoots); } } } } } - -void RelayoutController::PropagateFlags( Dali::Actor& actor, Dimension::Type dimension ) +void RelayoutController::PropagateFlags(Dali::Actor& actor, Dimension::Type dimension) { // Only set dirty flag if doing relayout and not already marked as dirty - Actor& actorImpl = GetImplementation( actor ); - if( actorImpl.IsRelayoutEnabled() ) + Actor& actorImpl = GetImplementation(actor); + if(actorImpl.IsRelayoutEnabled()) { // Set dirty and negotiated flags - actorImpl.SetLayoutDirty( true, dimension ); - actorImpl.SetLayoutNegotiated( false, dimension ); // Reset this flag ready for next relayout + actorImpl.SetLayoutDirty(true, dimension); + actorImpl.SetLayoutNegotiated(false, dimension); // Reset this flag ready for next relayout // 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 ); + Dimension::Type dimensionToCheck = static_cast(1 << i); - if( actorImpl.RelayoutDependentOnDimension( dimension, dimensionToCheck ) ) + if(actorImpl.RelayoutDependentOnDimension(dimension, dimensionToCheck)) { - PropagateFlags( actor, dimensionToCheck ); + PropagateFlags(actor, dimensionToCheck); } } // Propagate up to parent Dali::Actor parent = actor.GetParent(); - if( parent ) + if(parent) { - Actor& parentImpl = GetImplementation( parent ); - if( parentImpl.RelayoutDependentOnChildren( dimension ) ) + Actor& parentImpl = GetImplementation(parent); + if(parentImpl.RelayoutDependentOnChildren(dimension)) { // Propagate up - PropagateFlags( parent, dimension ); + PropagateFlags(parent, dimension); } } // 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 ); + Dali::Actor child = actor.GetChildAt(i); + Actor& childImpl = GetImplementation(child); - if( childImpl.RelayoutDependentOnParent( dimension ) ) + if(childImpl.RelayoutDependentOnParent(dimension)) { - PropagateFlags( child, dimension ); + PropagateFlags(child, dimension); } } } } -void RelayoutController::AddRequest( Dali::Actor& actor ) +void RelayoutController::AddRequest(Dali::Actor& actor) { - BaseObject* actorPtr = &GetImplementation( actor ); + Internal::Actor* actorPtr = &GetImplementation(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 ) - { - if( mDirtyLayoutSubTrees[ i ] == actorPtr ) - { - found = true; - break; - } - } + auto itr = std::find(mDirtyLayoutSubTrees.begin(), mDirtyLayoutSubTrees.end(), actorPtr); - if( !found ) + if(itr == mDirtyLayoutSubTrees.end()) { - mDirtyLayoutSubTrees.PushBack( actorPtr ); + mDirtyLayoutSubTrees.PushBack(actorPtr); } } -void RelayoutController::RemoveRequest( Dali::Actor& actor ) +void RelayoutController::RemoveRequest(Dali::Actor& actor) { - BaseObject* actorPtr = &GetImplementation( actor ); + Internal::Actor* actorPtr = &GetImplementation(actor); - // Remove actor from dirty sub trees - for( RawActorList::Iterator it = mDirtyLayoutSubTrees.Begin(), itEnd = mDirtyLayoutSubTrees.End(); it != itEnd; ++it ) - { - if( *it == actorPtr ) - { - mDirtyLayoutSubTrees.Erase( it ); - break; - } - } + mDirtyLayoutSubTrees.Erase(std::remove(mDirtyLayoutSubTrees.begin(), + mDirtyLayoutSubTrees.end(), + actorPtr), + mDirtyLayoutSubTrees.end()); } void RelayoutController::Request() { mRelayoutFlag = true; - if( !mRelayoutConnection ) + if(!mRelayoutConnection) { - Dali::Stage stage = Dali::Stage::GetCurrent(); - stage.GetObjectRegistry().ObjectDestroyedSignal().Connect( mSlotDelegate, &RelayoutController::OnObjectDestroyed ); + ThreadLocalStorage::Get().GetObjectRegistry().ObjectDestroyedSignal().Connect(mSlotDelegate, &RelayoutController::OnObjectDestroyed); mRelayoutConnection = true; } } -void RelayoutController::OnObjectDestroyed( const Dali::RefObject* object ) +void RelayoutController::OnObjectDestroyed(const Dali::RefObject* object) { // Search for and null the object if found in the following lists - FindAndZero( mDirtyLayoutSubTrees, object ); + FindAndZero(mDirtyLayoutSubTrees, object); } void RelayoutController::Relayout() { // Only do something when requested - if( mRelayoutFlag ) + if(mRelayoutFlag) { mPerformingRelayout = true; // Clear the flag as we're now doing the relayout mRelayoutFlag = false; - // 1. Finds all top-level controls from the dirty list and allocate them the size of the stage - // These controls are paired with the parent/stage size and added to the stack. - for( RawActorList::Iterator it = mDirtyLayoutSubTrees.Begin(), itEnd = mDirtyLayoutSubTrees.End(); it != itEnd; ++it ) + // 1. Finds all top-level controls from the dirty list and allocate them the size of the scene + // These controls are paired with the parent/scene size and added to the stack. + for(auto& dirtyActor : mDirtyLayoutSubTrees) { - BaseObject* dirtyActor = *it; - // Need to test if actor is valid (could have been deleted and had the pointer cleared) - if( dirtyActor ) + if(dirtyActor) { - // We know that BaseObject is a base class of Internal::Actor but need to instruct the compiler to do the cast - Dali::Actor actor = Dali::Actor( reinterpret_cast( dirtyActor ) ); - - // Only negotiate actors that are on stage - if( actor.OnStage() ) + // Only negotiate actors that are on the scene + if(dirtyActor->OnScene()) { - Dali::Actor parent = actor.GetParent(); - QueueActor( actor, *mRelayoutStack, ( parent ) ? Vector2( parent.GetTargetSize() ) : mStageSize ); + Internal::Actor* parent = dirtyActor->GetParent(); + QueueActor(dirtyActor, *mRelayoutStack, (parent) ? Vector2(parent->GetTargetSize()) : dirtyActor->GetScene().GetSize()); } } } @@ -461,36 +434,25 @@ void RelayoutController::Relayout() mDirtyLayoutSubTrees.Clear(); // 2. Iterate through the stack until it's empty. - if( mRelayoutStack->Size() > 0 ) + if(mRelayoutStack->Size() > 0) { PRINT_HIERARCHY; - while( mRelayoutStack->Size() > 0 ) + while(mRelayoutStack->Size() > 0) { Dali::Actor actor; - Vector2 size; - mRelayoutStack->Get( mRelayoutStack->Size() - 1, actor, size ); - Actor& actorImpl = GetImplementation( actor ); + Vector2 size; + mRelayoutStack->Get(mRelayoutStack->Size() - 1, actor, size); + Actor& actorImpl = GetImplementation(actor); mRelayoutStack->PopBack(); - if( actorImpl.RelayoutRequired() ) + if(actorImpl.RelayoutRequired() && actorImpl.OnScene()) { - DALI_LOG_INFO( gLogFilter, Debug::General, "[Internal::RelayoutController::Relayout] Negotiating %p %s %s (%.2f, %.2f)\n", &actorImpl, actor.GetTypeName().c_str(), actor.GetName().c_str(), size.width, size.height ); + DALI_LOG_INFO(gLogFilter, Debug::General, "[Internal::RelayoutController::Relayout] Negotiating %p %s %s (%.2f, %.2f)\n", &actorImpl, actor.GetTypeName().c_str(), actor.GetProperty(Dali::Actor::Property::NAME).c_str(), size.width, size.height); // 3. Negotiate the size with the current actor. Pass it an empty container which the actor // has to fill with all the actors it has not done any size negotiation for. - - // Force the actor in the relayout container to do a size negotiation - if(actorImpl.GetResizePolicy(Dimension::WIDTH) == ResizePolicy::USE_ASSIGNED_SIZE) - { - actorImpl.SetLayoutNegotiated(false, Dimension::WIDTH); - } - if(actorImpl.GetResizePolicy(Dimension::HEIGHT) == ResizePolicy::USE_ASSIGNED_SIZE) - { - actorImpl.SetLayoutNegotiated(false, Dimension::HEIGHT); - } - - actorImpl.NegotiateSize( size, *mRelayoutStack ); + actorImpl.NegotiateSize(size, *mRelayoutStack); } } @@ -506,7 +468,7 @@ void RelayoutController::Relayout() // this algorithm needs more optimization as well } -void RelayoutController::SetEnabled( bool enabled ) +void RelayoutController::SetEnabled(bool enabled) { mEnabled = enabled; } @@ -516,21 +478,19 @@ bool RelayoutController::IsPerformingRelayout() const return mPerformingRelayout; } -void RelayoutController::SetProcessingCoreEvents( bool processingEvents ) +void RelayoutController::SetProcessingCoreEvents(bool processingEvents) { mProcessingCoreEvents = processingEvents; } -void RelayoutController::FindAndZero( const RawActorList& list, const Dali::RefObject* object ) +void RelayoutController::FindAndZero(const RawActorList& list, const Dali::RefObject* object) { // Object has been destroyed so clear it from this list - for( RawActorList::Iterator it = list.Begin(), itEnd = list.End(); it != itEnd; ++it ) + for(auto& actor : list) { - BaseObject* actor = *it; - - if( actor && ( actor == object ) ) + if(actor && (actor == object)) { - *it = NULL; // Reset the pointer in the list. We don't want to remove it in case something is iterating over the list. + actor = nullptr; // Reset the pointer in the list. We don't want to remove it in case something is iterating over the list. } } }