[ATSPI] Add CalculateScreenExtents function
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / actor-impl.cpp
index a3504e5..876182f 100644 (file)
@@ -1314,6 +1314,9 @@ void Actor::SetSizeScalePolicy( SizeScalePolicy::Type policy )
   EnsureRelayoutData();
 
   mRelayoutData->sizeSetPolicy = policy;
+
+  // Trigger relayout on this control
+  RelayoutRequest();
 }
 
 SizeScalePolicy::Type Actor::GetSizeScalePolicy() const
@@ -2080,9 +2083,13 @@ Actor::~Actor()
   // Guard to allow handle destruction after Core has been destroyed
   if( EventThreadServices::IsCoreRunning() )
   {
-    DestroyNodeMessage( GetEventThreadServices().GetUpdateManager(), GetNode() );
+    // Root layer will destroy its node in its own destructor
+    if ( !mIsRoot )
+    {
+      DestroyNodeMessage( GetEventThreadServices().GetUpdateManager(), GetNode() );
 
-    GetEventThreadServices().UnregisterObject( this );
+      GetEventThreadServices().UnregisterObject( this );
+    }
   }
 
   // Cleanup optional gesture data
@@ -3465,6 +3472,15 @@ bool Actor::DoAction( BaseObject* object, const std::string& actionName, const P
   return done;
 }
 
+Rect<> Actor::CalculateScreenExtents( ) const
+{
+  auto screenPosition = GetCurrentScreenPosition();
+  Vector3 size = GetCurrentSize() * GetCurrentWorldScale();
+  Vector3 anchorPointOffSet = size * ( mPositionUsesAnchorPoint ? GetCurrentAnchorPoint() : AnchorPoint::TOP_LEFT );
+  Vector2 position = Vector2( screenPosition.x - anchorPointOffSet.x, screenPosition.y - anchorPointOffSet.y );
+  return { position.x, position.y, size.x, size.y };
+}
+
 bool Actor::GetCachedPropertyValue( Property::Index index, Property::Value& value ) const
 {
   bool valueSet = true;