[dali_2.1.1] Merge branch 'devel/master' 45/267445/1
authorDavid Steele <david.steele@samsung.com>
Fri, 3 Dec 2021 13:58:07 +0000 (13:58 +0000)
committerDavid Steele <david.steele@samsung.com>
Fri, 3 Dec 2021 13:58:07 +0000 (13:58 +0000)
Change-Id: I8ecf77a66e77dbfcdfc28088f366f95c839be337

dali-toolkit/devel-api/controls/accessible-impl.cpp
dali-toolkit/devel-api/controls/control-devel.cpp
dali-toolkit/internal/controls/control/control-data-impl.h
dali-toolkit/internal/text/text-controller-relayouter.cpp
dali-toolkit/public-api/dali-toolkit-version.cpp
packaging/dali-toolkit.spec

index 1cf9a26..a962abf 100644 (file)
@@ -536,12 +536,23 @@ std::vector<Dali::Accessibility::Relation> AccessibleImpl::GetRelationSet()
 
   std::vector<Dali::Accessibility::Relation> ret;
 
-  auto& relation = controlImpl.mAccessibilityRelations;
-  for(auto i = 0u; i < relation.size(); ++i)
+  auto& relations = controlImpl.mAccessibilityRelations;
+  for(auto i = 0u; i < relations.size(); ++i)
   {
-    if(relation[i].empty()) continue;
+    auto& relation = relations[i];
 
-    ret.emplace_back(Accessibility::Relation{static_cast<Accessibility::RelationType>(i), relation[i]});
+    if(relation.empty())
+    {
+      continue;
+    }
+
+    // Map every Accessible* to its Address
+    std::vector<Accessibility::Address> targets;
+    std::transform(relation.begin(), relation.end(), std::back_inserter(targets), [](auto* x) {
+      return x->GetAddress();
+    });
+
+    ret.emplace_back(Accessibility::Relation{static_cast<Accessibility::RelationType>(i), std::move(targets)});
   }
 
   return ret;
index dc7a128..ccf624b 100644 (file)
@@ -193,7 +193,7 @@ void AppendAccessibilityRelation(Dali::Actor control, Actor destination, Dali::A
     auto object = controlDataImpl->GetAccessibilityObject(destination);
     if(object)
     {
-      controlDataImpl->mAccessibilityRelations[index].push_back(object->GetAddress());
+      controlDataImpl->mAccessibilityRelations[index].push_back(object);
     }
   }
 }
@@ -215,15 +215,14 @@ void RemoveAccessibilityRelation(Dali::Actor control, Actor destination, Dali::A
       return;
     }
 
-    auto address = object->GetAddress();
-
     auto& targets = controlDataImpl->mAccessibilityRelations[index];
     for(auto i = 0u; i < targets.size(); ++i)
     {
-      if(targets[i].ToString() == address.ToString())
+      if(targets[i] == object)
       {
-        targets[i] = targets.back();
-        targets.erase(targets.end() - 1);
+        std::swap(targets[i], targets.back());
+        targets.pop_back();
+        --i;
       }
     }
   }
@@ -233,8 +232,23 @@ std::vector<std::vector<Accessibility::Address>> GetAccessibilityRelations(Dali:
 {
   if(auto controlDataImpl = GetControlImplementation(control))
   {
-    return controlDataImpl->mAccessibilityRelations;
+    auto& relations = controlDataImpl->mAccessibilityRelations;
+
+    std::vector<std::vector<Accessibility::Address>> result(relations.size());
+
+    // Map every Accessible* to its Address
+    for(std::size_t i = 0; i < relations.size(); ++i)
+    {
+      auto& relation = relations[i];
+
+      std::transform(relation.begin(), relation.end(), std::back_inserter(result[i]), [](auto* x) {
+        return x->GetAddress();
+      });
+    }
+
+    return result;
   }
+
   return {};
 }
 
index 55c49a6..5b2cee5 100644 (file)
@@ -546,7 +546,7 @@ public:
 
   Dali::Accessibility::Role mAccessibilityRole = Dali::Accessibility::Role::UNKNOWN;
 
-  std::vector<std::vector<Accessibility::Address>>                       mAccessibilityRelations;
+  std::vector<std::vector<Accessibility::Accessible*>>                   mAccessibilityRelations;
   std::function<std::unique_ptr<Dali::Accessibility::Accessible>(Actor)> mAccessibilityConstructor;
   std::unique_ptr<Dali::Accessibility::Accessible>                       mAccessibilityObject;
 
index 3013b73..ce40c60 100644 (file)
@@ -79,7 +79,13 @@ Size Controller::Relayouter::CalculateLayoutSizeOnRequiredControllerSize(Control
                                                                         GET_GLYPH_METRICS);
 
   // Set the update info to relayout the whole text.
-  TextUpdateInfo& textUpdateInfo              = impl.mTextUpdateInfo;
+  TextUpdateInfo& textUpdateInfo = impl.mTextUpdateInfo;
+  if((0 == textUpdateInfo.mNumberOfCharactersToAdd) &&
+     (0 == textUpdateInfo.mPreviousNumberOfCharacters) &&
+     ((visualModel->mControlSize.width < Math::MACHINE_EPSILON_1000) || (visualModel->mControlSize.height < Math::MACHINE_EPSILON_1000)))
+  {
+    textUpdateInfo.mNumberOfCharactersToAdd = model->mLogicalModel->mText.Count();
+  }
   textUpdateInfo.mParagraphCharacterIndex     = 0u;
   textUpdateInfo.mRequestedNumberOfCharacters = model->mLogicalModel->mText.Count();
 
@@ -213,10 +219,10 @@ void Controller::Relayouter::FitPointSizeforLayout(Controller& controller, const
   {
     ModelPtr& model = impl.mModel;
 
-    bool  actualellipsis = model->mElideEnabled;
-    float minPointSize   = impl.mTextFitMinSize;
-    float maxPointSize   = impl.mTextFitMaxSize;
-    float pointInterval  = impl.mTextFitStepSize;
+    bool  actualellipsis      = model->mElideEnabled;
+    float minPointSize        = impl.mTextFitMinSize;
+    float maxPointSize        = impl.mTextFitMaxSize;
+    float pointInterval       = impl.mTextFitStepSize;
     float currentFitPointSize = impl.mFontDefaults->mFitPointSize;
 
     model->mElideEnabled = false;
@@ -256,7 +262,7 @@ void Controller::Relayouter::FitPointSizeforLayout(Controller& controller, const
       }
     }
 
-    model->mElideEnabled              = actualellipsis;
+    model->mElideEnabled = actualellipsis;
     if(currentFitPointSize != pointSizeArray[bestSizeIndex])
     {
       impl.mTextFitChanged = true;
index aaeee9a..0f08266 100644 (file)
@@ -29,7 +29,7 @@ namespace Toolkit
 {
 const unsigned int TOOLKIT_MAJOR_VERSION = 2;
 const unsigned int TOOLKIT_MINOR_VERSION = 1;
-const unsigned int TOOLKIT_MICRO_VERSION = 0;
+const unsigned int TOOLKIT_MICRO_VERSION = 1;
 const char* const  TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 14467c7..0de4006 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali2-toolkit
 Summary:    Dali 3D engine Toolkit
-Version:    2.1.0
+Version:    2.1.1
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT