Fix a popup position error caused by SetInheritPosition() change
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / popup / popup-impl.cpp
index d12e273..c7dd2e4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
@@ -30,6 +30,7 @@
 #include <dali/public-api/events/touch-data.h>
 #include <dali/public-api/object/type-registry.h>
 #include <dali/devel-api/scripting/scripting.h>
+#include <dali/devel-api/actors/actor-devel.h>
 #include <dali/public-api/size-negotiation/relayout-container.h>
 
 // INTERNAL INCLUDES
@@ -592,6 +593,7 @@ void Popup::SetPopupBackgroundImage( Actor image )
   const bool prevAlter = mAlterAddedChild;
   mAlterAddedChild = false;
   mPopupContainer.Add( mPopupBackgroundImage );
+  DevelActor::LowerToBottom(mPopupBackgroundImage);
   mAlterAddedChild = prevAlter;
 
   if( mTailImage )
@@ -917,7 +919,6 @@ Toolkit::Control Popup::CreateBacking()
 
   // Must always be positioned top-left of stage, regardless of parent.
   backing.SetInheritPosition(false);
-  backing.SetAnchorPoint( AnchorPoint::TOP_LEFT );
 
   // Always the full size of the stage.
   backing.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );
@@ -1574,16 +1575,14 @@ bool Popup::OnDialogTouched( Actor actor, const TouchData& touch )
 
 void Popup::OnStageConnection( int depth )
 {
-  Control::OnStageConnection( depth );
-
   mLayoutDirty = true;
   RelayoutRequest();
+
+  Control::OnStageConnection( depth );
 }
 
 void Popup::OnChildAdd( Actor& child )
 {
-  Control::OnChildAdd( child );
-
   // Re-parent any children added by user to the body layer.
   if( mAlterAddedChild )
   {
@@ -1594,6 +1593,8 @@ void Popup::OnChildAdd( Actor& child )
     mLayoutDirty = true;
     RelayoutRequest();
   }
+
+  Control::OnChildAdd( child );
 }
 
 void Popup::LayoutContext( const Vector2& size )