[dali_2.0.38] Merge branch 'devel/master' 21/262321/1
authorRichard Huang <r.huang@samsung.com>
Fri, 6 Aug 2021 09:48:38 +0000 (10:48 +0100)
committerRichard Huang <r.huang@samsung.com>
Fri, 6 Aug 2021 09:48:38 +0000 (10:48 +0100)
Change-Id: I233f717c0d85b829f1d57d02181c694fd1b1b7c5

15 files changed:
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-scene-holder-impl.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window-impl.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp
build/tizen/docs-internal/dali-internal.doxy.in
build/tizen/docs/dali.doxy.in
dali-toolkit/devel-api/focus-manager/focus-finder.cpp
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/internal/image-loader/async-image-loader-impl.cpp
dali-toolkit/internal/image-loader/async-image-loader-impl.h
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h
dali-toolkit/internal/visuals/texture-manager-impl.cpp
dali-toolkit/public-api/dali-toolkit-version.cpp
packaging/dali-toolkit.spec

index 0cfdcc0..fb67a4b 100644 (file)
@@ -31,9 +31,9 @@ class TestRenderSurface : public Dali::RenderSurfaceInterface
 {
 public:
 
-  TestRenderSurface( PositionSize positionSize ) {};
+  TestRenderSurface( PositionSize positionSize ) : mPositionSize(positionSize) {};
 
-  PositionSize GetPositionSize() const override { PositionSize size; return size; };
+  PositionSize GetPositionSize() const override { return mPositionSize; };
 
   virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) { dpiHorizontal = dpiVertical = 96; }
 
@@ -45,7 +45,7 @@ public:
 
   bool ReplaceGraphicsSurface() override { return false; };
 
-  void MoveResize( Dali::PositionSize positionSize ) override {};
+  void MoveResize( Dali::PositionSize positionSize ) override { mPositionSize = positionSize; };
 
   void StartRender() override {};
 
@@ -76,6 +76,9 @@ public:
   void SetBackgroundColor( Vector4 color ) {};
 
   Vector4 GetBackgroundColor() { return Color::WHITE; };
+
+private:
+  PositionSize mPositionSize;
 };
 
 namespace Internal
@@ -120,7 +123,7 @@ public:
 
   Dali::RenderSurfaceInterface& GetRenderSurface();
 
-private:
+protected:
 
   TestRenderSurface mRenderSurface;
   Integration::Scene mScene;
index f443251..a61569f 100644 (file)
@@ -29,7 +29,8 @@
 namespace Dali
 {
 
-typedef Dali::Rect<int> PositionSize;
+using PositionSize   = Dali::Rect<int>;
+using WindowPosition = Uint16Pair;
 
 namespace Internal
 {
@@ -43,6 +44,12 @@ public:
   Window( const PositionSize& positionSize );
   virtual ~Window() = default;
   static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent);
+
+  WindowPosition GetPosition() const;
+  PositionSize   GetPositionSize() const;
+
+  void SetPositionSize(PositionSize positionSize);
+
   FocusChangeSignalType mFocusChangeSignal;
   ResizeSignalType      mResizeSignal;
   int                   mRotationAngle;
index 9ab5021..cfdee85 100644 (file)
@@ -57,6 +57,27 @@ Window* Window::New(const PositionSize& positionSize, const std::string& name, c
   return new Window( positionSize );
 }
 
+WindowPosition Window::GetPosition() const
+{
+  PositionSize positionSize = mRenderSurface.GetPositionSize();
+
+  return WindowPosition(positionSize.x, positionSize.y);
+}
+
+PositionSize Window::GetPositionSize() const
+{
+  return mRenderSurface.GetPositionSize();
+}
+
+void Window::SetPositionSize(PositionSize positionSize)
+{
+  mRenderSurface.MoveResize(positionSize);
+
+  Uint16Pair newSize(positionSize.width, positionSize.height);
+  Dali::Window handle(this);
+  mResizeSignal.Emit(handle, newSize);
+}
+
 } // Adaptor
 } // Internal
 
@@ -204,8 +225,7 @@ Window DownCast( BaseHandle handle )
 
 void SetPositionSize(Window window, PositionSize positionSize)
 {
-  Uint16Pair newSize(positionSize.width, positionSize.height);
-  GetImplementation( window ).mResizeSignal.Emit(window,newSize);
+  GetImplementation( window ).SetPositionSize(positionSize);
 }
 
 int GetPhysicalOrientation(Window window)
index e91c2b8..f4655ab 100644 (file)
@@ -1788,7 +1788,34 @@ int UtcDaliToolkitTextlabelAnchorClicked(void)
   application.Render();
 
   // Create a tap event to touch the text label.
-  TestGenerateTap(application, 5.0f, 25.0f);
+  TestGenerateTap(application, 5.0f, 25.0f, 100);
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_CHECK(gAnchorClickedCallBackCalled);
+  DALI_TEST_CHECK(anchorClickedSignal);
+
+  // reset
+  gAnchorClickedCallBackCalled = false;
+  anchorClickedSignal = false;
+  label.SetProperty(TextLabel::Property::TEXT, "");
+  label.SetProperty(TextLabel::Property::ENABLE_MARKUP, false);
+
+  application.SendNotification();
+  application.Render();
+
+  // sets anchor text
+  label.SetProperty(TextLabel::Property::ENABLE_MARKUP, true);
+  label.SetProperty(TextLabel::Property::TEXT, "<a href='https://www.tizen.org'>TIZEN</a>");
+  label.SetProperty(Actor::Property::SIZE, Vector2(100.f, 50.f));
+  label.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+  label.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+
+  application.SendNotification();
+  application.Render();
+
+  // Create a tap event to touch the text label.
+  TestGenerateTap(application, 5.0f, 25.0f, 200);
   application.SendNotification();
   application.Render();
 
@@ -1798,7 +1825,7 @@ int UtcDaliToolkitTextlabelAnchorClicked(void)
 
   gAnchorClickedCallBackNotCalled = true;
   // Tap the outside of anchor, callback should not be called.
-  TestGenerateTap(application, 150.f, 100.f);
+  TestGenerateTap(application, 150.f, 100.f, 300);
   application.SendNotification();
   application.Render();
 
index 5364753..7cf973a 100644 (file)
@@ -2290,14 +2290,11 @@ INCLUDE_FILE_PATTERNS  =
 # recursively expanded use the := operator instead of the = operator.
 # This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
 
-PREDEFINED             = DALI_TOOLKIT_API \
+PREDEFINED             = DALI_CORE_API \
+                         DALI_ADAPTOR_API \
+                         DALI_TOOLKIT_API \
+                         DALI_SCENE_LOADER_API \
                          DALI_INTERNAL \
-                         __attribute__ \
-                         ((visibility \
-                         "(default )))" \
-                         __attribute__ \
-                         ((visibility \
-                         "(hidden )))"
 
 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
 # tag can be used to specify a list of macro names that should be expanded. The
index 8ef9112..27a21bc 100644 (file)
@@ -2272,12 +2272,6 @@ PREDEFINED             = DALI_CORE_API \
                          DALI_TOOLKIT_API \
                          DALI_SCENE_LOADER_API \
                          DALI_INTERNAL \
-                         __attribute__ \
-                         ((visibility \
-                         "(default )))" \
-                         __attribute__ \
-                         ((visibility \
-                         "(hidden )))"
 
 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
 # tag can be used to specify a list of macro names that should be expanded. The
index 952c261..313fee9 100644 (file)
@@ -37,6 +37,8 @@ namespace FocusFinder
 {\r
 namespace\r
 {\r
+static constexpr float FULLY_TRANSPARENT(0.01f); ///< Alpha values must rise above this, before an object is considered to be visible.\r
+\r
 static int MajorAxisDistanceRaw(Dali::Toolkit::Control::KeyboardFocus::Direction direction, Dali::Rect<float> source, Dali::Rect<float> dest)\r
 {\r
   switch(direction)\r
@@ -340,6 +342,14 @@ bool IsBetterCandidate(Toolkit::Control::KeyboardFocus::Direction direction, Rec
                                                                                                MinorAxisDistance(direction, focusedRect, bestCandidateRect)));\r
 }\r
 \r
+bool IsFocusable(Actor& actor)\r
+{\r
+  return (actor.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE) &&\r
+          actor.GetProperty<bool>(Actor::Property::VISIBLE) &&\r
+          actor.GetProperty<bool>(Actor::Property::SENSITIVE) &&\r
+          actor.GetProperty<Vector4>(Actor::Property::WORLD_COLOR).a > FULLY_TRANSPARENT);\r
+}\r
+\r
 Actor FindNextFocus(Actor& actor, Actor& focusedActor, Rect<float>& focusedRect, Rect<float>& bestCandidateRect, Toolkit::Control::KeyboardFocus::Direction direction)\r
 {\r
   Actor nearestActor;\r
@@ -350,7 +360,7 @@ Actor FindNextFocus(Actor& actor, Actor& focusedActor, Rect<float>& focusedRect,
     for(auto i = 0u; i < childCount; ++i)\r
     {\r
       Dali::Actor child = actor.GetChildAt(i);\r
-      if(child && child != focusedActor && child.GetProperty<bool>(Actor::Property::KEYBOARD_FOCUSABLE))\r
+      if(child && child != focusedActor && IsFocusable(child))\r
       {\r
         Rect<float> candidateRect = DevelActor::CalculateScreenExtents(child);\r
 \r
index 263b879..21e13c8 100644 (file)
@@ -266,6 +266,17 @@ void TextLabel::SetProperty(BaseObject* object, Property::Index index, const Pro
       case Toolkit::TextLabel::Property::TEXT:
       {
         impl.mController->SetText(value.Get<std::string>());
+
+        if(impl.mController->HasAnchors())
+        {
+          // Forward input events to controller
+          impl.EnableGestureDetection(static_cast<GestureType::Value>(GestureType::TAP));
+        }
+        else
+        {
+          impl.DisableGestureDetection(static_cast<GestureType::Value>(GestureType::TAP));
+        }
+
         break;
       }
       case Toolkit::TextLabel::Property::FONT_FAMILY:
@@ -318,6 +329,16 @@ void TextLabel::SetProperty(BaseObject* object, Property::Index index, const Pro
       {
         const bool enableMarkup = value.Get<bool>();
         impl.mController->SetMarkupProcessorEnabled(enableMarkup);
+
+        if(impl.mController->HasAnchors())
+        {
+          // Forward input events to controller
+          impl.EnableGestureDetection(static_cast<GestureType::Value>(GestureType::TAP));
+        }
+        else
+        {
+          impl.DisableGestureDetection(static_cast<GestureType::Value>(GestureType::TAP));
+        }
         break;
       }
       case Toolkit::TextLabel::Property::ENABLE_AUTO_SCROLL:
@@ -804,10 +825,6 @@ void TextLabel::OnInitialize()
 
   self.LayoutDirectionChangedSignal().Connect(this, &TextLabel::OnLayoutDirectionChanged);
 
-  // Forward input events to controller
-  EnableGestureDetection(static_cast<GestureType::Value>(GestureType::TAP));
-  GetTapGestureDetector().SetMaximumTapsRequired(1);
-
   Layout::Engine& engine = mController->GetLayoutEngine();
   engine.SetCursorWidth(0u); // Do not layout space for the cursor.
 
@@ -858,9 +875,6 @@ void TextLabel::OnTap(const TapGesture& gesture)
   padding                   = Self().GetProperty<Extents>(Toolkit::Control::Property::PADDING);
   const Vector2& localPoint = gesture.GetLocalPoint();
   mController->AnchorEvent(localPoint.x - padding.start, localPoint.y - padding.top);
-
-  // parents can also listen for tap gesture events
-  Dali::DevelActor::SetNeedGesturePropagation(Self(), true);
 }
 
 void TextLabel::AnchorClicked(const std::string& href)
index ea10924..64639b5 100644 (file)
@@ -21,9 +21,6 @@
 // EXTERNAL INCLUDES
 #include <dali/integration-api/adaptor-framework/adaptor.h>
 
-// INTERNAL INCLUDES
-#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
-
 namespace Dali
 {
 namespace Toolkit
@@ -74,24 +71,24 @@ uint32_t AsyncImageLoader::Load(const VisualUrl&                         url,
     mLoadThread.Start();
     mIsLoadThreadStarted = true;
   }
-  if(url.IsBufferResource())
-  {
-    auto visualFactory = Toolkit::VisualFactory::Get();
-    if(visualFactory)
-    {
-      // Get EncodedImageBuffer from texturemanager
-      // and make new LoadingTask with buffer
-      auto& textureManager = GetImplementation(visualFactory).GetTextureManager();
+  mLoadThread.AddTask(new LoadingTask(++mLoadTaskId, url, dimensions, fittingMode, samplingMode, orientationCorrection, preMultiplyOnLoad));
 
-      const EncodedImageBuffer& encodedBuffer = textureManager.GetEncodedImageBuffer(url.GetUrl());
+  return mLoadTaskId;
+}
 
-      mLoadThread.AddTask(new LoadingTask(++mLoadTaskId, encodedBuffer, dimensions, fittingMode, samplingMode, orientationCorrection, preMultiplyOnLoad));
-    }
-  }
-  else
+uint32_t AsyncImageLoader::LoadEncodedImageBuffer(const EncodedImageBuffer&                encodedImageBuffer,
+                                                  ImageDimensions                          dimensions,
+                                                  FittingMode::Type                        fittingMode,
+                                                  SamplingMode::Type                       samplingMode,
+                                                  bool                                     orientationCorrection,
+                                                  DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad)
+{
+  if(!mIsLoadThreadStarted)
   {
-    mLoadThread.AddTask(new LoadingTask(++mLoadTaskId, url, dimensions, fittingMode, samplingMode, orientationCorrection, preMultiplyOnLoad));
+    mLoadThread.Start();
+    mIsLoadThreadStarted = true;
   }
+  mLoadThread.AddTask(new LoadingTask(++mLoadTaskId, encodedImageBuffer, dimensions, fittingMode, samplingMode, orientationCorrection, preMultiplyOnLoad));
 
   return mLoadTaskId;
 }
index 2227711..39e4690 100644 (file)
@@ -62,6 +62,23 @@ public:
                 DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad);
 
   /**
+   * @brief Starts an image loading task by encoded image buffer.
+   * @param[in] encodedImageBuffer The encoded buffer of the image to load
+   * @param[in] dimensions The width and height to fit the loaded image to
+   * @param[in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter
+   * @param[in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size
+   * @param[in] orientationCorrection Reorient the image to respect any orientation metadata in its header
+   * @param[in] preMultiplyOnLoad ON if the image color should be multiplied by it's alpha. Set to OFF if there is no alpha.
+   * @return The loading task id
+   */
+  uint32_t LoadEncodedImageBuffer(const EncodedImageBuffer&                encodedImageBuffer,
+                                  ImageDimensions                          dimensions,
+                                  FittingMode::Type                        fittingMode,
+                                  SamplingMode::Type                       samplingMode,
+                                  bool                                     orientationCorrection,
+                                  DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad);
+
+  /**
    * @brief Starts an mask applying task.
    * @param[in] pixelBuffer of the to be masked image
    * @param[in] maskPixelBuffer of the mask image
index 304276c..7e0410d 100644 (file)
@@ -136,6 +136,11 @@ bool Controller::IsMarkupProcessorEnabled() const
   return mImpl->mMarkupProcessorEnabled;
 }
 
+bool Controller::HasAnchors() const
+{
+  return (mImpl->mMarkupProcessorEnabled && mImpl->mModel->mLogicalModel->mAnchors.Count() && mImpl->IsShowingRealText());
+}
+
 void Controller::SetAutoScrollEnabled(bool enable)
 {
   DALI_LOG_INFO(gLogFilter, Debug::General, "Controller::SetAutoScrollEnabled[%s] SingleBox[%s]-> [%p]\n", (enable) ? "true" : "false", (mImpl->mLayoutEngine.GetLayout() == Layout::Engine::SINGLE_LINE_BOX) ? "true" : "false", this);
index 73f132b..63a77a4 100644 (file)
@@ -231,6 +231,13 @@ public: // Configure the text controller.
   bool IsMarkupProcessorEnabled() const;
 
   /**
+   * @brief Retrieves whether the current text contains anchors.
+   *
+   * @return @e true if the current text contains anchors. @e false.
+   */
+  bool HasAnchors() const;
+
+  /**
    * @brief Enables/disables the auto text scrolling
    *
    * By default is disabled.
index dbb1230..c6fc0c2 100644 (file)
@@ -1419,8 +1419,16 @@ void TextureManager::AsyncLoadingHelper::Load(TextureId
                                               DevelAsyncImageLoader::PreMultiplyOnLoad preMultiplyOnLoad)
 {
   mLoadingInfoContainer.push_back(AsyncLoadingInfo(textureId));
-  auto id                             = GetImplementation(mLoader).Load(url, desiredSize, fittingMode, samplingMode, orientationCorrection, preMultiplyOnLoad);
-  mLoadingInfoContainer.back().loadId = id;
+  if(DALI_UNLIKELY(url.IsBufferResource()))
+  {
+    auto id                             = GetImplementation(mLoader).LoadEncodedImageBuffer(mTextureManager.GetEncodedImageBuffer(url.GetUrl()), desiredSize, fittingMode, samplingMode, orientationCorrection, preMultiplyOnLoad);
+    mLoadingInfoContainer.back().loadId = id;
+  }
+  else
+  {
+    auto id                             = GetImplementation(mLoader).Load(url, desiredSize, fittingMode, samplingMode, orientationCorrection, preMultiplyOnLoad);
+    mLoadingInfoContainer.back().loadId = id;
+  }
 }
 
 void TextureManager::AsyncLoadingHelper::ApplyMask(TextureId                                textureId,
index b805a2c..d46521e 100644 (file)
@@ -29,7 +29,7 @@ namespace Toolkit
 {
 const unsigned int TOOLKIT_MAJOR_VERSION = 2;
 const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 37;
+const unsigned int TOOLKIT_MICRO_VERSION = 38;
 const char* const  TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 632815e..7fe7263 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali2-toolkit
 Summary:    Dali 3D engine Toolkit
-Version:    2.0.37
+Version:    2.0.38
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT
@@ -100,12 +100,6 @@ Requires:   %{dali2_scene_loader} = %{version}-%{release}
 %description -n %{dali2_scene_loader}-devel
 Development components for dali-scene-loader.
 
-##############################
-# Preparation
-##############################
-%prep
-%setup -q
-
 %define dali_data_rw_dir            %TZ_SYS_SHARE/dali/
 %define dali_data_ro_dir            %TZ_SYS_RO_SHARE/dali/
 
@@ -116,6 +110,16 @@ Development components for dali-scene-loader.
 
 %define dali_xml_file_dir     %TZ_SYS_RO_PACKAGES
 
+##############################
+# Preparation
+##############################
+%prep
+%setup -q
+
+##############################
+# Build
+##############################
+%build
 # PO
 {
 cd %{_builddir}/dali2-toolkit-%{version}/dali-toolkit/po
@@ -126,10 +130,6 @@ do
 done
 } &> /dev/null
 
-##############################
-# Build
-##############################
-%build
 PREFIX="/usr"
 CXXFLAGS+=" -Wall -g -Os -fPIC -fvisibility-inlines-hidden -fdata-sections -ffunction-sections "
 LDFLAGS+=" -Wl,--rpath=$PREFIX/lib -Wl,--as-needed -Wl,--gc-sections -Wl,-Bsymbolic-functions "