Merge "Set focus to web engine." into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / builder / tree-node-manipulator.cpp
index 926842a..06ba033 100644 (file)
@@ -291,6 +291,19 @@ void TreeNodeManipulator::SetType( TreeNode::NodeType type)
       }
     }
   }
+  else if( TreeNode::ARRAY == mNode->mType )
+  {
+    if( mNode->mFirstChild != NULL )
+    {
+      TreeNode::NodeType type = mNode->mFirstChild->GetType();
+
+      if( TreeNode::FLOAT == type || TreeNode::INTEGER == type )
+      {
+        // Arrays of numbers should be replaced, not appended to.
+        RemoveChildren();
+      }
+    }
+  }
 }
 
 void TreeNodeManipulator::SetName( const char* name )
@@ -385,7 +398,7 @@ void TreeNodeManipulator::DoWrite(const TreeNode *value, std::ostream& output, i
     {
       bool groupMyChildren = false;
 
-      if( TreeNode::ARRAY == value->GetType() &&
+      if( TreeNode::ARRAY == value->GetType() && value->mFirstChild &&
           ( TreeNode::INTEGER == value->mFirstChild->GetType() ||
             TreeNode::FLOAT   == value->mFirstChild->GetType() ) )
       {
@@ -536,8 +549,7 @@ void TreeNodeManipulator::DoWrite(const TreeNode *value, std::ostream& output, i
   } // switch
 } // DoWrite
 
-
-const TreeNode* FindIt(const std::string& childName, const TreeNode* node)
+const TreeNode* FindIt(std::string_view childName, const TreeNode* node)
 {
   DALI_ASSERT_DEBUG(node);