Control - Trigger the size negotiation when the background is updated. 39/100239/11
authorVictor Cebollada <v.cebollada@samsung.com>
Fri, 25 Nov 2016 10:27:35 +0000 (10:27 +0000)
committerVictor Cebollada <v.cebollada@samsung.com>
Tue, 29 Nov 2016 12:45:17 +0000 (12:45 +0000)
* It may be needed by the new visual to relayout its contents. i.e TextVisual needs it.

Change-Id: I04498ed72b2ef94cccc2b3135adb66f5d2862e2d
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
dali-toolkit/public-api/controls/control-impl.cpp

index 2bc13be..02bbf97 100644 (file)
@@ -584,6 +584,9 @@ void Control::SetBackground( const Property::Map& map )
   {
     RegisterVisual( Toolkit::Control::Property::BACKGROUND, visual );
     visual.SetDepthIndex( DepthIndex::BACKGROUND );
+
+    // Trigger a size negotiation request that may be needed by the new visual to relayout its contents.
+    RelayoutRequest();
   }
 }
 
@@ -602,6 +605,9 @@ void Control::ClearBackground()
 {
    UnregisterVisual( Toolkit::Control::Property::BACKGROUND );
    mImpl->mBackgroundColor = Color::TRANSPARENT;
+
+   // Trigger a size negotiation request that may be needed when unregistering a visual.
+   RelayoutRequest();
 }
 
 void Control::EnableGestureDetection(Gesture::Type type)