Merge "Extending Style - Adding Strikethrough" into devel/master
authorBowon Ryu <bowon.ryu@samsung.com>
Mon, 10 Jan 2022 10:32:53 +0000 (10:32 +0000)
committerGerrit Code Review <gerrit@review>
Mon, 10 Jan 2022 10:32:53 +0000 (10:32 +0000)
117 files changed:
automated-tests/.clang-format [deleted file]
automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/accessibility-test-utils.cpp
automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.cpp
automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.h
automated-tests/src/dali-toolkit-internal/utc-Dali-Accessibility-Accessible.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Accessibility-Controls-BridgeUp.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Accessibility-Controls.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Accessibility-Text.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Accessibility-Value.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-BidirectionalSupport.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-LogicalModel.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Cursor.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Hyphen-Wrapping.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Shaping.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-TextEditor-internal.cpp [changed mode: 0755->0644]
automated-tests/src/dali-toolkit-internal/utc-Dali-TextureManager.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-VisualModel.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-test-application.cpp
automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp
automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp
dali-toolkit/devel-api/controls/control-accessible.cpp [moved from dali-toolkit/devel-api/controls/accessible-impl.cpp with 74% similarity]
dali-toolkit/devel-api/controls/control-accessible.h [moved from dali-toolkit/devel-api/controls/accessible-impl.h with 65% similarity]
dali-toolkit/devel-api/controls/control-devel.h
dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h
dali-toolkit/devel-api/controls/text-controls/text-field-devel.h
dali-toolkit/devel-api/controls/text-controls/text-label-devel.h
dali-toolkit/devel-api/file.list
dali-toolkit/devel-api/focus-manager/focus-finder.cpp
dali-toolkit/devel-api/focus-manager/focus-finder.h
dali-toolkit/devel-api/utility/npatch-helper.cpp [new file with mode: 0644]
dali-toolkit/devel-api/utility/npatch-helper.h [new file with mode: 0644]
dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp
dali-toolkit/internal/controls/alignment/alignment-impl.cpp
dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp
dali-toolkit/internal/controls/buttons/button-impl.cpp
dali-toolkit/internal/controls/buttons/button-impl.h
dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp
dali-toolkit/internal/controls/buttons/toggle-button-impl.h
dali-toolkit/internal/controls/canvas-view/canvas-view-impl.cpp
dali-toolkit/internal/controls/control/control-data-impl.cpp
dali-toolkit/internal/controls/control/control-data-impl.h
dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp
dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp
dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp
dali-toolkit/internal/controls/image-view/image-view-impl.cpp
dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp
dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp
dali-toolkit/internal/controls/navigation-view/navigation-view-impl.cpp
dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp
dali-toolkit/internal/controls/popup/popup-impl.cpp
dali-toolkit/internal/controls/popup/popup-impl.h
dali-toolkit/internal/controls/progress-bar/progress-bar-impl.cpp
dali-toolkit/internal/controls/progress-bar/progress-bar-impl.h
dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp
dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.h
dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp
dali-toolkit/internal/controls/scrollable/scrollable-impl.h
dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp
dali-toolkit/internal/controls/slider/slider-impl.cpp
dali-toolkit/internal/controls/slider/slider-impl.h
dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp
dali-toolkit/internal/controls/table-view/table-view-impl.cpp
dali-toolkit/internal/controls/text-controls/text-anchor-impl.h
dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp
dali-toolkit/internal/controls/text-controls/text-editor-impl.h
dali-toolkit/internal/controls/text-controls/text-editor-property-handler.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.h
dali-toolkit/internal/controls/text-controls/text-field-property-handler.cpp
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/internal/controls/text-controls/text-label-impl.h
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp
dali-toolkit/internal/controls/text-controls/text-selection-toolbar-impl.cpp
dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp
dali-toolkit/internal/controls/video-view/video-view-impl.cpp
dali-toolkit/internal/controls/web-view/web-view-impl.cpp
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp
dali-toolkit/internal/text/cursor-helper-functions.cpp
dali-toolkit/internal/text/cursor-helper-functions.h
dali-toolkit/internal/text/glyph-metrics-helper.cpp
dali-toolkit/internal/text/glyph-metrics-helper.h
dali-toolkit/internal/text/text-controller-impl-model-updater.cpp
dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/text/text-controller-impl.h
dali-toolkit/internal/text/text-controller-input-font-handler.cpp
dali-toolkit/internal/text/text-controller-relayouter.cpp
dali-toolkit/internal/text/text-controller-text-updater.cpp
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h
dali-toolkit/internal/text/text-view.cpp
dali-toolkit/internal/visuals/animated-image/fixed-image-cache.cpp
dali-toolkit/internal/visuals/animated-image/fixed-image-cache.h
dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.cpp
dali-toolkit/internal/visuals/animated-image/rolling-animated-image-cache.h
dali-toolkit/internal/visuals/animated-image/rolling-image-cache.cpp
dali-toolkit/internal/visuals/animated-image/rolling-image-cache.h
dali-toolkit/internal/visuals/image/image-visual.cpp
dali-toolkit/internal/visuals/image/image-visual.h
dali-toolkit/internal/visuals/npatch-data.cpp
dali-toolkit/internal/visuals/npatch-data.h
dali-toolkit/internal/visuals/npatch/npatch-visual.cpp
dali-toolkit/internal/visuals/npatch/npatch-visual.h
dali-toolkit/internal/visuals/texture-manager-impl.cpp
dali-toolkit/internal/visuals/texture-manager-impl.h
dali-toolkit/internal/visuals/texture-upload-observer.cpp
dali-toolkit/internal/visuals/texture-upload-observer.h
dali-toolkit/internal/visuals/visual-factory-cache.cpp
dali-toolkit/internal/visuals/visual-factory-cache.h
dali-toolkit/internal/visuals/visual-factory-impl.cpp
dali-toolkit/public-api/controls/control-impl.cpp
dali-toolkit/public-api/dali-toolkit-version.cpp
packaging/dali-toolkit.spec

diff --git a/automated-tests/.clang-format b/automated-tests/.clang-format
deleted file mode 100644 (file)
index 297ddc2..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
----
-Language:        Cpp
-DisableFormat: true
-SortIncludes: false
-...
index 2747582..8a7d7f1 100644 (file)
@@ -1,7 +1,8 @@
 #include <automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/accessibility-test-utils.h>
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali/devel-api/common/stage.h>
-#include <dali/devel-api/adaptor-framework/accessibility-impl.h>
+#include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
+#include <dali/devel-api/atspi-interfaces/accessible.h>
 #include "dbus-wrapper.h"
 
 namespace Dali
index 701977d..cc0288c 100755 (executable)
@@ -104,7 +104,8 @@ void CreateTextModel( const std::string& text,
                       bool markupProcessorEnabled,
                       LineWrap::Mode wrapMode,
                       bool ellipsisEnabled,
-                      DevelText::EllipsisPosition::Type ellipsisPosition)
+                      DevelText::EllipsisPosition::Type ellipsisPosition,
+                      float lineSpacing)
 {
   textModel = Model::New(); ///< Pointer to the text's model.
   LogicalModelPtr logicalModel = textModel->mLogicalModel;
@@ -327,6 +328,7 @@ void CreateTextModel( const std::string& text,
   Layout::Engine layoutEngine;
   layoutEngine.SetMetrics( metrics );
   layoutEngine.SetLayout( Layout::Engine::MULTI_LINE_BOX );
+  layoutEngine.SetDefaultLineSpacing(lineSpacing);
 
   // Set the layout parameters.
   textModel->mHorizontalAlignment = Text::HorizontalAlignment::BEGIN;
index 0b9f592..389d72d 100644 (file)
@@ -59,6 +59,7 @@ struct LayoutOptions
  * @param[in] wrapMode Line wrap mode.
  * @param[in] ellipsisEnabled Whether the ellipsis layout option is enabled.
  * @param[in] ellipsisPosition Where is the location the text elide.
+ * @param[in] lineSpacing The height of the line in points.
  */
 void CreateTextModel( const std::string& text,
                       const Size& textArea,
@@ -70,7 +71,8 @@ void CreateTextModel( const std::string& text,
                       bool markupProcessorEnabled,
                       LineWrap::Mode wrapMode,
                       bool ellipsisEnabled,
-                      DevelText::EllipsisPosition::Type ellipsisPosition);
+                      DevelText::EllipsisPosition::Type ellipsisPosition,
+                      float lineSpacing);
 
 /**
  * @brief Configures the text @p controller similarly to the one configured by the text-label.
index 12abee1..643b552 100644 (file)
 
 #include <dali.h>
 #include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
 
 #include <dali/devel-api/adaptor-framework/accessibility.h>
-#include <dali/devel-api/adaptor-framework/accessibility-impl.h>
+#include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
+#include <dali/devel-api/atspi-interfaces/accessible.h>
 
 #include <automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dbus-wrapper.h>
 
@@ -141,3 +143,24 @@ int UtcDaliAccessibilityCheckShowingState(void)
 
   END_TEST;
 }
+
+int utcDaliAccessibilityHidden(void)
+{
+  ToolkitTestApplication application;
+
+  auto  control    = Toolkit::Control::New();
+  auto* accessible = Dali::Accessibility::Accessible::Get(control);
+
+  // Check not hidden
+  DALI_TEST_CHECK(accessible);
+  DALI_TEST_CHECK(!accessible->IsHidden());
+  DALI_TEST_CHECK(!control.GetProperty<bool>(Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN));
+
+  control.SetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN, true);
+
+  // Check hidden
+  DALI_TEST_CHECK(accessible->IsHidden());
+  DALI_TEST_CHECK(control.GetProperty<bool>(Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN));
+
+  END_TEST;
+}
index 047018d..1ed53dc 100644 (file)
@@ -3,8 +3,11 @@
 #include <automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dbus-wrapper.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/devel-api/adaptor-framework/accessibility.h>
-#include <dali/devel-api/adaptor-framework/accessibility-impl.h>
+#include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
 #include <dali/devel-api/adaptor-framework/window-devel.h>
+#include <dali/devel-api/atspi-interfaces/accessible.h>
+#include <dali/devel-api/atspi-interfaces/action.h>
+#include <dali/devel-api/atspi-interfaces/component.h>
 #include <dali-toolkit/devel-api/controls/buttons/toggle-button.h>
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/devel-api/controls/popup/popup.h>
@@ -610,7 +613,7 @@ int UtcDaliAccessibilityParentChildren(void)
     child_1_accessible -> GetIndexInParent();
     DALI_ABORT("Object has parent, test abort");
   }
-  catch (Dali::DaliException &){}
+  catch (const std::domain_error&){}
 
   parent.Add(child_1);
   parent.Add(child_2);
@@ -1074,11 +1077,11 @@ int UtcDaliAccessibilityScrollToChildScrollView(void)
 
   Wait(application);
 
-  auto* accessibleParent = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(scrollView));
+  auto* accessibleParent = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(scrollView));
   DALI_TEST_CHECK(accessibleParent);
-  auto* accessibleA = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(actorA));
+  auto* accessibleA = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(actorA));
   DALI_TEST_CHECK(accessibleA);
-  auto* accessibleB = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(actorB));
+  auto* accessibleB = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(actorB));
   DALI_TEST_CHECK(accessibleB);
 
   accessibleA->GrabHighlight(); // == scrollView.ScrollTo(actorA)
@@ -1129,11 +1132,11 @@ int UtcDaliAccessibilityScrollToChildItemView(void)
 
   Wait(application);
 
-  auto* accessibleParent = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(view));
+  auto* accessibleParent = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(view));
   DALI_TEST_CHECK(accessibleParent);
-  auto* accessibleA = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(view.GetItem(0)));
+  auto* accessibleA = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(view.GetItem(0)));
   DALI_TEST_CHECK(accessibleA);
-  auto* accessibleB = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(view.GetItem(1)));
+  auto* accessibleB = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(view.GetItem(1)));
   DALI_TEST_CHECK(accessibleB);
 
   accessibleA->GrabHighlight(); // == view.ScrollToItem(view.GetItemId(actorA))
@@ -1152,12 +1155,12 @@ int UtcDaliAccessibilityScrollToChildNonScrollable(void)
 
   TextLabel label = TextLabel::New("123");
 
-  auto* accessible = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(label));
+  auto* accessible = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(label));
   DALI_TEST_CHECK(accessible);
 
   DALI_TEST_EQUALS(accessible->IsScrollable(), false, TEST_LOCATION);
   DALI_TEST_EQUALS(accessible->ScrollToChild({}), false, TEST_LOCATION);
-  DALI_TEST_EQUALS(accessible->GetInternalActor(), Dali::Actor{}, TEST_LOCATION);
+  DALI_TEST_EQUALS(accessible->GetInternalActor(), label, TEST_LOCATION);
 
   Dali::Accessibility::TestEnableSC( false );
   END_TEST;
@@ -1194,7 +1197,7 @@ int UtcDaliAccessibilityCheckHighlight(void)
   Wait(application);
 
   // Set highlight to first child (A) to enable movement tracking
-  auto* accessible = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(buttonA));
+  auto* accessible = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(buttonA));
   DALI_TEST_CHECK(accessible);
   accessible->GrabHighlight();
   Wait(application);
@@ -1220,7 +1223,7 @@ int UtcDaliAccessibilityCheckHighlight(void)
   Dali::Accessibility::TestResetMoveOutedCalled();
 
   // Set highlight to second child (B) to enable movement tracking
-  accessible = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(buttonB));
+  accessible = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(buttonB));
   DALI_TEST_CHECK(accessible);
   accessible->GrabHighlight();
   Wait(application);
@@ -1258,7 +1261,7 @@ int UtcDaliAccessibilityCheckHighlight(void)
   Dali::Accessibility::TestResetMoveOutedCalled();
 
   // Disable movement tracking on B by giving highlight to A
-  accessible = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(buttonA));
+  accessible = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(buttonA));
   DALI_TEST_CHECK(accessible);
   accessible->GrabHighlight();
   Wait(application);
index a30078a..e610f2f 100644 (file)
@@ -4,7 +4,13 @@
 
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/devel-api/controls/table-view/table-view.h>
-#include <dali/devel-api/adaptor-framework/accessibility-impl.h>
+#include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
+#include <dali/devel-api/atspi-interfaces/accessible.h>
+#include <dali/devel-api/atspi-interfaces/action.h>
+#include <dali/devel-api/atspi-interfaces/editable-text.h>
+#include <dali/devel-api/atspi-interfaces/hyperlink.h>
+#include <dali/devel-api/atspi-interfaces/hypertext.h>
+#include <dali/devel-api/atspi-interfaces/text.h>
 
 #include <automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dbus-wrapper.h>
 
index eea6fa6..ab7f8bf 100644 (file)
@@ -23,6 +23,8 @@
 #include <dali-toolkit/dali-toolkit.h>
 
 #include <dali/devel-api/adaptor-framework/accessibility.h>
+#include <dali/devel-api/atspi-interfaces/accessible.h>
+#include <dali/devel-api/atspi-interfaces/text.h>
 #include <dali-toolkit/internal/controls/text-controls/text-field-impl.h>
 #include <dali-toolkit/internal/controls/text-controls/text-editor-impl.h>
 
index af4739b..2f8739b 100644 (file)
@@ -24,7 +24,9 @@
 #include <dali-toolkit/dali-toolkit.h>
 
 #include <dali/devel-api/adaptor-framework/accessibility.h>
-#include <dali/devel-api/adaptor-framework/accessibility-impl.h>
+#include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
+#include <dali/devel-api/atspi-interfaces/accessible.h>
+#include <dali/devel-api/atspi-interfaces/value.h>
 
 #include <dali-toolkit/devel-api/controls/scroll-bar/scroll-bar.h>
 
index 84ecd2d..9f1d5da 100644 (file)
@@ -114,7 +114,8 @@ bool SetBidirectionalInfoTest( const SetBidirectionalInfoData& data )
                    false,
                    LineWrap::WORD,
                    false,
-                   Toolkit::DevelText::EllipsisPosition::END );
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
 
   LogicalModelPtr logicalModel = textModel->mLogicalModel;
   VisualModelPtr visualModel = textModel->mVisualModel;
@@ -202,7 +203,8 @@ bool GetMirroredTextTest( const GetMirroredTextData& data )
                    false,
                    LineWrap::WORD,
                    false,
-                   Toolkit::DevelText::EllipsisPosition::END );
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
 
   LogicalModelPtr logicalModel = textModel->mLogicalModel;
   VisualModelPtr visualModel = textModel->mVisualModel;
@@ -281,7 +283,8 @@ bool GetCharactersDirectionTest( const GetCharactersDirectionData& data )
                    data.markupProcessorEnabled,
                    LineWrap::WORD,
                    false,
-                   Toolkit::DevelText::EllipsisPosition::END );
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
 
   LogicalModelPtr logicalModel = textModel->mLogicalModel;
   VisualModelPtr visualModel = textModel->mVisualModel;
index 8184dd7..2887613 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -257,6 +257,57 @@ int UtcDaliDebugRenderingGetVisual2(void)
   END_TEST;
 }
 
+
+int UtcDaliDebugRenderingGetVisual3(void)
+{
+  EnvironmentVariable::SetTestingEnvironmentVariable( true );
+  ToolkitTestApplication application;
+  tet_infoline( "UtcDaliDebugRenderingGetVisual3: Request visual with various parameters" );
+
+  VisualFactory factory = VisualFactory::Get();
+  DALI_TEST_CHECK( factory );
+
+  // Test that image visual is replaced with debug visual
+  Dali::Property::Map map;
+  map[ Toolkit::Visual::Property::TYPE ] = Visual::IMAGE;
+  map[ ImageVisual::Property::URL ] = TEST_IMAGE_FILE_NAME;
+  Visual::Base imageVisual = factory.CreateVisual( map );
+  DALI_TEST_CHECK( imageVisual );
+  TestDebugVisual( application.GetScene(),  imageVisual, Visual::IMAGE, Vector2(64.0f, 64.0f /* Broken Image Size */ ));
+
+  // Test that image visual with null string don't make visual
+  map.Clear();
+  map[ Toolkit::Visual::Property::TYPE ] = Visual::IMAGE;
+  map[ ImageVisual::Property::URL ] = "";
+  Visual::Base emptyVisual = factory.CreateVisual( map );
+  DALI_TEST_CHECK( emptyVisual );
+  TestDebugVisual( application.GetScene(), emptyVisual, Visual::WIREFRAME, Vector2::ZERO);
+
+  tet_infoline( "Check that GetVisualObject returns the actual WireframeVisual" );
+  Toolkit::Internal::Visual::Base& visualImpl = GetImplementation( emptyVisual ).GetVisualObject();
+  DALI_TEST_CHECK( dynamic_cast< Toolkit::Internal::WireframeVisual* >( &visualImpl ) );
+
+  tet_infoline( "Compare the returned emptyVisual with the visual implementation, should be the same" );
+  DALI_TEST_CHECK( emptyVisual.GetObjectPtr() == &visualImpl );
+
+  // Test that image view with empty property map don't make visual even DebugRendering is enabled.
+  map.Clear();
+  ImageView imageView = ImageView::New();
+  imageView.SetProperty(Control::Property::BACKGROUND, map);
+  imageView.SetProperty(ImageView::Property::IMAGE, map);
+
+  application.GetScene().Add(imageView);
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( imageView.GetRendererCount(), 0u, TEST_LOCATION );
+
+  EnvironmentVariable::SetTestingEnvironmentVariable(false);
+  END_TEST;
+}
+
+
 int UtcDaliDebugRenderingGetVisualObject01(void)
 {
   EnvironmentVariable::SetTestingEnvironmentVariable( true );
@@ -281,6 +332,7 @@ int UtcDaliDebugRenderingGetVisualObject01(void)
   tet_infoline( "Compare the returned TextVisual with the visual implementation, should differ" );
   DALI_TEST_CHECK( textVisual.GetObjectPtr() != &visualImpl );
 
+  EnvironmentVariable::SetTestingEnvironmentVariable( false );
   END_TEST;
 }
 
@@ -352,4 +404,4 @@ int UtcDaliDebugRenderingRenderText(void)
   }
 
   END_TEST;
-}
+}
\ No newline at end of file
index a95b707..8b15ad3 100755 (executable)
@@ -121,7 +121,8 @@ bool CreateParagraphTest( const CreateParagraphData& data )
                    false,
                    LineWrap::WORD,
                    false,
-                   Toolkit::DevelText::EllipsisPosition::END );
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
 
   LogicalModelPtr logicalModel = textModel->mLogicalModel;
   VisualModelPtr visualModel = textModel->mVisualModel;
@@ -186,7 +187,8 @@ bool FindParagraphTest( const FindParagraphData& data )
                    false,
                    LineWrap::WORD,
                    false,
-                   Toolkit::DevelText::EllipsisPosition::END );
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
 
   LogicalModelPtr logicalModel = textModel->mLogicalModel;
   VisualModelPtr visualModel = textModel->mVisualModel;
@@ -240,7 +242,8 @@ bool FetchBidirectionalLineInfoTest( const FetchBidirectionalLineInfoData& data
                    false,
                    LineWrap::WORD,
                    false,
-                   Toolkit::DevelText::EllipsisPosition::END );
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
 
   LogicalModelPtr logicalModel = textModel->mLogicalModel;
   VisualModelPtr visualModel = textModel->mVisualModel;
@@ -289,7 +292,8 @@ bool GetLogicalCharacterIndexTest( const GetLogicalCharacterIndexData& data )
                    false,
                    LineWrap::WORD,
                    false,
-                   Toolkit::DevelText::EllipsisPosition::END );
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
 
   LogicalModelPtr logicalModel = textModel->mLogicalModel;
   VisualModelPtr visualModel = textModel->mVisualModel;
@@ -355,7 +359,8 @@ bool GetLogicalCursorIndexTest( const GetLogicalCursorIndexData& data )
                    false,
                    LineWrap::WORD,
                    false,
-                   Toolkit::DevelText::EllipsisPosition::END );
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
 
   LogicalModelPtr logicalModel = textModel->mLogicalModel;
   VisualModelPtr visualModel = textModel->mVisualModel;
index 768e58b..920a826 100755 (executable)
@@ -16,8 +16,8 @@
  */
 
 #include <iostream>
-
 #include <stdlib.h>
+#include <unistd.h>
 
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/internal/text/cursor-helper-functions.h>
@@ -46,6 +46,8 @@ using namespace Text;
 
 namespace
 {
+  const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
+  const unsigned int DEFAULT_FONT_SIZE = 1152u;
 
 struct GetClosestLineData
 {
@@ -92,6 +94,15 @@ struct FindSelectionIndicesData
   CharacterIndex* noTextHitIndex;                 ///< The expected character index when there is no hit.
 };
 
+struct PrimaryCursorHeightData
+{
+  std::string     description;                    ///< Description of the test.
+  std::string     text;                           ///< Input text.
+  unsigned int    numberOfTests;                  ///< The number of tests.
+  CharacterIndex* logicalIndex;                   ///< The logical cursor index for each test.
+  float*          heights;                        ///< The expected primary cursor height for each test.
+};
+
 bool GetClosestLineTest( const GetClosestLineData& data )
 {
   std::cout << "  testing : " << data.description << std::endl;
@@ -114,7 +125,8 @@ bool GetClosestLineTest( const GetClosestLineData& data )
                    false,
                    LineWrap::WORD,
                    false,
-                   Toolkit::DevelText::EllipsisPosition::END );
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
 
   LogicalModelPtr logicalModel = textModel->mLogicalModel;
   VisualModelPtr visualModel = textModel->mVisualModel;
@@ -163,7 +175,8 @@ bool GetClosestCursorIndexTest( const GetClosestCursorIndexData& data )
                    false,
                    LineWrap::WORD,
                    false,
-                   Toolkit::DevelText::EllipsisPosition::END );
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
 
   LogicalModelPtr logicalModel = textModel->mLogicalModel;
   VisualModelPtr visualModel = textModel->mVisualModel;
@@ -216,7 +229,8 @@ bool GetCursorPositionTest( const GetCursorPositionData& data )
                    false,
                    LineWrap::WORD,
                    false,
-                   Toolkit::DevelText::EllipsisPosition::END );
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
 
   LogicalModelPtr logicalModel = textModel->mLogicalModel;
   VisualModelPtr visualModel = textModel->mVisualModel;
@@ -233,6 +247,7 @@ bool GetCursorPositionTest( const GetCursorPositionData& data )
     parameters.logical = data.logicalIndex[index];
 
     GetCursorPosition( parameters,
+                       0.f,// Since this test case is not testing the primary cursor height, the default font line height can be set to 0.f.
                        cursorInfo );
 
     if( floor(cursorInfo.primaryPosition.x) != data.visualX[index] )
@@ -243,7 +258,7 @@ bool GetCursorPositionTest( const GetCursorPositionData& data )
     if( floor(cursorInfo.primaryPosition.y) != data.visualY[index] )
     {
       std::cout << "  test " << index << " failed. Different 'y' cursor position : " << cursorInfo.primaryPosition.y << ", expected : " << data.visualY[index] << std::endl;
-       return false;
+      return false;
     }
   }
 
@@ -272,7 +287,8 @@ bool FindSelectionIndicesTest( const FindSelectionIndicesData& data )
                    false,
                    LineWrap::WORD,
                    false,
-                   Toolkit::DevelText::EllipsisPosition::END );
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
 
   LogicalModelPtr logicalModel = textModel->mLogicalModel;
   VisualModelPtr visualModel = textModel->mVisualModel;
@@ -315,12 +331,102 @@ bool FindSelectionIndicesTest( const FindSelectionIndicesData& data )
   return true;
 }
 
+bool PrimaryCursorHeightTest( const PrimaryCursorHeightData& data )
+{
+  std::cout << "  testing : " << data.description << std::endl;
+
+  // 1) Create the model.
+  ModelPtr textModel;
+  MetricsPtr metrics;
+  Size textArea(400.f, 600.f);
+  Size layoutSize;
+
+  Vector<FontDescriptionRun> fontDescriptionRuns;
+
+  const std::string fontFamily( "DejaVuSans" );
+
+  // Set a known font description
+  FontDescriptionRun fontDescriptionRun1;
+  fontDescriptionRun1.characterRun.characterIndex = 0u;
+  fontDescriptionRun1.characterRun.numberOfCharacters = 13u;
+  fontDescriptionRun1.familyLength = fontFamily.size();
+  fontDescriptionRun1.familyName = new char[fontDescriptionRun1.familyLength];
+  memcpy( fontDescriptionRun1.familyName, fontFamily.c_str(), fontDescriptionRun1.familyLength );
+  fontDescriptionRun1.familyDefined = true;
+  fontDescriptionRun1.weightDefined = false;
+  fontDescriptionRun1.widthDefined = false;
+  fontDescriptionRun1.slantDefined = false;
+  fontDescriptionRun1.sizeDefined = true;
+  fontDescriptionRun1.size = 768u;//Font size = 12.0f (768/64 = 12)
+
+  fontDescriptionRuns.PushBack( fontDescriptionRun1 );
+
+  LayoutOptions options;
+  CreateTextModel( data.text,
+                   textArea,
+                   fontDescriptionRuns,
+                   options,
+                   layoutSize,
+                   textModel,
+                   metrics,
+                   false,
+                   LineWrap::WORD,
+                   false,
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   50.f );
+
+  LogicalModelPtr logicalModel = textModel->mLogicalModel;
+  VisualModelPtr visualModel = textModel->mVisualModel;
+
+  GetCursorPositionParameters parameters;
+  parameters.visualModel = visualModel;
+  parameters.logicalModel = logicalModel;
+  parameters.metrics = metrics;
+  parameters.isMultiline = true;
+
+  for( unsigned int index = 0; index < data.numberOfTests; ++index )
+  {
+    CursorInfo cursorInfo;
+    parameters.logical = data.logicalIndex[index];
+
+    // Load some fonts.
+    TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+    fontClient.SetDpi( 93u, 93u );
+
+    char* pathNamePtr = get_current_dir_name();
+    const std::string pathName( pathNamePtr );
+    free( pathNamePtr );
+
+    FontId fontID = fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/dejavu/DejaVuSans.ttf" );
+
+    Text::FontMetrics fontMetrics;
+    MetricsPtr mMetrics = Metrics::New(fontClient);
+    mMetrics->GetFontMetrics(fontID, fontMetrics);
+    float defaultFontLineHeight = (fontMetrics.ascender - fontMetrics.descender);
+
+    GetCursorPosition( parameters,
+                       defaultFontLineHeight,
+                       cursorInfo );
+
+    if( floor(cursorInfo.primaryCursorHeight) != data.heights[index] )
+    {
+      std::cout << "  test " << index << " failed. Different primaryCursorHeight : " << cursorInfo.primaryCursorHeight << ", expected : " << data.heights[index] << std::endl;
+      return false;
+    }
+  }
+
+  return true;
+}
+
 } // namespace
 
 //////////////////////////////////////////////////////////
 //
 // UtcDaliGetClosestLine
 // UtcDaliGetClosestCursorIndex
+// UtcDaliGetCursorPosition
+// UtcDaliFindSelectionIndices
+// UtcDaliPrimaryCursorHeight
 //
 //////////////////////////////////////////////////////////
 
@@ -805,3 +911,35 @@ int UtcDaliFindSelectionIndices(void)
   tet_result(TET_PASS);
   END_TEST;
 }
+
+int UtcDaliPrimaryCursorHeight(void)
+{
+  tet_infoline(" UtcDaliPrimaryCursorHeight");
+
+  float heights[] = { 19.f };
+  CharacterIndex logicalIndex[] = { 1u };
+
+  struct PrimaryCursorHeightData data[] =
+  {
+    {
+      "Testing primary cursor height when line spacing is used.",
+      "Hello World",
+      1u,
+      logicalIndex,
+      heights,
+    }
+  };
+  const unsigned int numberOfTests = 1u;
+
+  for( unsigned int index = 0; index < numberOfTests; ++index )
+  {
+    ToolkitTestApplication application;
+    if( !PrimaryCursorHeightTest( data[index] ) )
+    {
+      tet_result(TET_FAIL);
+    }
+  }
+
+  tet_result(TET_PASS);
+  END_TEST;
+}
index 402cc40..4f1d0f5 100755 (executable)
@@ -93,7 +93,8 @@ bool LayoutTextTest( const LayoutTextData& data )
                    false,
                    data.wrapMode,
                    false,
-                   Toolkit::DevelText::EllipsisPosition::END );
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
 
   Vector<LineRun>& lines = textModel->mVisualModel->mLines;
 
index 281dbba..b50ab83 100755 (executable)
@@ -112,7 +112,8 @@ bool LayoutTextTest( const LayoutTextData& data )
                    false,
                    LineWrap::WORD,
                    false,
-                   Toolkit::DevelText::EllipsisPosition::END );
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
 
   LogicalModelPtr logicalModel = textModel->mLogicalModel;
   VisualModelPtr visualModel = textModel->mVisualModel;
@@ -370,7 +371,8 @@ bool AlignTest( const AlignData& data )
                    false,
                    LineWrap::WORD,
                    false,
-                   Toolkit::DevelText::EllipsisPosition::END );
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
 
   LogicalModelPtr logicalModel = textModel->mLogicalModel;
   VisualModelPtr visualModel = textModel->mVisualModel;
index 272db31..59a0dfd 100755 (executable)
@@ -144,7 +144,8 @@ bool ShapeInfoTest( const ShapeInfoData& data )
                    data.markupProcessorEnabled,
                    LineWrap::WORD,
                    false,
-                   Toolkit::DevelText::EllipsisPosition::END );
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
 
   LogicalModelPtr logicalModel = textModel->mLogicalModel;
   VisualModelPtr visualModel = textModel->mVisualModel;
old mode 100755 (executable)
new mode 100644 (file)
index 0b18d11..e588998
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
  *
  */
 
-#include <iostream>
 #include <stdlib.h>
+#include <iostream>
 
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
 
-#include <dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h>
 #include <dali-toolkit/internal/controls/text-controls/text-editor-impl.h>
-#include <dali-toolkit/internal/text/text-controller.h>
+#include <dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h>
 #include <dali-toolkit/internal/text/text-controller-impl.h>
+#include <dali-toolkit/internal/text/text-controller.h>
 
 using namespace Dali;
 using namespace Toolkit;
@@ -33,20 +33,20 @@ using namespace Text;
 int UtcDaliTextEditorSelectText(void)
 {
   ToolkitTestApplication application;
-  tet_infoline( "UtcDaliTextEditorSelectText" );
+  tet_infoline("UtcDaliTextEditorSelectText");
 
   // Create a text editor
   TextEditor textEditor = TextEditor::New();
-  textEditor.SetProperty( Actor::Property::SIZE, Vector2( 400.f, 60.f ) );
-  textEditor.SetProperty( TextEditor::Property::TEXT, "Hello World" );
+  textEditor.SetProperty(Actor::Property::SIZE, Vector2(400.f, 60.f));
+  textEditor.SetProperty(TextEditor::Property::TEXT, "Hello World");
 
   // Add the text editor to the stage
-  application.GetScene().Add( textEditor );
+  application.GetScene().Add(textEditor);
 
   application.SendNotification();
   application.Render();
 
-  Toolkit::Internal::TextEditor& textEditorImpl = GetImpl( textEditor );
+  Toolkit::Internal::TextEditor& textEditorImpl = GetImpl(textEditor);
 
   application.SendNotification();
   application.Render();
@@ -58,7 +58,7 @@ int UtcDaliTextEditorSelectText(void)
   application.Render();
 
   std::string selectedText = textEditorImpl.GetSelectedText();
-  DALI_TEST_CHECK( selectedText == "Hello World" );
+  DALI_TEST_CHECK(selectedText == "Hello World");
 
   // Select None
   textEditorImpl.SelectNone();
@@ -67,7 +67,7 @@ int UtcDaliTextEditorSelectText(void)
   application.Render();
 
   selectedText = textEditorImpl.GetSelectedText();
-  DALI_TEST_CHECK( selectedText == "" );
+  DALI_TEST_CHECK(selectedText == "");
 
   END_TEST;
 }
@@ -79,33 +79,33 @@ int UtcDaliTextEditorMarkupUnderline(void)
 
   TextEditor textEditor = TextEditor::New();
 
-  application.GetScene().Add( textEditor );
+  application.GetScene().Add(textEditor);
 
-  textEditor.SetProperty( TextEditor::Property::TEXT, "<u>ABC</u>EF<u>GH</u>" );
-  textEditor.SetProperty( TextEditor ::Property::ENABLE_MARKUP,  true );
+  textEditor.SetProperty(TextEditor::Property::TEXT, "<u>ABC</u>EF<u>GH</u>");
+  textEditor.SetProperty(TextEditor ::Property::ENABLE_MARKUP, true);
 
   application.SendNotification();
   application.Render();
 
   uint32_t expectedNumberOfUnderlinedGlyphs = 5u;
 
-  Toolkit::Internal::TextEditor& textEditorImpl = GetImpl( textEditor );
-  const Text::Length numberOfUnderlineRuns = textEditorImpl.GetTextController()->GetTextModel()->GetNumberOfUnderlineRuns();
+  Toolkit::Internal::TextEditor& textEditorImpl        = GetImpl(textEditor);
+  const Text::Length             numberOfUnderlineRuns = textEditorImpl.GetTextController()->GetTextModel()->GetNumberOfUnderlineRuns();
 
-  DALI_TEST_EQUALS( numberOfUnderlineRuns, expectedNumberOfUnderlinedGlyphs, TEST_LOCATION );
+  DALI_TEST_EQUALS(numberOfUnderlineRuns, expectedNumberOfUnderlinedGlyphs, TEST_LOCATION);
 
   Vector<GlyphRun> underlineRuns;
   underlineRuns.Resize(numberOfUnderlineRuns);
   textEditorImpl.GetTextController()->GetTextModel()->GetUnderlineRuns(underlineRuns.Begin(), 0u, numberOfUnderlineRuns);
 
   //ABC are underlined
-  DALI_TEST_EQUALS( underlineRuns[0u].glyphIndex, 0u, TEST_LOCATION);
-  DALI_TEST_EQUALS( underlineRuns[1u].glyphIndex, 1u, TEST_LOCATION);
-  DALI_TEST_EQUALS( underlineRuns[2u].glyphIndex, 2u, TEST_LOCATION);
+  DALI_TEST_EQUALS(underlineRuns[0u].glyphIndex, 0u, TEST_LOCATION);
+  DALI_TEST_EQUALS(underlineRuns[1u].glyphIndex, 1u, TEST_LOCATION);
+  DALI_TEST_EQUALS(underlineRuns[2u].glyphIndex, 2u, TEST_LOCATION);
 
   //GH are underlined
-  DALI_TEST_EQUALS( underlineRuns[3u].glyphIndex, 5u, TEST_LOCATION);
-  DALI_TEST_EQUALS( underlineRuns[4u].glyphIndex, 6u, TEST_LOCATION);
+  DALI_TEST_EQUALS(underlineRuns[3u].glyphIndex, 5u, TEST_LOCATION);
+  DALI_TEST_EQUALS(underlineRuns[4u].glyphIndex, 6u, TEST_LOCATION);
 
   END_TEST;
 }
@@ -118,27 +118,26 @@ int UtcDaliTextEditorFontPointSizeLargerThanAtlas(void)
   // Create a text editor
   TextEditor textEditor = TextEditor::New();
   //Set size to avoid automatic eliding
-  textEditor.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025));
+  textEditor.SetProperty(Actor::Property::SIZE, Vector2(1025, 1025));
   //Set very large font-size using point-size
-  textEditor.SetProperty( TextEditor::Property::POINT_SIZE, 1000);
+  textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 1000);
   //Specify font-family
-  textEditor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
+  textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
   //Set text to check if appear or not
   textEditor.SetProperty(TextEditor::Property::TEXT, "A");
 
-  application.GetScene().Add( textEditor );
+  application.GetScene().Add(textEditor);
 
   application.SendNotification();
   application.Render();
 
   //Check if Glyph is added to AtlasGlyphManger or not
   int countAtlas = AtlasGlyphManager::Get().GetMetrics().mAtlasMetrics.mAtlasCount;
-  DALI_TEST_EQUALS( countAtlas, 1, TEST_LOCATION );
+  DALI_TEST_EQUALS(countAtlas, 1, TEST_LOCATION);
 
   END_TEST;
 }
 
-
 int UtcDaliTextEditorFontPointSizeLargerThanAtlasPlaceholderCase(void)
 {
   ToolkitTestApplication application;
@@ -146,25 +145,25 @@ int UtcDaliTextEditorFontPointSizeLargerThanAtlasPlaceholderCase(void)
 
   //Set Map of placeholder: text, font-family and point-size
   Property::Map placeholderMapSet;
-  placeholderMapSet["text"] = "A";
+  placeholderMapSet["text"]       = "A";
   placeholderMapSet["fontFamily"] = "DejaVu Sans";
-  placeholderMapSet["pixelSize"] = 1000.0f;
+  placeholderMapSet["pixelSize"]  = 1000.0f;
 
   // Create a text editor
   TextEditor textEditor = TextEditor::New();
   //Set size to avoid automatic eliding
-  textEditor.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025));
+  textEditor.SetProperty(Actor::Property::SIZE, Vector2(1025, 1025));
   //Set placeholder
-  textEditor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet) ;
+  textEditor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
 
-  application.GetScene().Add( textEditor );
+  application.GetScene().Add(textEditor);
 
   application.SendNotification();
   application.Render();
 
   //Check if Glyph is added to AtlasGlyphManger or not
   int countAtlas = AtlasGlyphManager::Get().GetMetrics().mAtlasMetrics.mAtlasCount;
-  DALI_TEST_EQUALS( countAtlas, 1, TEST_LOCATION );
+  DALI_TEST_EQUALS(countAtlas, 1, TEST_LOCATION);
 
   END_TEST;
 }
@@ -175,27 +174,27 @@ int UtcDaliTextEditorBackgroundTag(void)
   tet_infoline("UtcDaliTextEditorBackgroundTag\n");
 
   TextEditor editor = TextEditor::New();
-  DALI_TEST_CHECK( editor );
+  DALI_TEST_CHECK(editor);
 
-  editor.SetProperty( TextEditor ::Property::ENABLE_MARKUP,  true );
-  editor.SetProperty( TextEditor::Property::TEXT, "H<background color='red'>e</background> Worl<background color='yellow'>d</background>" );
-  application.GetScene().Add( editor );
+  editor.SetProperty(TextEditor ::Property::ENABLE_MARKUP, true);
+  editor.SetProperty(TextEditor::Property::TEXT, "H<background color='red'>e</background> Worl<background color='yellow'>d</background>");
+  application.GetScene().Add(editor);
   application.SendNotification();
   application.Render();
 
-  Toolkit::Internal::TextEditor& editorImpl = GetImpl( editor );
-  const ColorIndex* const backgroundColorIndicesBuffer = editorImpl.GetTextController()->GetTextModel()->GetBackgroundColorIndices();
+  Toolkit::Internal::TextEditor& editorImpl                   = GetImpl(editor);
+  const ColorIndex* const        backgroundColorIndicesBuffer = editorImpl.GetTextController()->GetTextModel()->GetBackgroundColorIndices();
 
-  DALI_TEST_CHECK( backgroundColorIndicesBuffer );
+  DALI_TEST_CHECK(backgroundColorIndicesBuffer);
 
   //default color
-  DALI_TEST_EQUALS( backgroundColorIndicesBuffer[0], 0u, TEST_LOCATION);
+  DALI_TEST_EQUALS(backgroundColorIndicesBuffer[0], 0u, TEST_LOCATION);
 
   //red color
-  DALI_TEST_EQUALS( backgroundColorIndicesBuffer[1], 1u, TEST_LOCATION);
+  DALI_TEST_EQUALS(backgroundColorIndicesBuffer[1], 1u, TEST_LOCATION);
 
   //yellow color
-  DALI_TEST_EQUALS( backgroundColorIndicesBuffer[7], 2u, TEST_LOCATION);
+  DALI_TEST_EQUALS(backgroundColorIndicesBuffer[7], 2u, TEST_LOCATION);
 
   END_TEST;
 }
@@ -206,17 +205,17 @@ int UtcDaliTextEditorTextWithSpan(void)
   tet_infoline("UtcDaliTextEditorTextWithSpan\n");
 
   TextEditor editor = TextEditor::New();
-  DALI_TEST_CHECK( editor );
+  DALI_TEST_CHECK(editor);
 
-  editor.SetProperty( TextEditor ::Property::ENABLE_MARKUP,  true );
-  editor.SetProperty( TextEditor::Property::TEXT, "Hello Span" );
-  application.GetScene().Add( editor );
+  editor.SetProperty(TextEditor ::Property::ENABLE_MARKUP, true);
+  editor.SetProperty(TextEditor::Property::TEXT, "Hello Span");
+  application.GetScene().Add(editor);
 
   application.SendNotification();
   application.Render();
 
   Vector3 originalSize = editor.GetNaturalSize();
-  editor.SetProperty( TextEditor::Property::TEXT, "H<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red'>ello</span> Span" );
+  editor.SetProperty(TextEditor::Property::TEXT, "H<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red'>ello</span> Span");
 
   application.SendNotification();
   application.Render();
@@ -225,41 +224,40 @@ int UtcDaliTextEditorTextWithSpan(void)
 
   DALI_TEST_GREATER(spanSize.width, originalSize.width, TEST_LOCATION);
 
-  Toolkit::Internal::TextEditor& editorImpl = GetImpl( editor );
-  const ColorIndex* const colorIndicesBuffer1 = editorImpl.GetTextController()->GetTextModel()->GetColorIndices();
+  Toolkit::Internal::TextEditor& editorImpl          = GetImpl(editor);
+  const ColorIndex* const        colorIndicesBuffer1 = editorImpl.GetTextController()->GetTextModel()->GetColorIndices();
 
-  DALI_TEST_CHECK( colorIndicesBuffer1 );
+  DALI_TEST_CHECK(colorIndicesBuffer1);
 
   //default color
-  DALI_TEST_EQUALS( colorIndicesBuffer1[0], 0u, TEST_LOCATION);
+  DALI_TEST_EQUALS(colorIndicesBuffer1[0], 0u, TEST_LOCATION);
 
   //span color
-  DALI_TEST_EQUALS( colorIndicesBuffer1[1], 1u, TEST_LOCATION);
+  DALI_TEST_EQUALS(colorIndicesBuffer1[1], 1u, TEST_LOCATION);
 
   //default color
-  DALI_TEST_EQUALS( colorIndicesBuffer1[6], 0u, TEST_LOCATION);
-
+  DALI_TEST_EQUALS(colorIndicesBuffer1[6], 0u, TEST_LOCATION);
 
-  editor.SetProperty( TextEditor::Property::TEXT, "<span font-size='45'>H</span>ello <span text-color='red'>S</span>pan" );
+  editor.SetProperty(TextEditor::Property::TEXT, "<span font-size='45'>H</span>ello <span text-color='red'>S</span>pan");
 
   application.SendNotification();
   application.Render();
 
   const ColorIndex* const colorIndicesBuffer2 = editorImpl.GetTextController()->GetTextModel()->GetColorIndices();
 
-  DALI_TEST_CHECK( colorIndicesBuffer2 );
+  DALI_TEST_CHECK(colorIndicesBuffer2);
 
   //default color
-  DALI_TEST_EQUALS( colorIndicesBuffer2[0], 0u, TEST_LOCATION);
+  DALI_TEST_EQUALS(colorIndicesBuffer2[0], 0u, TEST_LOCATION);
 
   //default color
-  DALI_TEST_EQUALS( colorIndicesBuffer2[1], 0u, TEST_LOCATION);
+  DALI_TEST_EQUALS(colorIndicesBuffer2[1], 0u, TEST_LOCATION);
 
   //span color
-  DALI_TEST_EQUALS( colorIndicesBuffer2[6], 1u, TEST_LOCATION);
+  DALI_TEST_EQUALS(colorIndicesBuffer2[6], 1u, TEST_LOCATION);
 
   //default color
-  DALI_TEST_EQUALS( colorIndicesBuffer2[7], 0u, TEST_LOCATION);
+  DALI_TEST_EQUALS(colorIndicesBuffer2[7], 0u, TEST_LOCATION);
 
   END_TEST;
 }
@@ -279,9 +277,9 @@ int UtcDaliTextEditorControlBackgroundColor(void)
   application.SendNotification();
   application.Render();
 
-  Toolkit::Internal::TextEditor& editorImpl = GetImpl(editor);
-  ControllerPtr controller = editorImpl.GetTextController();
-  Controller::Impl& controllerImpl = Controller::Impl::GetImplementation(*controller.Get());
+  Toolkit::Internal::TextEditor& editorImpl     = GetImpl(editor);
+  ControllerPtr                  controller     = editorImpl.GetTextController();
+  Controller::Impl&              controllerImpl = Controller::Impl::GetImplementation(*controller.Get());
 
   // Default color is transparent
   controllerImpl.mEditableControlInterface->GetControlBackgroundColor(backgroundColor);
@@ -298,3 +296,44 @@ int UtcDaliTextEditorControlBackgroundColor(void)
 
   END_TEST;
 }
+
+int UtcDaliTextEditorTextPositionWithMinLineAndBigFont(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliTextEditorTextPositionWithMinLine ");
+
+  TextEditor textEditor = TextEditor::New();
+
+  textEditor.SetProperty(TextEditor::Property::TEXT, "<span font-size='45'>H</span>\ni");
+  textEditor.SetProperty(DevelTextEditor::Property::MIN_LINE_SIZE, 50);
+  textEditor.SetProperty(TextEditor ::Property::ENABLE_MARKUP, true);
+
+  application.GetScene().Add(textEditor);
+
+  application.SendNotification();
+  application.Render();
+
+  Toolkit::Internal::TextEditor& textEditorImpl = GetImpl(textEditor);
+  Text::ViewInterface&           view           = textEditorImpl.GetTextController()->GetView();
+
+  Length numberOfGlyphs = view.GetNumberOfGlyphs();
+
+  DALI_TEST_EQUALS(numberOfGlyphs, 3u, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
+
+  Vector<GlyphInfo> glyphs;
+  glyphs.Resize(numberOfGlyphs);
+
+  Vector<Vector2> positions;
+  positions.Resize(numberOfGlyphs);
+
+  float alignmentOffset = 0u;
+  numberOfGlyphs        = view.GetGlyphs(glyphs.Begin(),
+                                  positions.Begin(),
+                                  alignmentOffset,
+                                  0u,
+                                  numberOfGlyphs);
+
+  DALI_TEST_EQUALS(positions[2].y, 165.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
+
+  END_TEST;
+}
\ No newline at end of file
index 1553f97..d279482 100644 (file)
@@ -76,20 +76,19 @@ public:
   {
   }
 
-  virtual void UploadComplete( bool loadSuccess, int32_t textureId, TextureSet textureSet,
-                               bool useAtlasing, const Vector4& atlasRect, bool preMultiplied ) override
+  virtual void LoadComplete( bool loadSuccess, TextureInformation textureInformation ) override
   {
-    mCompleteType = CompleteType::UPLOAD_COMPLETE;
-    mLoaded = loadSuccess;
-    mObserverCalled = true;
-    mTextureSet = textureSet;
-  }
-
-  virtual void LoadComplete( bool loadSuccess, Devel::PixelBuffer pixelBuffer, const VisualUrl& url, bool preMultiplied ) override
-  {
-    mCompleteType = CompleteType::LOAD_COMPLETE;
+    if(textureInformation.returnType == TextureUploadObserver::ReturnType::TEXTURE)
+    {
+      mCompleteType = CompleteType::UPLOAD_COMPLETE;
+    }
+    else
+    {
+      mCompleteType = CompleteType::LOAD_COMPLETE;
+    }
     mLoaded = loadSuccess;
     mObserverCalled = true;
+    mTextureSet = textureInformation.textureSet;
   }
 
   CompleteType mCompleteType;
index 2453771..a88a85d 100644 (file)
@@ -82,7 +82,8 @@ bool SetGlyphsPerCharacterTest( const SetGlyphsPerCharacterData& data )
                    false,
                    LineWrap::WORD,
                    false,
-                   Toolkit::DevelText::EllipsisPosition::END );
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
 
   LogicalModelPtr logicalModel = textModel->mLogicalModel;
   VisualModelPtr visualModel = textModel->mVisualModel;
@@ -169,7 +170,8 @@ bool SetCharacterToGlyphTest( const SetCharacterToGlyphData& data )
                    false,
                    LineWrap::WORD,
                    false,
-                   Toolkit::DevelText::EllipsisPosition::END );
+                   Toolkit::DevelText::EllipsisPosition::END,
+                   0.f );
 
   LogicalModelPtr logicalModel = textModel->mLogicalModel;
   VisualModelPtr visualModel = textModel->mVisualModel;
index e309bfe..cccb922 100644 (file)
@@ -21,7 +21,8 @@
 // INTERNAL INCLUDES
 #include <dali-test-suite-utils.h>
 #include <dali/devel-api/text-abstraction/font-client.h>
-#include <dali/devel-api/adaptor-framework/accessibility-impl.h>
+#include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
+#include <dali/devel-api/atspi-interfaces/accessible.h>
 #include <dali/integration-api/adaptor-framework/adaptor.h>
 #include <toolkit-adaptor-impl.h>
 #include <toolkit-lifecycle-controller.h>
index e8dd77e..e81bb5f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -1170,6 +1170,35 @@ int UtcDaliImageViewSetImageTypeChangesP(void)
   DALI_TEST_CHECK( value.Get( map ) );   // Value should NOT be empty
   DALI_TEST_CHECK( ! visual );           // Visual should be invalid
 
+  // Set a URL in property map again
+  propertyMap[ImageVisual::Property::URL] = gImage_34_RGBA;
+  imageView.SetProperty( ImageView::Property::IMAGE, propertyMap );
+
+  application.SendNotification();
+  application.Render( 16 );
+
+  value = imageView.GetProperty( imageView.GetPropertyIndex( "image" ) );
+  visual = DevelControl::GetVisual( controlImpl, ImageView::Property::IMAGE );
+
+  DALI_TEST_CHECK( ! value.Get( url ) ); // Value should be empty
+  DALI_TEST_CHECK( value.Get( map ) );   // Value should NOT be empty
+  DALI_TEST_CHECK( visual );             // Visual should be valid
+
+  // Set an empty property map
+  propertyMap.Clear();
+  imageView.SetProperty( ImageView::Property::IMAGE, propertyMap );
+
+  application.SendNotification();
+  application.Render( 16 );
+
+  value = imageView.GetProperty( imageView.GetPropertyIndex( "image" ) );
+  visual = DevelControl::GetVisual( controlImpl, ImageView::Property::IMAGE );
+
+  DALI_TEST_CHECK( ! value.Get( url ) ); // Value should be empty
+  DALI_TEST_CHECK( value.Get( map ) );   // Value should NOT be empty
+  DALI_TEST_CHECK( map.Empty() );        // But PropertyMap should be empty
+  DALI_TEST_CHECK( ! visual );           // Visual should be invalid
+
   END_TEST;
 }
 
@@ -3001,6 +3030,59 @@ int UtcDaliImageViewImageLoadFailure03(void)
   END_TEST;
 }
 
+int UtcDaliImageViewImageLoadFailure04(void)
+{
+  ToolkitTestApplication application;
+
+  ImageView imageView = ImageView::New("invalidUrl.png");
+  imageView.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
+  application.GetScene().Add( imageView );
+  application.SendNotification();
+  application.Render(16);
+
+  // loading started, this waits for the loader thread
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+
+  Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
+  DevelStyleManager::SetBrokenImageUrl(styleManager, DevelStyleManager::BrokenImageType::SMALL, TEST_BROKEN_IMAGE_S);
+  DevelStyleManager::SetBrokenImageUrl(styleManager, DevelStyleManager::BrokenImageType::NORMAL, "invalidBroken.png");
+  DevelStyleManager::SetBrokenImageUrl(styleManager, DevelStyleManager::BrokenImageType::LARGE, TEST_BROKEN_IMAGE_L);
+
+  ImageView imageView2 = ImageView::New("invalidUrl.png");
+  imageView2.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
+  application.GetScene().Add( imageView2 );
+
+  std::string brokenUrl;
+  brokenUrl = DevelStyleManager::GetBrokenImageUrl(styleManager, DevelStyleManager::BrokenImageType::SMALL);
+  DALI_TEST_EQUALS( TEST_BROKEN_IMAGE_S, brokenUrl, TEST_LOCATION);
+
+  brokenUrl = DevelStyleManager::GetBrokenImageUrl(styleManager, DevelStyleManager::BrokenImageType::LARGE);
+  DALI_TEST_EQUALS( TEST_BROKEN_IMAGE_L, brokenUrl, TEST_LOCATION);
+
+  application.SendNotification();
+  application.Render(16);
+
+  // loading started, this waits for the loader thread
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+
+  DevelStyleManager::SetBrokenImageUrl(styleManager, DevelStyleManager::BrokenImageType::NORMAL, "invalidBroken.9.png");
+
+  ImageView imageView3 = ImageView::New("invalidUrl.png");
+  imageView3.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
+  application.GetScene().Add( imageView3 );
+
+  application.SendNotification();
+  application.Render(16);
+
+  // loading started, this waits for the loader thread
+  DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+  END_TEST;
+}
+
+
 namespace
 {
 
@@ -3048,7 +3130,7 @@ void OnResourceReadySignal03( Control control )
   if(gResourceReadySignalCounter == 0)
   {
     // Queue loading
-    // 1. Use cached image, then UploadComplete will be called right after OnResourceReadySignal03.
+    // 1. Use cached image, then LoadComplete will be called right after OnResourceReadySignal03.
     gImageView2[ImageView::Property::IMAGE] = gImage_34_RGBA;
 
     // 2. Load a new image
index 7701e61..2099139 100644 (file)
@@ -107,6 +107,7 @@ const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE                   = "enableGr
 const char* const PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION      = "matchSystemLanguageDirection";
 const char* const PROPERTY_NAME_MAX_LENGTH                           = "maxLength";
 const char* const PROPERTY_NAME_FONT_SIZE_SCALE                      = "fontSizeScale";
+const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE               = "enableFontSizeScale";
 const char* const PROPERTY_NAME_GRAB_HANDLE_COLOR                    = "grabHandleColor";
 const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP             = "enableGrabHandlePopup";
 const char* const PROPERTY_NAME_INPUT_METHOD_SETTINGS                = "inputMethodSettings";
@@ -558,6 +559,7 @@ int UtcDaliTextEditorGetPropertyP(void)
   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_SELECTION ) == TextEditor::Property::ENABLE_SELECTION );
   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER ) == TextEditor::Property::PLACEHOLDER );
   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextEditor::Property::FONT_SIZE_SCALE );
+  DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE ) == DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE );
   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT ) == DevelTextEditor::Property::PLACEHOLDER_TEXT );
   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR ) == DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR );
   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_SHIFT_SELECTION ) == DevelTextEditor::Property::ENABLE_SHIFT_SELECTION );
@@ -639,6 +641,10 @@ int UtcDaliTextEditorSetPropertyP(void)
   DALI_TEST_EQUALS( editor.GetProperty<float>( DevelTextEditor::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
   editor.SetProperty( DevelTextEditor::Property::FONT_SIZE_SCALE, 1.0f );
 
+  editor.SetProperty( DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE, false );
+  DALI_TEST_EQUALS( editor.GetProperty<bool>( DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE ), false, TEST_LOCATION );
+  editor.SetProperty( DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE, true );
+
   // Reset font style.
   fontStyleMapSet.Clear();
   fontStyleMapSet.Insert( "weight", "normal" );
@@ -4923,6 +4929,53 @@ int utcDaliTextEditorSelectionClearedSignal(void)
   END_TEST;
 }
 
+int utcDaliTextEditorSelectionWithSecondaryCursor(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" utcDaliTextEditorSelectionWithSecondaryCursor");
+
+  // Checks if the actor is created.
+
+  TextEditor editor = TextEditor::New();
+  DALI_TEST_CHECK( editor );
+
+  application.GetScene().Add( editor );
+
+  editor.SetProperty( TextEditor::Property::ENABLE_MARKUP, true );
+  editor.SetProperty( TextEditor::Property::TEXT, "اللغة Ø§Ù„عربية\nمرحبا Ø¨Ø§Ù„جميع\nالسلام Ø¹Ù„يكم <span font-size='12' font-family='DejaVu Sans' >Hello world</span>" );
+  editor.SetProperty( TextEditor::Property::POINT_SIZE, 12.f );
+  editor.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 50.f ) );
+  editor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+  editor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+  editor.SetProperty( DevelTextEditor::Property::MIN_LINE_SIZE, 50.f );
+  editor.SetProperty( DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION, false );
+
+  // Avoid a crash when core load gl resources.
+  application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Tap on the text editor
+  TestGenerateTap( application, 3.0f, 25.0f );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  //Select the last Arabic word (RTL) & some the space before the English (LTR) letters.
+  DevelTextEditor::SelectText( editor, 35, 41 );// This will activate the alternative cursor position and thus 'cursorInfo.isSecondaryCursor' will be true.
+
+  application.SendNotification();
+  application.Render();
+
+  std::string selectedText = editor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT ).Get<std::string>();
+  DALI_TEST_EQUALS( "عليكم ", selectedText, TEST_LOCATION );
+
+  END_TEST;
+}
+
 int utcDaliTextEditorSelectionChangedSignal(void)
 {
   ToolkitTestApplication application;
index b4e4c93..0332589 100644 (file)
@@ -109,6 +109,7 @@ const char* const PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION      = "matchSys
 const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP             = "enableGrabHandlePopup";
 const char* const PROPERTY_NAME_BACKGROUND                           = "textBackground";
 const char* const PROPERTY_NAME_FONT_SIZE_SCALE                      = "fontSizeScale";
+const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE               = "enableFontSizeScale";
 const char* const PROPERTY_NAME_GRAB_HANDLE_COLOR                    = "grabHandleColor";
 const char* const PROPERTY_NAME_INPUT_FILTER                         = "inputFilter";
 
@@ -572,6 +573,7 @@ int UtcDaliTextFieldGetPropertyP(void)
   DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER ) == TextField::Property::PLACEHOLDER );
   DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextField::Property::ELLIPSIS );
   DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextField::Property::FONT_SIZE_SCALE );
+  DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE ) == DevelTextField::Property::ENABLE_FONT_SIZE_SCALE );
   DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_SHIFT_SELECTION ) == DevelTextField::Property::ENABLE_SHIFT_SELECTION );
   DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_GRAB_HANDLE ) == DevelTextField::Property::ENABLE_GRAB_HANDLE );
   DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION ) == DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION );
@@ -656,6 +658,10 @@ int UtcDaliTextFieldSetPropertyP(void)
   DALI_TEST_EQUALS( field.GetProperty<float>( DevelTextField::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
   field.SetProperty( DevelTextField::Property::FONT_SIZE_SCALE, 1.0f );
 
+  field.SetProperty( DevelTextField::Property::ENABLE_FONT_SIZE_SCALE, false );
+  DALI_TEST_EQUALS( field.GetProperty<bool>( DevelTextField::Property::ENABLE_FONT_SIZE_SCALE ), false, TEST_LOCATION );
+  field.SetProperty( DevelTextField::Property::ENABLE_FONT_SIZE_SCALE, true );
+
   // Reset font style.
   fontStyleMapSet.Clear();
   fontStyleMapSet.Insert( "weight", "normal" );
@@ -3588,6 +3594,12 @@ int UtcDaliTextFieldSelectWholeText(void)
   application.SendNotification();
   application.Render();
 
+  // Even if resize, selection should remain.
+  textField.SetProperty( Actor::Property::SIZE, Vector2( 150.f, 50.f ) );
+
+  application.SendNotification();
+  application.Render();
+
   // Should be 2 children, the stencil and the layer
   DALI_TEST_EQUALS( 2u, textField.GetChildCount(), TEST_LOCATION );
 
index 5f27aeb..bee836e 100644 (file)
@@ -75,6 +75,7 @@ const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize";
 const char* const PROPERTY_NAME_ELLIPSIS = "ellipsis";
 const char* const PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY = "autoScrollLoopDelay";
 const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
+const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE = "enableFontSizeScale";
 
 const char* const PROPERTY_NAME_ELLIPSIS_POSITION = "ellipsisPosition";
 
@@ -353,6 +354,7 @@ int UtcDaliToolkitTextLabelGetPropertyP(void)
   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextLabel::Property::ELLIPSIS );
   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY ) == TextLabel::Property::AUTO_SCROLL_LOOP_DELAY );
   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextLabel::Property::FONT_SIZE_SCALE );
+  DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE ) == DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE );
   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS_POSITION ) == DevelTextLabel::Property::ELLIPSIS_POSITION );
   DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_STRIKETHROUGH ) == DevelTextLabel::Property::STRIKETHROUGH );
 
@@ -410,6 +412,10 @@ int UtcDaliToolkitTextLabelSetPropertyP(void)
   DALI_TEST_EQUALS( label.GetProperty<float>( DevelTextLabel::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
   label.SetProperty( DevelTextLabel::Property::FONT_SIZE_SCALE, 1.0f );
 
+  label.SetProperty( DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE, false );
+  DALI_TEST_EQUALS( label.GetProperty<bool>( DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE ), false, TEST_LOCATION );
+  label.SetProperty( DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE, true );
+
   // Reset font style.
   fontStyleMapSet.Clear();
   fontStyleMapSet.Insert( "weight", "normal" );
index 387275d..d54a00b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -890,7 +890,7 @@ int UtcDaliVisualGetPropertyMap5(void)
   DALI_TEST_CHECK( value );
   DALI_TEST_CHECK(  value->Get<int>() == WrapMode::MIRRORED_REPEAT);
 
-  value = resultMap.Find( "synchronousLoading",   Property::BOOLEAN );
+  value = resultMap.Find( ImageVisual::Property::SYNCHRONOUS_LOADING, Property::BOOLEAN );
   DALI_TEST_CHECK( value );
   DALI_TEST_CHECK( value->Get<bool>() == true );
 
@@ -16,7 +16,7 @@
  */
 
 // CLASS HEADER
-#include "accessible-impl.h"
+#include "control-accessible.h"
 
 // EXTERNAL INCLUDES
 #ifdef DGETTEXT_ENABLED
@@ -66,8 +66,8 @@ static Dali::Actor CreateHighlightIndicatorActor()
 }
 } // unnamed namespace
 
-AccessibleImpl::AccessibleImpl(Dali::Actor self, Dali::Accessibility::Role role, bool modal)
-: mSelf(self),
+ControlAccessible::ControlAccessible(Dali::Actor self, Dali::Accessibility::Role role, bool modal)
+: ActorAccessible(self),
   mIsModal(modal)
 {
   auto control = Dali::Toolkit::Control::DownCast(Self());
@@ -103,7 +103,7 @@ AccessibleImpl::AccessibleImpl(Dali::Actor self, Dali::Accessibility::Role role,
   });
 }
 
-std::string AccessibleImpl::GetName()
+std::string ControlAccessible::GetName() const
 {
   auto control = Dali::Toolkit::Control::DownCast(Self());
 
@@ -136,12 +136,12 @@ std::string AccessibleImpl::GetName()
   return GetLocaleText(name);
 }
 
-std::string AccessibleImpl::GetNameRaw()
+std::string ControlAccessible::GetNameRaw() const
 {
   return {};
 }
 
-std::string AccessibleImpl::GetDescription()
+std::string ControlAccessible::GetDescription() const
 {
   auto control = Dali::Toolkit::Control::DownCast(Self());
 
@@ -169,56 +169,22 @@ std::string AccessibleImpl::GetDescription()
   return GetLocaleText(description);
 }
 
-std::string AccessibleImpl::GetDescriptionRaw()
+std::string ControlAccessible::GetDescriptionRaw() const
 {
   return {};
 }
 
-Dali::Accessibility::Accessible* AccessibleImpl::GetParent()
-{
-  return Dali::Accessibility::Accessible::Get(Self().GetParent());
-}
-
-size_t AccessibleImpl::GetChildCount()
-{
-  return Self().GetChildCount();
-}
-
-Dali::Accessibility::Accessible* AccessibleImpl::GetChildAtIndex(size_t index)
-{
-  return Dali::Accessibility::Accessible::Get(Self().GetChildAt(static_cast<unsigned int>(index)));
-}
-
-size_t AccessibleImpl::GetIndexInParent()
-{
-  auto self = Self();
-  auto parent = self.GetParent();
-  DALI_ASSERT_ALWAYS(parent && "can't call GetIndexInParent on object without parent");
-
-  auto count = parent.GetChildCount();
-  for(auto i = 0u; i < count; ++i)
-  {
-    auto child = parent.GetChildAt(i);
-    if(child == self)
-    {
-      return i;
-    }
-  }
-  DALI_ASSERT_ALWAYS(false && "object isn't child of it's parent");
-  return static_cast<size_t>(-1);
-}
-
-Dali::Accessibility::Role AccessibleImpl::GetRole()
+Dali::Accessibility::Role ControlAccessible::GetRole() const
 {
   return Self().GetProperty<Dali::Accessibility::Role>(Toolkit::DevelControl::Property::ACCESSIBILITY_ROLE);
 }
 
-std::string AccessibleImpl::GetLocalizedRoleName()
+std::string ControlAccessible::GetLocalizedRoleName() const
 {
   return GetLocaleText(GetRoleName());
 }
 
-bool AccessibleImpl::IsShowing()
+bool ControlAccessible::IsShowing()
 {
   Dali::Actor self = Self();
   if(!self.GetProperty<bool>(Actor::Property::VISIBLE) || self.GetProperty<Vector4>(Actor::Property::WORLD_COLOR).a == 0 || self.GetProperty<bool>(Dali::DevelActor::Property::CULLED))
@@ -227,7 +193,7 @@ bool AccessibleImpl::IsShowing()
   }
 
   auto* child  = this;
-  auto* parent = dynamic_cast<Toolkit::DevelControl::AccessibleImpl*>(child->GetParent());
+  auto* parent = dynamic_cast<Toolkit::DevelControl::ControlAccessible*>(child->GetParent());
   if(!parent)
   {
     return true;
@@ -247,13 +213,13 @@ bool AccessibleImpl::IsShowing()
     {
       return false;
     }
-    parent = dynamic_cast<Toolkit::DevelControl::AccessibleImpl*>(parent->GetParent());
+    parent = dynamic_cast<Toolkit::DevelControl::ControlAccessible*>(parent->GetParent());
   }
 
   return true;
 }
 
-Dali::Accessibility::States AccessibleImpl::CalculateStates()
+Dali::Accessibility::States ControlAccessible::CalculateStates()
 {
   Dali::Actor self = Self();
   Dali::Accessibility::States state;
@@ -283,12 +249,12 @@ Dali::Accessibility::States AccessibleImpl::CalculateStates()
   return state;
 }
 
-Dali::Accessibility::States AccessibleImpl::GetStates()
+Dali::Accessibility::States ControlAccessible::GetStates()
 {
   return CalculateStates();
 }
 
-Dali::Accessibility::Attributes AccessibleImpl::GetAttributes()
+Dali::Accessibility::Attributes ControlAccessible::GetAttributes() const
 {
   std::unordered_map<std::string, std::string> attributeMap;
   auto control = Dali::Toolkit::Control::DownCast(Self());
@@ -316,51 +282,25 @@ Dali::Accessibility::Attributes AccessibleImpl::GetAttributes()
   return attributeMap;
 }
 
-Dali::Accessibility::ComponentLayer AccessibleImpl::GetLayer()
-{
-  return Dali::Accessibility::ComponentLayer::WINDOW;
-}
-
-Dali::Rect<> AccessibleImpl::GetExtents(Dali::Accessibility::CoordinateType type)
+bool ControlAccessible::IsHidden() const
 {
-  Dali::Actor self = Self();
-
-  Vector2 screenPosition = self.GetProperty(Dali::DevelActor::Property::SCREEN_POSITION).Get<Vector2>();
-  auto size = self.GetCurrentProperty<Vector3>(Actor::Property::SIZE) * self.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE);
-  bool positionUsesAnchorPoint = self.GetProperty(Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT).Get<bool>();
-  Vector3 anchorPointOffSet = size * (positionUsesAnchorPoint ? self.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT) : AnchorPoint::TOP_LEFT);
-  Vector2 position = Vector2((screenPosition.x - anchorPointOffSet.x), (screenPosition.y - anchorPointOffSet.y));
+  auto control = Dali::Toolkit::Control::DownCast(Self());
 
-  if(type == Dali::Accessibility::CoordinateType::WINDOW)
-  {
-    return {position.x, position.y, size.x, size.y};
-  }
-  else // Dali::Accessibility::CoordinateType::SCREEN
-  {
-    auto window = Dali::DevelWindow::Get(self);
-    auto windowPosition = window.GetPosition();
-    return {position.x + windowPosition.GetX(), position.y + windowPosition.GetY(), size.x, size.y};
-  }
-}
+  Internal::Control&       internalControl = Toolkit::Internal::GetImplementation(control);
+  Internal::Control::Impl& controlImpl     = Internal::Control::Impl::Get(internalControl);
 
-int16_t AccessibleImpl::GetMdiZOrder()
-{
-  return 0;
-}
-double AccessibleImpl::GetAlpha()
-{
-  return 0;
+  return controlImpl.mAccessibilityHidden;
 }
 
-bool AccessibleImpl::GrabFocus()
+bool ControlAccessible::GrabFocus()
 {
   return Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor(Self());
 }
 
-void AccessibleImpl::ScrollToSelf()
+void ControlAccessible::ScrollToSelf()
 {
   auto* child = this;
-  auto* parent = dynamic_cast<Toolkit::DevelControl::AccessibleImpl*>(child->GetParent());
+  auto* parent = dynamic_cast<Toolkit::DevelControl::ControlAccessible*>(child->GetParent());
 
   while (parent)
   {
@@ -369,11 +309,11 @@ void AccessibleImpl::ScrollToSelf()
       parent->ScrollToChild(child->Self());
     }
 
-    parent = dynamic_cast<Toolkit::DevelControl::AccessibleImpl*>(parent->GetParent());
+    parent = dynamic_cast<Toolkit::DevelControl::ControlAccessible*>(parent->GetParent());
   }
 }
 
-void AccessibleImpl::RegisterPositionPropertyNotification()
+void ControlAccessible::RegisterPositionPropertyNotification()
 {
   auto                     control         = Dali::Toolkit::Control::DownCast(Self());
   Internal::Control&       internalControl = Toolkit::Internal::GetImplementation(control);
@@ -381,7 +321,7 @@ void AccessibleImpl::RegisterPositionPropertyNotification()
   controlImpl.RegisterAccessibilityPositionPropertyNotification();
 }
 
-void AccessibleImpl::UnregisterPositionPropertyNotification()
+void ControlAccessible::UnregisterPositionPropertyNotification()
 {
   auto                     control         = Dali::Toolkit::Control::DownCast(Self());
   Internal::Control&       internalControl = Toolkit::Internal::GetImplementation(control);
@@ -389,7 +329,7 @@ void AccessibleImpl::UnregisterPositionPropertyNotification()
   controlImpl.UnregisterAccessibilityPositionPropertyNotification();
 }
 
-bool AccessibleImpl::GrabHighlight()
+bool ControlAccessible::GrabHighlight()
 {
   Dali::Actor self = Self();
   auto oldHighlightedActor = GetCurrentlyHighlightedActor();
@@ -426,8 +366,8 @@ bool AccessibleImpl::GrabHighlight()
   highlight.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f));
 
   // Need to set resize policy again, to update SIZE property which is set by
-  // AccessibleImpl_NUI. The highlight could move from AccessibleImpl_NUI to
-  // AccessibleImpl. In this case, highlight has incorrect size.
+  // NUIViewAccessible. The highlight could move from NUIViewAccessible to
+  // ControlAccessible. In this case, highlight has incorrect size.
   highlight.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
 
   // Remember the highlight actor, so that when the default is changed with
@@ -442,7 +382,7 @@ bool AccessibleImpl::GrabHighlight()
   return true;
 }
 
-bool AccessibleImpl::ClearHighlight()
+bool ControlAccessible::ClearHighlight()
 {
   Dali::Actor self = Self();
 
@@ -463,7 +403,7 @@ bool AccessibleImpl::ClearHighlight()
   return false;
 }
 
-std::string AccessibleImpl::GetActionName(size_t index)
+std::string ControlAccessible::GetActionName(size_t index) const
 {
   if(index >= GetActionCount())
   {
@@ -476,17 +416,17 @@ std::string AccessibleImpl::GetActionName(size_t index)
   return type.GetActionName(index);
 }
 
-std::string AccessibleImpl::GetLocalizedActionName(size_t index)
+std::string ControlAccessible::GetLocalizedActionName(size_t index) const
 {
   return GetLocaleText(GetActionName(index));
 }
 
-std::string AccessibleImpl::GetActionDescription(size_t index)
+std::string ControlAccessible::GetActionDescription(size_t index) const
 {
   return {};
 }
 
-size_t AccessibleImpl::GetActionCount()
+size_t ControlAccessible::GetActionCount() const
 {
   Dali::TypeInfo type;
   Self().GetTypeInfo(type);
@@ -494,23 +434,23 @@ size_t AccessibleImpl::GetActionCount()
   return type.GetActionCount();
 }
 
-std::string AccessibleImpl::GetActionKeyBinding(size_t index)
+std::string ControlAccessible::GetActionKeyBinding(size_t index) const
 {
   return {};
 }
 
-bool AccessibleImpl::DoAction(size_t index)
+bool ControlAccessible::DoAction(size_t index)
 {
   std::string actionName = GetActionName(index);
   return Self().DoAction(actionName, {});
 }
 
-bool AccessibleImpl::DoAction(const std::string& name)
+bool ControlAccessible::DoAction(const std::string& name)
 {
   return Self().DoAction(name, {});
 }
 
-bool AccessibleImpl::DoGesture(const Dali::Accessibility::GestureInfo& gestureInfo)
+bool ControlAccessible::DoGesture(const Dali::Accessibility::GestureInfo& gestureInfo)
 {
   auto control = Dali::Toolkit::Control::DownCast(Self());
 
@@ -527,7 +467,7 @@ bool AccessibleImpl::DoGesture(const Dali::Accessibility::GestureInfo& gestureIn
   return false;
 }
 
-std::vector<Dali::Accessibility::Relation> AccessibleImpl::GetRelationSet()
+std::vector<Dali::Accessibility::Relation> ControlAccessible::GetRelationSet()
 {
   auto control = Dali::Toolkit::Control::DownCast(Self());
 
@@ -551,32 +491,27 @@ std::vector<Dali::Accessibility::Relation> AccessibleImpl::GetRelationSet()
   return ret;
 }
 
-Dali::Actor AccessibleImpl::GetInternalActor()
-{
-  return Dali::Actor{};
-}
-
-bool AccessibleImpl::ScrollToChild(Actor child)
+bool ControlAccessible::ScrollToChild(Actor child)
 {
   return false;
 }
 
-Dali::Property::Index AccessibleImpl::GetNamePropertyIndex()
+Dali::Property::Index ControlAccessible::GetNamePropertyIndex()
 {
   return Actor::Property::NAME;
 }
 
-Dali::Property::Index AccessibleImpl::GetDescriptionPropertyIndex()
+Dali::Property::Index ControlAccessible::GetDescriptionPropertyIndex()
 {
   return Dali::Property::INVALID_INDEX;
 }
 
-void AccessibleImpl::SetLastPosition(Vector2 position)
+void ControlAccessible::SetLastPosition(Vector2 position)
 {
   mLastPosition = position;
 }
 
-Vector2 AccessibleImpl::GetLastPosition() const
+Vector2 ControlAccessible::GetLastPosition() const
 {
   return mLastPosition;
 }
@@ -1,5 +1,6 @@
-#ifndef DALI_TOOLKIT_ACCESSIBLE_IMPL_H
-#define DALI_TOOLKIT_ACCESSIBLE_IMPL_H
+#ifndef DALI_TOOLKIT_CONTROL_ACCESSIBLE_H
+#define DALI_TOOLKIT_CONTROL_ACCESSIBLE_H
+
 /*
  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
  *
  * limitations under the License.
  *
  */
+
 // EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/accessibility-impl.h>
 #include <dali/devel-api/adaptor-framework/accessibility.h>
+#include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
+#include <dali/devel-api/adaptor-framework/actor-accessible.h>
+#include <dali/devel-api/atspi-interfaces/action.h>
 #include <dali/public-api/object/weak-handle.h>
 
 // INTERNAL INCLUDES
@@ -41,29 +45,15 @@ namespace Dali::Toolkit::DevelControl {
  * @see Dali::Accessibility::Text
  * @see Dali::Accessibility::EditableText
  */
-struct DALI_TOOLKIT_API AccessibleImpl : public virtual Dali::Accessibility::Accessible,
-                                         public virtual Dali::Accessibility::Component,
-                                         public virtual Dali::Accessibility::Collection,
-                                         public virtual Dali::Accessibility::Action
+struct DALI_TOOLKIT_API ControlAccessible : public Dali::Accessibility::ActorAccessible,
+                                            public virtual Dali::Accessibility::Action
 {
 protected:
   Vector2                       mLastPosition{0.0f, 0.0f};
-  Dali::WeakHandle<Dali::Actor> mSelf;
   Dali::WeakHandle<Dali::Actor> mCurrentHighlightActor;
   bool mIsModal = false;
   bool mIsRoot = false;
 
-  Dali::Actor Self() const
-  {
-    auto handle = mSelf.GetHandle();
-
-    // Control::Impl holds a std::unique_ptr to the Accessible object,
-    // so that one does not outlive the other.
-    DALI_ASSERT_ALWAYS(handle);
-
-    return handle;
-  }
-
   void ScrollToSelf();
 
   /**
@@ -83,57 +73,37 @@ protected:
   bool IsShowing();
 
 public:
-  AccessibleImpl(Dali::Actor self, Dali::Accessibility::Role role, bool modal = false);
+  ControlAccessible(Dali::Actor self, Dali::Accessibility::Role role, bool modal = false);
 
   /**
    * @copydoc Dali::Accessibility::Accessible::GetName()
    */
-  std::string GetName() override;
+  std::string GetName() const override;
 
   /**
    * @brief Returns the actor's name in the absence of ACCESSIBILITY_NAME property
    */
-  virtual std::string GetNameRaw();
+  virtual std::string GetNameRaw() const;
 
   /**
    * @copydoc Dali::Accessibility::Accessible::GetDescription()
    */
-  std::string GetDescription() override;
+  std::string GetDescription() const override;
 
   /**
    * @brief Returns the actor's description in the absence of ACCESSIBILITY_DESCRIPTION property
    */
-  virtual std::string GetDescriptionRaw();
-
-  /**
-   * @copydoc Dali::Accessibility::Accessible::GetParent()
-   */
-  Dali::Accessibility::Accessible* GetParent() override;
-
-  /**
-   * @copydoc Dali::Accessibility::Accessible::GetChildCount()
-   */
-  size_t GetChildCount() override;
-
-  /**
-   * @copydoc Dali::Accessibility::Accessible::GetChildAtIndex()
-   */
-  Dali::Accessibility::Accessible* GetChildAtIndex(size_t index) override;
-
-  /**
-   * @copydoc Dali::Accessibility::Accessible::GetIndexInParent()
-   */
-  size_t GetIndexInParent() override;
+  virtual std::string GetDescriptionRaw() const;
 
   /**
    * @copydoc Dali::Accessibility::Accessible::GetRole()
    */
-  Dali::Accessibility::Role GetRole() override;
+  Dali::Accessibility::Role GetRole() const override;
 
   /**
    * @copydoc Dali::Accessibility::Accessible::GetLocalizedRoleName()
    */
-  std::string GetLocalizedRoleName() override;
+  std::string GetLocalizedRoleName() const override;
 
   /**
    * @copydoc Dali::Accessibility::Accessible::GetStates()
@@ -143,22 +113,12 @@ public:
   /**
    * @copydoc Dali::Accessibility::Accessible::GetAttributes()
    */
-  Dali::Accessibility::Attributes GetAttributes() override;
-
-  /**
-   * @copydoc Dali::Accessibility::Component::GetExtents()
-   */
-  Dali::Rect<> GetExtents(Accessibility::CoordinateType type) override;
-
-  /**
-   * @copydoc Dali::Accessibility::Component::GetLayer()
-   */
-  Dali::Accessibility::ComponentLayer GetLayer() override;
+  Dali::Accessibility::Attributes GetAttributes() const override;
 
   /**
-   * @copydoc Dali::Accessibility::Component::GetMdiZOrder()
+   * @copydoc Dali::Accessibility::Accessible::IsHidden()
    */
-  int16_t GetMdiZOrder() override;
+  bool IsHidden() const override;
 
   /**
    * @copydoc Dali::Accessibility::Component::GrabFocus()
@@ -166,11 +126,6 @@ public:
   bool GrabFocus() override;
 
   /**
-   * @copydoc Dali::Accessibility::Component::GetAlpha()
-   */
-  double GetAlpha() override;
-
-  /**
    * @copydoc Dali::Accessibility::Component::GrabHighlight()
    */
   bool GrabHighlight() override;
@@ -183,30 +138,30 @@ public:
   /**
    * @copydoc Dali::Accessibility::Action::GetActionName()
    */
-  std::string GetActionName(size_t index) override;
+  std::string GetActionName(size_t index) const override;
 
   /**
    * @copydoc Dali::Accessibility::Action::GetLocalizedActionName()
    */
-  std::string GetLocalizedActionName(size_t index) override;
+  std::string GetLocalizedActionName(size_t index) const override;
 
   /**
    * @copydoc Dali::Accessibility::Action::GetActionDescription()
    */
-  std::string GetActionDescription(size_t index) override;
+  std::string GetActionDescription(size_t index) const override;
 
   /**
    * @copydoc Dali::Accessibility::Action::GetActionCount()
    */
-  size_t GetActionCount() override;
+  size_t GetActionCount() const override;
 
   /**
    * @copydoc Dali::Accessibility::Action::GetActionKeyBinding()
    */
-  std::string GetActionKeyBinding(size_t index) override;
+  std::string GetActionKeyBinding(size_t index) const override;
 
   /**
-   * @copydoc Dali::Accessibility::Action::DoAction(size_t)
+   * @copydoc Dali::Accessibility::Action::DoAction(std::size_t)
    */
   bool DoAction(size_t index) override;
 
@@ -226,11 +181,6 @@ public:
   std::vector<Dali::Accessibility::Relation> GetRelationSet() override;
 
   /**
-   * @copydoc Dali::Accessibility::Accessible::GetInternalActor()
-   */
-  Dali::Actor GetInternalActor() override;
-
-  /**
    * @copydoc Dali::Accessibility::Accessible::GetStates()
    */
   virtual Dali::Accessibility::States CalculateStates();
@@ -266,4 +216,4 @@ public:
 
 } // namespace Dali::Toolkit::DevelControl
 
-#endif // DALI_TOOLKIT_ACCESSIBLE_IMPL_H
+#endif // DALI_TOOLKIT_CONTROL_ACCESSIBLE_H
index 8877646..33e02f5 100644 (file)
  *
  */
 // EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/accessibility-impl.h>
+#include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
 #include <dali/devel-api/adaptor-framework/input-method-context.h>
 #include <dali/public-api/animation/alpha-function.h>
 #include <dali/public-api/animation/time-period.h>
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/controls/accessible-impl.h>
+#include <dali-toolkit/devel-api/controls/control-accessible.h>
 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
 #include <dali-toolkit/public-api/controls/control.h>
 
@@ -175,11 +175,13 @@ enum
    * @see Dali::Accessibility::Role
    */
   ACCESSIBILITY_ROLE,
+
   /**
    * @brief Mark of able to highlight object.
    * @details Name "accessibilityHighlightable", type Property::BOOLEAN.
    */
   ACCESSIBILITY_HIGHLIGHTABLE,
+
   /**
    * @brief Set of accessibility attributes describing object in accessibility hierarchy
    * @details Name "accessibilityAttributes", type Property::MAP
@@ -192,6 +194,13 @@ enum
    * @note If a control's dispatchKeyEvents is set to false, then it's children will not emit a key event signal either.
    */
   DISPATCH_KEY_EVENTS,
+
+  /**
+   * @brief Marks the object as invisible to AT-SPI clients.
+   * @details Name "accessibilityHidden", type Property::BOOLEAN.
+   * @note The representative Accessible object will not appear in the AT-SPI tree.
+   */
+  ACCESSIBILITY_HIDDEN,
 };
 
 } // namespace Property
@@ -563,7 +572,7 @@ DALI_TOOLKIT_API void NotifyAccessibilityStateChange(Dali::Actor control, Dali::
  * @code
  *   SetAccessibilityConstructor( []( Dali::Actor actor ) {
        return std::unique_ptr< Dali::Accessibility::Accessible >(
-       new AccessibleImpl( actor, Dali::Accessibility::Role::DIALOG, true ) );
+       new ControlAccessible( actor, Dali::Accessibility::Role::DIALOG, true ) );
       } );
   * @endcode
   *
index 94663ae..5a35e2d 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_TEXT_EDITOR_DEVEL_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -178,6 +178,14 @@ enum Type
   FONT_SIZE_SCALE,
 
   /**
+   * @brief True to enable the font size scale or false to disable.
+   * @details Name "enableFontSizeScale", type Property::BOOLEAN.
+   * @note The default value is true.
+   * If false, font size scale is not apppied.
+   */
+  ENABLE_FONT_SIZE_SCALE,
+
+  /**
    * @brief The position for primary cursor.
    * @details Name "primaryCursorPosition", type Property::INTEGER.
    */
index 938bf5c..9bc6fc1 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_TEXT_FIELD_DEVEL_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -163,6 +163,14 @@ enum
   FONT_SIZE_SCALE,
 
   /**
+   * @brief True to enable the font size scale or false to disable.
+   * @details Name "enableFontSizeScale", type Property::BOOLEAN.
+   * @note The default value is true.
+   * If false, font size scale is not apppied.
+   */
+  ENABLE_FONT_SIZE_SCALE,
+
+  /**
    * @brief The position for primary cursor.
    * @details Name "primaryCursorPosition", type Property::INTEGER.
    */
index b64338f..47c41a8 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_TEXT_LABEL_DEVEL_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -156,6 +156,14 @@ enum Type
   FONT_SIZE_SCALE,
 
   /**
+   * @brief True to enable the font size scale or false to disable.
+   * @details Name "enableFontSizeScale", type Property::BOOLEAN.
+   * @note The default value is true.
+   * If false, font size scale is not apppied.
+   */
+  ENABLE_FONT_SIZE_SCALE,
+
+  /**
   * @brief The enumerations used to specify whether to position the ellipsis at the END, START or MIDDLE of the text.
   * @details Name "EllipsisPosition", type [Type](@ref Dali::Toolkit::DevelText::EllipsisPosition::Type) (Property::INTEGER), or Property::STRING. Read/Write
   * @note Default is EllipsisPosition::END.
index 3a40bc9..0a000bc 100755 (executable)
@@ -9,8 +9,8 @@ SET( devel_api_src_files
   ${devel_api_src_dir}/builder/builder.cpp
   ${devel_api_src_dir}/builder/json-parser.cpp
   ${devel_api_src_dir}/builder/tree-node.cpp
-  ${devel_api_src_dir}/controls/accessible-impl.cpp
   ${devel_api_src_dir}/controls/canvas-view/canvas-view.cpp
+  ${devel_api_src_dir}/controls/control-accessible.cpp
   ${devel_api_src_dir}/controls/control-devel.cpp
   ${devel_api_src_dir}/controls/control-wrapper.cpp
   ${devel_api_src_dir}/controls/control-wrapper-impl.cpp
@@ -67,6 +67,7 @@ SET( devel_api_src_files
   ${devel_api_src_dir}/transition-effects/cube-transition-fold-effect.cpp
   ${devel_api_src_dir}/transition-effects/cube-transition-wave-effect.cpp
   ${devel_api_src_dir}/utility/npatch-utilities.cpp
+  ${devel_api_src_dir}/utility/npatch-helper.cpp
   ${devel_api_src_dir}/visual-factory/transition-data.cpp
   ${devel_api_src_dir}/visual-factory/visual-factory.cpp
   ${devel_api_src_dir}/visual-factory/visual-base.cpp
@@ -86,8 +87,8 @@ SET( devel_api_accessibility-manager_header_files
 )
 
 SET( devel_api_controls_header_files
-  ${devel_api_src_dir}/controls/accessible-impl.h
   ${devel_api_src_dir}/controls/canvas-view/canvas-view.h
+  ${devel_api_src_dir}/controls/control-accessible.h
   ${devel_api_src_dir}/controls/control-depth-index-ranges.h
   ${devel_api_src_dir}/controls/control-devel.h
   ${devel_api_src_dir}/controls/control-wrapper.h
@@ -271,6 +272,7 @@ SET( devel_api_drag_and_drop_detector_header_files
 
 SET( devel_api_utility_header_files
   ${devel_api_src_dir}/utility/npatch-utilities.h
+  ${devel_api_src_dir}/utility/npatch-helper.h
 )
 
 SET( SOURCES ${SOURCES}
index ddd0360..c52bf57 100644 (file)
@@ -354,9 +354,9 @@ Actor FindNextFocus(Actor& actor, Actor& focusedActor, Rect<float>& focusedRect,
   {\r
     // Recursively children\r
     const auto childCount = actor.GetChildCount();\r
-    for(auto i = 0u; i < childCount; ++i)\r
+    for(auto i = childCount; i > 0u; --i)\r
     {\r
-      Dali::Actor child = actor.GetChildAt(i);\r
+      Dali::Actor child = actor.GetChildAt(i-1);\r
       if(child && child != focusedActor && IsFocusable(child))\r
       {\r
         Rect<float> candidateRect = DevelActor::CalculateScreenExtents(child);\r
@@ -382,10 +382,10 @@ Actor FindNextFocus(Actor& actor, Actor& focusedActor, Rect<float>& focusedRect,
 \r
 } // unnamed namespace\r
 \r
-Actor GetNearestFocusableActor(Actor focusedActor, Toolkit::Control::KeyboardFocus::Direction direction)\r
+Actor GetNearestFocusableActor(Actor rootActor, Actor focusedActor, Toolkit::Control::KeyboardFocus::Direction direction)\r
 {\r
   Actor nearestActor;\r
-  if(!focusedActor)\r
+  if(!focusedActor || !rootActor)\r
   {\r
     return nearestActor;\r
   }\r
@@ -426,13 +426,7 @@ Actor GetNearestFocusableActor(Actor focusedActor, Toolkit::Control::KeyboardFoc
   ConvertCoordinate(bestCandidateRect);\r
 \r
   ConvertCoordinate(focusedRect);\r
-\r
-  Integration::SceneHolder window = Integration::SceneHolder::Get(focusedActor);\r
-  if(window)\r
-  {\r
-    Actor rootActor = window.GetRootLayer();\r
-    nearestActor    = FindNextFocus(rootActor, focusedActor, focusedRect, bestCandidateRect, direction);\r
-  }\r
+  nearestActor = FindNextFocus(rootActor, focusedActor, focusedRect, bestCandidateRect, direction);\r
   return nearestActor;\r
 }\r
 \r
index 47f313d..69708b3 100644 (file)
@@ -27,13 +27,15 @@ namespace Toolkit
 {\r
 namespace FocusFinder\r
 {\r
+\r
 /**\r
  * Get the nearest focusable actor.\r
+ * @param [in] rootActor The root actor.\r
  * @param [in] focusedActor The current focused actor.\r
  * @param [in] direction The direction.\r
  * @return The nearest focusable actor, or an empty handle if none exists.\r
  */\r
-DALI_TOOLKIT_API Actor GetNearestFocusableActor(Actor focusedActor, Toolkit::Control::KeyboardFocus::Direction direction);\r
+DALI_TOOLKIT_API Actor GetNearestFocusableActor(Actor rootActor, Actor focusedActor, Toolkit::Control::KeyboardFocus::Direction direction);\r
 \r
 } // namespace FocusFinder\r
 \r
diff --git a/dali-toolkit/devel-api/utility/npatch-helper.cpp b/dali-toolkit/devel-api/utility/npatch-helper.cpp
new file mode 100644 (file)
index 0000000..53c6d4d
--- /dev/null
@@ -0,0 +1,286 @@
+/*
+* Copyright (c) 2021 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.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
+
+// CLASS HEADER
+#include <dali-toolkit/devel-api/utility/npatch-helper.h>
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace NPatchHelper
+{
+namespace
+{
+/**
+ * @brief Creates the geometry formed from the vertices and indices
+ *
+ * @param[in]  vertices             The vertices to generate the geometry from
+ * @param[in]  indices              The indices to generate the geometry from
+ * @return The geometry formed from the vertices and indices
+ */
+Geometry GenerateGeometry(const Vector<Vector2>& vertices, const Vector<unsigned short>& indices)
+{
+  Property::Map vertexFormat;
+  vertexFormat["aPosition"] = Property::VECTOR2;
+  VertexBuffer vertexBuffer = VertexBuffer::New(vertexFormat);
+  if(vertices.Size() > 0)
+  {
+    vertexBuffer.SetData(&vertices[0], vertices.Size());
+  }
+
+  // Create the geometry object
+  Geometry geometry = Geometry::New();
+  geometry.AddVertexBuffer(vertexBuffer);
+  if(indices.Size() > 0)
+  {
+    geometry.SetIndexBuffer(&indices[0], indices.Size());
+  }
+
+  return geometry;
+}
+
+/**
+ * @brief Adds the indices to form a quad composed off two triangles where the indices are organised in a grid
+ *
+ * @param[out] indices     The indices to add to
+ * @param[in]  rowIdx      The row index to start the quad
+ * @param[in]  nextRowIdx  The index to the next row
+ */
+void AddQuadIndices(Vector<unsigned short>& indices, unsigned int rowIdx, unsigned int nextRowIdx)
+{
+  indices.PushBack(rowIdx);
+  indices.PushBack(nextRowIdx + 1);
+  indices.PushBack(rowIdx + 1);
+
+  indices.PushBack(rowIdx);
+  indices.PushBack(nextRowIdx);
+  indices.PushBack(nextRowIdx + 1);
+}
+
+/**
+ * @brief Adds the vertices to create for npatch
+ * @param[out] vertices The vertices to add to
+ * @param[in]  x        The x value of vector
+ * @param[in]  y        The y value of vector
+ */
+void AddVertex(Vector<Vector2>& vertices, unsigned int x, unsigned int y)
+{
+  vertices.PushBack(Vector2(x, y));
+}
+
+} // unnamed namespace
+
+Geometry CreateGridGeometry(Uint16Pair gridSize)
+{
+  uint16_t gridWidth  = gridSize.GetWidth();
+  uint16_t gridHeight = gridSize.GetHeight();
+
+  // Create vertices
+  Vector<Vector2> vertices;
+  vertices.Reserve((gridWidth + 1) * (gridHeight + 1));
+
+  for(int y = 0; y < gridHeight + 1; ++y)
+  {
+    for(int x = 0; x < gridWidth + 1; ++x)
+    {
+      AddVertex(vertices, x, y);
+    }
+  }
+
+  // Create indices
+  Vector<unsigned short> indices;
+  indices.Reserve(gridWidth * gridHeight * 6);
+
+  unsigned int rowIdx     = 0;
+  unsigned int nextRowIdx = gridWidth + 1;
+  for(int y = 0; y < gridHeight; ++y, ++nextRowIdx, ++rowIdx)
+  {
+    for(int x = 0; x < gridWidth; ++x, ++nextRowIdx, ++rowIdx)
+    {
+      AddQuadIndices(indices, rowIdx, nextRowIdx);
+    }
+  }
+
+  return GenerateGeometry(vertices, indices);
+}
+
+Geometry CreateBorderGeometry(Uint16Pair gridSize)
+{
+  uint16_t gridWidth  = gridSize.GetWidth();
+  uint16_t gridHeight = gridSize.GetHeight();
+
+  // Create vertices
+  Vector<Vector2> vertices;
+  vertices.Reserve((gridWidth + 1) * (gridHeight + 1));
+
+  //top
+  int y = 0;
+  for(; y < 2; ++y)
+  {
+    for(int x = 0; x < gridWidth + 1; ++x)
+    {
+      AddVertex(vertices, x, y);
+    }
+  }
+
+  for(; y < gridHeight - 1; ++y)
+  {
+    //left
+    AddVertex(vertices, 0, y);
+    AddVertex(vertices, 1, y);
+
+    //right
+    AddVertex(vertices, gridWidth - 1, y);
+    AddVertex(vertices, gridWidth, y);
+  }
+
+  //bottom
+  for(; y < gridHeight + 1; ++y)
+  {
+    for(int x = 0; x < gridWidth + 1; ++x)
+    {
+      AddVertex(vertices, x, y);
+    }
+  }
+
+  // Create indices
+  Vector<unsigned short> indices;
+  indices.Reserve(gridWidth * gridHeight * 6);
+
+  //top
+  unsigned int rowIdx     = 0;
+  unsigned int nextRowIdx = gridWidth + 1;
+  for(int x = 0; x < gridWidth; ++x, ++nextRowIdx, ++rowIdx)
+  {
+    AddQuadIndices(indices, rowIdx, nextRowIdx);
+  }
+
+  if(gridHeight > 2)
+  {
+    rowIdx     = gridWidth + 1;
+    nextRowIdx = (gridWidth + 1) * 2;
+
+    unsigned increment = gridWidth - 1;
+    if(gridHeight > 3)
+    {
+      increment = 2;
+      //second row left
+      AddQuadIndices(indices, rowIdx, nextRowIdx);
+
+      rowIdx     = gridWidth * 2;
+      nextRowIdx = (gridWidth + 1) * 2 + 2;
+      //second row right
+      AddQuadIndices(indices, rowIdx, nextRowIdx);
+
+      //left and right
+      rowIdx     = nextRowIdx - 2;
+      nextRowIdx = rowIdx + 4;
+      for(int y = 2; y < 2 * (gridHeight - 3); ++y, rowIdx += 2, nextRowIdx += 2)
+      {
+        AddQuadIndices(indices, rowIdx, nextRowIdx);
+      }
+    }
+
+    //second row left
+    AddQuadIndices(indices, rowIdx, nextRowIdx);
+
+    rowIdx += increment;
+    nextRowIdx += gridWidth - 1;
+    //second row right
+    AddQuadIndices(indices, rowIdx, nextRowIdx);
+  }
+
+  //bottom
+  rowIdx     = nextRowIdx - gridWidth + 1;
+  nextRowIdx = rowIdx + gridWidth + 1;
+  for(int x = 0; x < gridWidth; ++x, ++nextRowIdx, ++rowIdx)
+  {
+    AddQuadIndices(indices, rowIdx, nextRowIdx);
+  }
+
+  return GenerateGeometry(vertices, indices);
+}
+
+void RegisterStretchProperties(Renderer& renderer, const char* uniformName, const NPatchUtility::StretchRanges& stretchPixels, uint16_t imageExtent)
+{
+  uint16_t     prevEnd     = 0;
+  uint16_t     prevFix     = 0;
+  uint16_t     prevStretch = 0;
+  unsigned int i           = 1;
+  for(NPatchUtility::StretchRanges::ConstIterator it = stretchPixels.Begin(); it != stretchPixels.End(); ++it, ++i)
+  {
+    uint16_t start = it->GetX();
+    uint16_t end   = it->GetY();
+
+    uint16_t fix     = prevFix + start - prevEnd;
+    uint16_t stretch = prevStretch + end - start;
+
+    std::stringstream uniform;
+    uniform << uniformName << "[" << i << "]";
+    renderer.RegisterProperty(uniform.str(), Vector2(fix, stretch));
+
+    prevEnd     = end;
+    prevFix     = fix;
+    prevStretch = stretch;
+  }
+
+  {
+    prevFix += imageExtent - prevEnd;
+    std::stringstream uniform;
+    uniform << uniformName << "[" << i << "]";
+    renderer.RegisterProperty(uniform.str(), Vector2(prevFix, prevStretch));
+  }
+}
+
+void ApplyTextureAndUniforms(Renderer& renderer, const Internal::NPatchData* data)
+{
+  TextureSet        textureSet;
+  textureSet = data->GetTextures();
+
+  if(data->GetStretchPixelsX().Size() == 1 && data->GetStretchPixelsY().Size() == 1)
+  {
+    //special case for 9 patch
+    Uint16Pair stretchX = data->GetStretchPixelsX()[0];
+    Uint16Pair stretchY = data->GetStretchPixelsY()[0];
+
+    uint16_t stretchWidth  = (stretchX.GetY() >= stretchX.GetX()) ? stretchX.GetY() - stretchX.GetX() : 0;
+    uint16_t stretchHeight = (stretchY.GetY() >= stretchY.GetX()) ? stretchY.GetY() - stretchY.GetX() : 0;
+
+    renderer.RegisterProperty("uFixed[0]", Vector2::ZERO);
+    renderer.RegisterProperty("uFixed[1]", Vector2(stretchX.GetX(), stretchY.GetX()));
+    renderer.RegisterProperty("uFixed[2]", Vector2(data->GetCroppedWidth() - stretchWidth, data->GetCroppedHeight() - stretchHeight));
+    renderer.RegisterProperty("uStretchTotal", Vector2(stretchWidth, stretchHeight));
+  }
+  else
+  {
+    renderer.RegisterProperty("uNinePatchFactorsX[0]", Vector2::ZERO);
+    renderer.RegisterProperty("uNinePatchFactorsY[0]", Vector2::ZERO);
+
+    RegisterStretchProperties(renderer, "uNinePatchFactorsX", data->GetStretchPixelsX(), data->GetCroppedWidth());
+    RegisterStretchProperties(renderer, "uNinePatchFactorsY", data->GetStretchPixelsY(), data->GetCroppedHeight());
+  }
+}
+
+} // namespace NPatchHelper
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/dali-toolkit/devel-api/utility/npatch-helper.h b/dali-toolkit/devel-api/utility/npatch-helper.h
new file mode 100644 (file)
index 0000000..7a198fe
--- /dev/null
@@ -0,0 +1,97 @@
+#ifndef DALI_TOOLKIT_NPATCH_HELPER_H
+#define DALI_TOOLKIT_NPATCH_HELPER_H
+
+/*
+ * Copyright (c) 2021 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/math/uint-16-pair.h>
+#include <dali/public-api/rendering/geometry.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/dali-toolkit-common.h>
+#include <dali-toolkit/internal/visuals/npatch-data.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace NPatchHelper
+{
+/**
+ * The list that includes stretch pixel ranges
+ */
+using StretchRanges = Dali::Vector<Uint16Pair>;
+
+/**
+ * @brief Creates a Npatch Geometry object
+ *
+ * @param[in] gridSize The gridSize for creating a geometry
+ * @return The Geometry for NPatch
+ */
+DALI_TOOLKIT_API Geometry CreateGridGeometry(Uint16Pair gridSize);
+
+/**
+ * @brief Creates a geometry with the border only for the grid size to be used by this visuals' shaders
+ * e.g. a 5x4 grid would create a geometry that would look like:
+ *
+ *   ---------------------
+ *   |  /|  /|  /|  /|  /|
+ *   |/  |/  |/  |/  |/  |
+ *   ---------------------
+ *   |  /|           |  /|
+ *   |/  |           |/  |
+ *   -----           -----
+ *   |  /|           |  /|
+ *   |/  |           |/  |
+ *   ---------------------
+ *   |  /|  /|  /|  /|  /|
+ *   |/  |/  |/  |/  |/  |
+ *   ---------------------
+ *
+ * @param[in] gridSize The grid size of the solid geometry to create
+ * @return Returns the created geometry for the grid size
+ */
+DALI_TOOLKIT_API Geometry CreateBorderGeometry(Uint16Pair gridSize);
+
+
+/**
+ * @brief Registers a properties for Stretch Ranges
+ *
+ * @param[in,out] renderer The renderer for broken image
+ * @param[in] uniformName The name of the uniform
+ * @param[in] stretchPixels The stretchable pixels in the cropped image space
+ * @param[in] imageExtent The imageExtent
+ */
+void RegisterStretchProperties(Renderer& renderer, const char* uniformName, const NPatchUtility::StretchRanges& stretchPixels, uint16_t imageExtent);
+
+/**
+ * @brief Apply a texture and uniforms
+ *
+ * @param[in,out] renderer The renderer for broken image
+ * @param[in] data The pointer of npatch-data
+ */
+void ApplyTextureAndUniforms(Renderer& renderer, const Internal::NPatchData* data);
+
+} // namespace NPatchUtility
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_NPATCH_HELPER_H
index 3a20928..6337f59 100644 (file)
@@ -19,8 +19,8 @@
 #include "accessibility-manager-impl.h"
 
 // EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/accessibility-impl.h>
 #include <dali/devel-api/adaptor-framework/accessibility.h>
+#include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/controls/control-devel.h>
index 1c2271c..d9b3b4d 100644 (file)
@@ -189,7 +189,7 @@ void Alignment::OnInitialize()
 {
   DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
     return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+      new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::FILLER));
   });
 }
 
index 55259db..5ed17c8 100644 (file)
@@ -219,7 +219,7 @@ void BloomView::OnInitialize()
 
   DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
     return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::ANIMATION));
+      new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::ANIMATION));
   });
 }
 
index 7ff5875..7fb1ab8 100644 (file)
@@ -1303,7 +1303,7 @@ Padding Button::GetForegroundPadding()
   return mForegroundPadding;
 }
 
-std::string Button::AccessibleImpl::GetNameRaw()
+std::string Button::AccessibleImpl::GetNameRaw() const
 {
   std::string   labelText;
   auto          slf      = Toolkit::Button::DownCast(Self());
@@ -1335,7 +1335,7 @@ Property::Index Button::AccessibleImpl::GetNamePropertyIndex()
 
 Dali::Accessibility::States Button::AccessibleImpl::CalculateStates()
 {
-  auto tmp                                    = DevelControl::AccessibleImpl::CalculateStates();
+  auto tmp                                    = DevelControl::ControlAccessible::CalculateStates();
   tmp[Dali::Accessibility::State::SELECTABLE] = true;
   auto slf                                    = Toolkit::Button::DownCast(Self());
   tmp[Dali::Accessibility::State::ENABLED]    = !slf.GetProperty<bool>(Toolkit::Button::Property::DISABLED);
index ced51fd..3e36873 100644 (file)
@@ -535,12 +535,12 @@ private:
   bool mClickActionPerforming; ///< Used to manage signal emissions during action
 
 protected:
-  struct AccessibleImpl : public DevelControl::AccessibleImpl
+  struct AccessibleImpl : public DevelControl::ControlAccessible
   {
-    using DevelControl::AccessibleImpl::AccessibleImpl;
+    using DevelControl::ControlAccessible::ControlAccessible;
 
     Dali::Accessibility::States CalculateStates() override;
-    std::string                 GetNameRaw() override;
+    std::string                 GetNameRaw() const override;
     Property::Index             GetNamePropertyIndex() override;
   };
 };
index 1697b20..3010e69 100644 (file)
@@ -383,7 +383,7 @@ Dali::Accessibility::States ToggleButton::AccessibleImpl::CalculateStates()
   return states;
 }
 
-std::string ToggleButton::AccessibleImpl::GetDescriptionRaw()
+std::string ToggleButton::AccessibleImpl::GetDescriptionRaw() const
 {
   auto button   = Toolkit::ToggleButton::DownCast(Self());
   auto index    = button.GetProperty<int>(Toolkit::ToggleButton::Property::CURRENT_STATE_INDEX);
index 322285b..6629d40 100644 (file)
@@ -158,7 +158,7 @@ protected:
     using Button::AccessibleImpl::AccessibleImpl;
 
     Dali::Accessibility::States CalculateStates() override;
-    std::string                 GetDescriptionRaw() override;
+    std::string                 GetDescriptionRaw() const override;
     Property::Index             GetDescriptionPropertyIndex() override;
   };
   void OnStateChange(State newState) override;
index e8fefbf..6ec6fc9 100644 (file)
@@ -99,7 +99,7 @@ void CanvasView::OnInitialize()
 
   DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
     return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::IMAGE));
+      new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::IMAGE));
   });
 
   Adaptor::Get().RegisterProcessor(*this, true);
index 4aecc29..e3cea92 100644 (file)
@@ -411,11 +411,11 @@ void SetVisualsOffScene(const RegisteredVisualContainer& container, Actor parent
   }
 }
 
-Dali::Rect<> GetShowingGeometry(Dali::Rect<> rect, Dali::Toolkit::DevelControl::AccessibleImpl* accessibleImpl)
+Dali::Rect<> GetShowingGeometry(Dali::Rect<> rect, Dali::Toolkit::DevelControl::ControlAccessible* accessible)
 {
   Rect<>  parentRect;
   Vector2 currentPosition;
-  auto    parent = dynamic_cast<Toolkit::DevelControl::AccessibleImpl*>(accessibleImpl->GetParent());
+  auto    parent = dynamic_cast<Toolkit::DevelControl::ControlAccessible*>(accessible->GetParent());
 
   while(parent)
   {
@@ -434,7 +434,7 @@ Dali::Rect<> GetShowingGeometry(Dali::Rect<> rect, Dali::Toolkit::DevelControl::
       return rect;
     }
 
-    parent = dynamic_cast<Toolkit::DevelControl::AccessibleImpl*>(parent->GetParent());
+    parent = dynamic_cast<Toolkit::DevelControl::ControlAccessible*>(parent->GetParent());
   }
 
   return rect;
@@ -468,7 +468,8 @@ const PropertyRegistration Control::Impl::PROPERTY_18(typeRegistration, "accessi
 const PropertyRegistration Control::Impl::PROPERTY_19(typeRegistration, "accessibilityRole",              Toolkit::DevelControl::Property::ACCESSIBILITY_ROLE,               Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
 const PropertyRegistration Control::Impl::PROPERTY_20(typeRegistration, "accessibilityHighlightable",     Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE,      Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
 const PropertyRegistration Control::Impl::PROPERTY_21(typeRegistration, "accessibilityAttributes",        Toolkit::DevelControl::Property::ACCESSIBILITY_ATTRIBUTES,         Property::MAP,     &Control::Impl::SetProperty, &Control::Impl::GetProperty);
-const PropertyRegistration Control::Impl::PROPERTY_22(typeRegistration, "dispatchKeyEvents",              Toolkit::DevelControl::Property::DISPATCH_KEY_EVENTS,               Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
+const PropertyRegistration Control::Impl::PROPERTY_22(typeRegistration, "dispatchKeyEvents",              Toolkit::DevelControl::Property::DISPATCH_KEY_EVENTS,              Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
+const PropertyRegistration Control::Impl::PROPERTY_23(typeRegistration, "accessibilityHidden",            Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN,             Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
 
 // clang-format on
 
@@ -513,7 +514,7 @@ Control::Impl::Impl(Control& controlImpl)
     });
 
   mAccessibilityConstructor = [](Dali::Actor actor) -> std::unique_ptr<Dali::Accessibility::Accessible> {
-    return std::unique_ptr<Dali::Accessibility::Accessible>(new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::UNKNOWN));
+    return std::unique_ptr<Dali::Accessibility::Accessible>(new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::UNKNOWN));
   };
 }
 
@@ -551,16 +552,16 @@ const Control::Impl& Control::Impl::Get(const Internal::Control& internalControl
 
 void Control::Impl::CheckHighlightedObjectGeometry()
 {
-  auto accessibleImpl = dynamic_cast<Dali::Toolkit::DevelControl::AccessibleImpl*>(mAccessibilityObject.get());
-  if(!accessibleImpl)
+  auto accessible = dynamic_cast<Dali::Toolkit::DevelControl::ControlAccessible*>(mAccessibilityObject.get());
+  if(!accessible)
   {
-    DALI_LOG_ERROR("accessibleImpl is not a pointer to a DevelControl::AccessibleImpl type");
+    DALI_LOG_ERROR("accessible is not a pointer to a DevelControl::ControlAccessible type");
     return;
   }
 
-  auto lastPosition   = accessibleImpl->GetLastPosition();
-  auto accessibleRect = accessibleImpl->GetExtents(Dali::Accessibility::CoordinateType::WINDOW);
-  auto rect = GetShowingGeometry(accessibleRect, accessibleImpl);
+  auto lastPosition   = accessible->GetLastPosition();
+  auto accessibleRect = accessible->GetExtents(Dali::Accessibility::CoordinateType::WINDOW);
+  auto rect = GetShowingGeometry(accessibleRect, accessible);
 
   switch(mAccessibilityLastScreenRelativeMoveType)
   {
@@ -608,7 +609,7 @@ void Control::Impl::CheckHighlightedObjectGeometry()
     }
   }
 
-  accessibleImpl->SetLastPosition(Vector2(accessibleRect.x, accessibleRect.y));
+  accessible->SetLastPosition(Vector2(accessibleRect.x, accessibleRect.y));
 }
 
 void Control::Impl::RegisterAccessibilityPositionPropertyNotification()
@@ -1369,6 +1370,16 @@ void Control::Impl::SetProperty(BaseObject* object, Property::Index index, const
         }
         break;
       }
+
+      case Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN:
+      {
+        bool hidden;
+        if(value.Get(hidden))
+        {
+          controlImpl.mImpl->mAccessibilityHidden = hidden;
+        }
+        break;
+      }
     }
   }
 }
@@ -1529,11 +1540,18 @@ Property::Value Control::Impl::GetProperty(BaseObject* object, Property::Index i
         value = controlImpl.mImpl->mAccessibilityAttributes;
         break;
       }
+
       case Toolkit::DevelControl::Property::DISPATCH_KEY_EVENTS:
       {
         value = controlImpl.mImpl->mDispatchKeyEvents;
         break;
       }
+
+      case Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN:
+      {
+        value = controlImpl.mImpl->mAccessibilityHidden;
+        break;
+      }
     }
   }
 
index c81be41..a227648 100644 (file)
@@ -71,7 +71,7 @@ typedef Dali::OwnerContainer<RegisteredVisual*> RegisteredVisualContainer;
  */
 class Control::Impl : public ConnectionTracker, public Visual::EventObserver
 {
-  friend class Toolkit::DevelControl::AccessibleImpl;
+  friend class Toolkit::DevelControl::ControlAccessible;
 
 public:
   /**
@@ -546,6 +546,8 @@ public:
   bool mAccessibilityHighlightable    = false;
   bool mAccessibilityHighlightableSet = false;
 
+  bool mAccessibilityHidden = false;
+
   Dali::Accessibility::Role mAccessibilityRole = Dali::Accessibility::Role::UNKNOWN;
 
   std::map<Dali::Accessibility::RelationType, std::set<Accessibility::Accessible*>> mAccessibilityRelations;
@@ -596,6 +598,7 @@ public:
   static const PropertyRegistration PROPERTY_20;
   static const PropertyRegistration PROPERTY_21;
   static const PropertyRegistration PROPERTY_22;
+  static const PropertyRegistration PROPERTY_23;
 
 private:
   // Accessibility - notification for highlighted object to check if it is showing.
index 88fa83f..0f3e141 100644 (file)
@@ -236,7 +236,7 @@ void EffectsView::OnInitialize()
 
   DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
     return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+      new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::FILLER));
   });
 }
 
index 4a3b065..964afe2 100644 (file)
@@ -837,7 +837,7 @@ void FlexContainer::OnInitialize()
 
   DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
     return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+      new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::FILLER));
   });
 }
 
index 29d36b1..64d5ecb 100644 (file)
@@ -297,7 +297,7 @@ void GaussianBlurView::OnInitialize()
 
   DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
     return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+      new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::FILLER));
   });
 }
 
index 1a653a1..1d9deec 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -96,7 +96,7 @@ void ImageView::OnInitialize()
 
   DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
     return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::IMAGE));
+      new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::IMAGE));
   });
 }
 
@@ -479,27 +479,43 @@ void ImageView::SetProperty(BaseObject* object, Property::Index index, const Pro
           map = value.GetMap();
           if(map)
           {
-            Property::Value* shaderValue = map->Find(Toolkit::Visual::Property::SHADER, CUSTOM_SHADER);
-            // set image only if property map contains image information other than custom shader
-            if(map->Count() > 1u || !shaderValue)
+            // the property map is emtpy map. Unregister visual.
+            if(DALI_UNLIKELY(map->Count() == 0u))
             {
-              impl.SetImage(*map);
+              // Clear cached properties
+              impl.mPropertyMap.Clear();
+              impl.mUrl.clear();
+
+              // Unregister the exsiting visual
+              DevelControl::UnregisterVisual(impl, Toolkit::ImageView::Property::IMAGE);
+
+              // Trigger a size negotiation request that may be needed when unregistering a visual.
+              impl.RelayoutRequest();
             }
-            // the property map contains only the custom shader
-            else if((map->Count() == 1u) && (shaderValue))
+            else
             {
-              Property::Map* shaderMap = shaderValue->GetMap();
-              if(shaderMap)
+              Property::Value* shaderValue = map->Find(Toolkit::Visual::Property::SHADER, CUSTOM_SHADER);
+              // set image only if property map contains image information other than custom shader
+              if(map->Count() > 1u || !shaderValue)
               {
-                impl.mShaderMap = *shaderMap;
-
-                if(!impl.mUrl.empty())
-                {
-                  impl.SetImage(impl.mUrl, impl.mImageSize);
-                }
-                else if(!impl.mPropertyMap.Empty())
+                impl.SetImage(*map);
+              }
+              // the property map contains only the custom shader
+              else if((map->Count() == 1u) && (shaderValue))
+              {
+                Property::Map* shaderMap = shaderValue->GetMap();
+                if(shaderMap)
                 {
-                  impl.SetImage(impl.mPropertyMap);
+                  impl.mShaderMap = *shaderMap;
+
+                  if(!impl.mUrl.empty())
+                  {
+                    impl.SetImage(impl.mUrl, impl.mImageSize);
+                  }
+                  else if(!impl.mPropertyMap.Empty())
+                  {
+                    impl.SetImage(impl.mPropertyMap);
+                  }
                 }
               }
             }
index e37a534..c4e8ce2 100644 (file)
@@ -220,7 +220,7 @@ void Magnifier::Initialize()
 
   DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
     return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+      new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::FILLER));
   });
 }
 
index f9bf491..b9ee873 100644 (file)
@@ -282,7 +282,7 @@ void Model3dView::OnInitialize()
 
   DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
     return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::IMAGE));
+      new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::IMAGE));
   });
 }
 
index 3dd6909..9eab290 100644 (file)
@@ -72,7 +72,7 @@ void NavigationView::OnInitialize()
 {
   DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
     return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+      new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::FILLER));
   });
 }
 
index d74574c..69369de 100644 (file)
@@ -416,7 +416,7 @@ void PageTurnView::OnInitialize()
 
   DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
     return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::PAGE_TAB_LIST));
+      new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::PAGE_TAB_LIST));
   });
 }
 
index 9abcfe0..5331e74 100644 (file)
@@ -1994,7 +1994,7 @@ void Popup::SetupTouch()
   }
 }
 
-std::string Popup::AccessibleImpl::GetNameRaw()
+std::string Popup::AccessibleImpl::GetNameRaw() const
 {
   auto        popup = Toolkit::Popup::DownCast(Self());
   std::string title;
@@ -2018,7 +2018,7 @@ std::string Popup::AccessibleImpl::GetNameRaw()
 
 Dali::Accessibility::States Popup::AccessibleImpl::CalculateStates()
 {
-  auto states       = DevelControl::AccessibleImpl::CalculateStates();
+  auto states       = DevelControl::ControlAccessible::CalculateStates();
   auto popup        = Toolkit::Popup::DownCast(Self());
   auto displayState = popup.GetProperty<std::string>(Toolkit::Popup::Property::DISPLAY_STATE);
 
index 630caa8..50a2fd6 100644 (file)
@@ -241,11 +241,11 @@ public:
   static Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex);
 
 protected:
-  struct AccessibleImpl : public DevelControl::AccessibleImpl
+  struct AccessibleImpl : public DevelControl::ControlAccessible
   {
-    using DevelControl::AccessibleImpl::AccessibleImpl;
+    using DevelControl::ControlAccessible::ControlAccessible;
 
-    std::string                 GetNameRaw() override;
+    std::string                 GetNameRaw() const override;
     Dali::Accessibility::States CalculateStates() override;
   };
 
index 1006307..1a243a2 100644 (file)
@@ -676,18 +676,18 @@ void ProgressBar::OnSceneConnection(int depth)
   }
 }
 
-double ProgressBar::AccessibleImpl::GetMinimum()
+double ProgressBar::AccessibleImpl::GetMinimum() const
 {
   return DEFAULT_LOWER_BOUND;
 }
 
-double ProgressBar::AccessibleImpl::GetCurrent()
+double ProgressBar::AccessibleImpl::GetCurrent() const
 {
   auto self = Toolkit::ProgressBar::DownCast(Self());
   return self.GetProperty(Toolkit::ProgressBar::Property::PROGRESS_VALUE).Get<float>();
 }
 
-double ProgressBar::AccessibleImpl::GetMaximum()
+double ProgressBar::AccessibleImpl::GetMaximum() const
 {
   return DEFAULT_UPPER_BOUND;
 }
@@ -704,7 +704,7 @@ bool ProgressBar::AccessibleImpl::SetCurrent(double current)
   return true;
 }
 
-double ProgressBar::AccessibleImpl::GetMinimumIncrement()
+double ProgressBar::AccessibleImpl::GetMinimumIncrement() const
 {
   return 0.0;
 }
index 9ff203a..96540d2 100644 (file)
@@ -18,6 +18,9 @@
  *
  */
 
+// EXTERNAL INCLUDES
+#include <dali/devel-api/atspi-interfaces/value.h>
+
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/devel-api/controls/progress-bar/progress-bar-devel.h>
@@ -262,15 +265,16 @@ private:
   Property::Map           mSecondaryProgressVisualMap;    ///< To backup visual properties when switching determinate/indeterminate.
 
 protected:
-  struct AccessibleImpl : public DevelControl::AccessibleImpl,
+  struct AccessibleImpl : public DevelControl::ControlAccessible,
                           public virtual Dali::Accessibility::Value
   {
-    using DevelControl::AccessibleImpl::AccessibleImpl;
-    double GetMinimum() override;
-    double GetCurrent() override;
-    double GetMaximum() override;
+    using DevelControl::ControlAccessible::ControlAccessible;
+
+    double GetMinimum() const override;
+    double GetCurrent() const override;
+    double GetMaximum() const override;
     bool   SetCurrent(double) override;
-    double GetMinimumIncrement() override;
+    double GetMinimumIncrement() const override;
   };
 };
 
index 1da4297..1fef71b 100644 (file)
@@ -861,21 +861,21 @@ Toolkit::ScrollBar ScrollBar::New(Toolkit::ScrollBar::Direction direction)
   return handle;
 }
 
-double ScrollBar::AccessibleImpl::GetMinimum()
+double ScrollBar::AccessibleImpl::GetMinimum() const
 {
   auto self = Toolkit::ScrollBar::DownCast(Self());
   Handle scrollableHandle = GetImpl(self).mScrollableObject.GetHandle();
   return scrollableHandle ? scrollableHandle.GetCurrentProperty<float>(GetImpl(self).mPropertyMinScrollPosition) : 0.0f;
 }
 
-double ScrollBar::AccessibleImpl::GetCurrent()
+double ScrollBar::AccessibleImpl::GetCurrent() const
 {
   auto self = Toolkit::ScrollBar::DownCast(Self());
   Handle scrollableHandle = GetImpl(self).mScrollableObject.GetHandle();
   return scrollableHandle ? scrollableHandle.GetCurrentProperty<float>(GetImpl(self).mPropertyScrollPosition) : 0.0f;
 }
 
-double ScrollBar::AccessibleImpl::GetMaximum()
+double ScrollBar::AccessibleImpl::GetMaximum() const
 {
   auto self = Toolkit::ScrollBar::DownCast(Self());
   Handle scrollableHandle = GetImpl(self).mScrollableObject.GetHandle();
@@ -910,7 +910,7 @@ bool ScrollBar::AccessibleImpl::SetCurrent(double current)
   return true;
 }
 
-double ScrollBar::AccessibleImpl::GetMinimumIncrement()
+double ScrollBar::AccessibleImpl::GetMinimumIncrement() const
 {
   return 1.0;
 }
index abb5200..97a7daa 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 // EXTERNAL INCLUDES
+#include <dali/devel-api/atspi-interfaces/value.h>
 #include <dali/public-api/adaptor-framework/timer.h>
 #include <dali/public-api/animation/animation.h>
 #include <dali/public-api/animation/constraint.h>
@@ -313,15 +314,16 @@ private:
   bool mIndicatorFirstShow : 1; ///< True if the indicator has never been shown
 
 protected:
-  struct AccessibleImpl : public DevelControl::AccessibleImpl,
+  struct AccessibleImpl : public DevelControl::ControlAccessible,
                           public virtual Dali::Accessibility::Value
   {
-    using DevelControl::AccessibleImpl::AccessibleImpl;
-    double GetMinimum() override;
-    double GetCurrent() override;
-    double GetMaximum() override;
+    using DevelControl::ControlAccessible::ControlAccessible;
+
+    double GetMinimum() const override;
+    double GetCurrent() const override;
+    double GetMaximum() const override;
     bool   SetCurrent(double) override;
-    double GetMinimumIncrement() override;
+    double GetMinimumIncrement() const override;
   };
 };
 
index 609476a..ea3240f 100644 (file)
@@ -92,7 +92,7 @@ Scrollable::~Scrollable()
 {
 }
 
-bool Scrollable::AccessibleImpl::IsScrollable()
+bool Scrollable::AccessibleImpl::IsScrollable() const
 {
   return true;
 }
index 4240a1e..44d9a33 100644 (file)
@@ -117,11 +117,11 @@ public:
   virtual void SetOvershootSize(const Vector2& size) = 0;
 
 protected: // From Control
-  struct AccessibleImpl : public DevelControl::AccessibleImpl
+  struct AccessibleImpl : public DevelControl::ControlAccessible
   {
-    using DevelControl::AccessibleImpl::AccessibleImpl;
+    using DevelControl::ControlAccessible::ControlAccessible;
 
-    bool IsScrollable() override;
+    bool IsScrollable() const override;
   };
 
   /**
index 612a9a4..1197a46 100644 (file)
@@ -258,7 +258,7 @@ void ShadowView::OnInitialize()
 
   DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
     return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+      new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::FILLER));
   });
 }
 
index 8cac5ed..7e6370d 100644 (file)
@@ -1411,19 +1411,19 @@ Property::Value Slider::GetProperty(BaseObject* object, Property::Index property
   return value;
 }
 
-double Slider::AccessibleImpl::GetMinimum()
+double Slider::AccessibleImpl::GetMinimum() const
 {
   auto self = Toolkit::Slider::DownCast(Self());
   return self.GetProperty(Toolkit::Slider::Property::LOWER_BOUND).Get<float>();
 }
 
-double Slider::AccessibleImpl::GetCurrent()
+double Slider::AccessibleImpl::GetCurrent() const
 {
   auto self = Toolkit::Slider::DownCast(Self());
   return self.GetProperty(Toolkit::Slider::Property::VALUE).Get<float>();
 }
 
-double Slider::AccessibleImpl::GetMaximum()
+double Slider::AccessibleImpl::GetMaximum() const
 {
   auto self = Toolkit::Slider::DownCast(Self());
   return self.GetProperty(Toolkit::Slider::Property::UPPER_BOUND).Get<float>();
@@ -1477,7 +1477,7 @@ bool Slider::AccessibleImpl::SetCurrent(double current)
   return true;
 }
 
-double Slider::AccessibleImpl::GetMinimumIncrement()
+double Slider::AccessibleImpl::GetMinimumIncrement() const
 {
   auto self = Toolkit::Slider::DownCast(Self());
 
index 134b9f2..7385953 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 // EXTERNAL INCLUDES
+#include <dali/devel-api/atspi-interfaces/value.h>
 #include <dali/public-api/adaptor-framework/timer.h>
 #include <dali/public-api/object/property-array.h>
 #include <dali/public-api/object/property-map.h>
@@ -748,15 +749,16 @@ private:
     mSnapToMarks : 1;  ///< Turn on or off snapping to marks
 
 protected:
-  struct AccessibleImpl : public DevelControl::AccessibleImpl,
+  struct AccessibleImpl : public DevelControl::ControlAccessible,
                           public virtual Dali::Accessibility::Value
   {
-    using DevelControl::AccessibleImpl::AccessibleImpl;
-    double GetMinimum() override;
-    double GetCurrent() override;
-    double GetMaximum() override;
+    using DevelControl::ControlAccessible::ControlAccessible;
+
+    double GetMinimum() const override;
+    double GetCurrent() const override;
+    double GetMaximum() const override;
     bool   SetCurrent(double) override;
-    double GetMinimumIncrement() override;
+    double GetMinimumIncrement() const override;
   };
 };
 
index 6325e62..fef8956 100644 (file)
@@ -151,7 +151,7 @@ void SuperBlurView::OnInitialize()
 
   DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
     return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+      new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::FILLER));
   });
 }
 
index 9aec5ba..2426775 100644 (file)
@@ -1121,7 +1121,7 @@ void TableView::OnInitialize()
 
   DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
     return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::TABLE));
+      new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::TABLE));
   });
 }
 
index b590862..e26006d 100644 (file)
  */
 
 // EXTERNAL INCLUDES
-#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali/devel-api/atspi-interfaces/hyperlink.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/controls/text-controls/text-anchor-devel.h>
 #include <dali-toolkit/internal/controls/control/control-data-impl.h>
 #include <dali-toolkit/internal/text/text-anchor-control-interface.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
 
 namespace Dali
 {
@@ -104,10 +105,10 @@ protected:
   /**
    * @brief This structure is to connect TextAnchor with Accessible functions.
    */
-  struct AccessibleImpl : public DevelControl::AccessibleImpl,
+  struct AccessibleImpl : public DevelControl::ControlAccessible,
                           public virtual Dali::Accessibility::Hyperlink
   {
-    using DevelControl::AccessibleImpl::AccessibleImpl;
+    using DevelControl::ControlAccessible::ControlAccessible;
     /**
      * @copydoc Dali::Accessibility::Hyperlink::GetEndIndex()
      */
index a43195b..a75e21c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -146,6 +146,7 @@ DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextEditor, "verticalScrollP
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextEditor, "enableEditing",                        BOOLEAN,   ENABLE_EDITING                      )
 DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY(Toolkit, TextEditor, "selectedText",                         STRING,    SELECTED_TEXT                       )
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextEditor, "fontSizeScale",                        FLOAT,     FONT_SIZE_SCALE                     )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextEditor, "enableFontSizeScale",                  BOOLEAN,   ENABLE_FONT_SIZE_SCALE              )
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextEditor, "primaryCursorPosition",                INTEGER,   PRIMARY_CURSOR_POSITION             )
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextEditor, "grabHandleColor",                      VECTOR4,   GRAB_HANDLE_COLOR                   )
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextEditor, "enableGrabHandlePopup",                BOOLEAN,   ENABLE_GRAB_HANDLE_POPUP            )
@@ -1296,13 +1297,13 @@ TextEditor::~TextEditor()
   }
 }
 
-std::string TextEditor::AccessibleImpl::GetName()
+std::string TextEditor::AccessibleImpl::GetName() const
 {
   auto self = Toolkit::TextEditor::DownCast(Self());
   return self.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
 }
 
-std::string TextEditor::AccessibleImpl::GetText(size_t startOffset, size_t endOffset)
+std::string TextEditor::AccessibleImpl::GetText(size_t startOffset, size_t endOffset) const
 {
   if(endOffset <= startOffset)
   {
@@ -1320,7 +1321,7 @@ std::string TextEditor::AccessibleImpl::GetText(size_t startOffset, size_t endOf
   return text.substr(startOffset, endOffset - startOffset);
 }
 
-size_t TextEditor::AccessibleImpl::GetCharacterCount()
+size_t TextEditor::AccessibleImpl::GetCharacterCount() const
 {
   auto self = Toolkit::TextEditor::DownCast(Self());
   auto text = self.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
@@ -1328,7 +1329,7 @@ size_t TextEditor::AccessibleImpl::GetCharacterCount()
   return text.size();
 }
 
-size_t TextEditor::AccessibleImpl::GetCursorOffset()
+size_t TextEditor::AccessibleImpl::GetCursorOffset() const
 {
   auto slf = Toolkit::TextEditor::DownCast(Self());
   return Dali::Toolkit::GetImpl(slf).GetTextController()->GetCursorPosition();
@@ -1350,7 +1351,7 @@ bool TextEditor::AccessibleImpl::SetCursorOffset(size_t offset)
   return true;
 }
 
-Dali::Accessibility::Range TextEditor::AccessibleImpl::GetTextAtOffset(size_t offset, Dali::Accessibility::TextBoundary boundary)
+Dali::Accessibility::Range TextEditor::AccessibleImpl::GetTextAtOffset(size_t offset, Dali::Accessibility::TextBoundary boundary) const
 {
   auto self     = Toolkit::TextEditor::DownCast(Self());
   auto text     = self.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
@@ -1441,7 +1442,7 @@ Dali::Accessibility::Range TextEditor::AccessibleImpl::GetTextAtOffset(size_t of
   return range;
 }
 
-Dali::Accessibility::Range TextEditor::AccessibleImpl::GetRangeOfSelection(size_t selectionIndex)
+Dali::Accessibility::Range TextEditor::AccessibleImpl::GetRangeOfSelection(size_t selectionIndex) const
 {
   // Since DALi supports only one selection indexes higher than 0 are ignored
   if(selectionIndex > 0)
@@ -1533,12 +1534,12 @@ Dali::Accessibility::States TextEditor::AccessibleImpl::CalculateStates()
 {
   using namespace Dali::Accessibility;
 
-  auto states              = DevelControl::AccessibleImpl::CalculateStates();
+  auto states              = DevelControl::ControlAccessible::CalculateStates();
   states[State::EDITABLE]  = true;
   states[State::FOCUSABLE] = true;
 
   Toolkit::Control focusControl = Toolkit::KeyInputFocusManager::Get().GetCurrentFocusControl();
-  if(mSelf == focusControl)
+  if(Self() == focusControl)
   {
     states[State::FOCUSED] = true;
   }
index 9d41735..6ea1cc8 100644 (file)
@@ -22,6 +22,9 @@
 #include <dali/devel-api/adaptor-framework/accessibility.h>
 #include <dali/devel-api/adaptor-framework/clipboard-event-notifier.h>
 #include <dali/devel-api/adaptor-framework/input-method-context.h>
+#include <dali/devel-api/atspi-interfaces/editable-text.h>
+#include <dali/devel-api/atspi-interfaces/hypertext.h>
+#include <dali/devel-api/atspi-interfaces/text.h>
 #include <dali/public-api/animation/animation.h>
 
 // INTERNAL INCLUDES
@@ -553,32 +556,31 @@ private: // Data
   /**
    * @brief This structure is to connect TextEditor with Accessible functions.
    */
-  struct AccessibleImpl : public DevelControl::AccessibleImpl,
-                          public virtual Dali::Accessibility::Text,
+  struct AccessibleImpl : public DevelControl::ControlAccessible,
                           public virtual Dali::Accessibility::EditableText,
                           public virtual Dali::Accessibility::Hypertext
   {
-    using DevelControl::AccessibleImpl::AccessibleImpl;
+    using DevelControl::ControlAccessible::ControlAccessible;
 
     /**
      * @copydoc Dali::Accessibility::Accessible::GetName()
      */
-    std::string GetName() override;
+    std::string GetName() const override;
 
     /**
      * @copydoc Dali::Accessibility::Text::GetText()
      */
-    std::string GetText(size_t startOffset, size_t endOffset) override;
+    std::string GetText(size_t startOffset, size_t endOffset) const override;
 
     /**
      * @copydoc Dali::Accessibility::Text::GetCharacterCount()
      */
-    size_t GetCharacterCount() override;
+    size_t GetCharacterCount() const override;
 
     /**
      * @copydoc Dali::Accessibility::Text::GetCursorOffset()
      */
-    size_t GetCursorOffset() override;
+    size_t GetCursorOffset() const override;
 
     /**
      * @copydoc Dali::Accessibility::Text::SetCursorOffset()
@@ -588,12 +590,12 @@ private: // Data
     /**
      * @copydoc Dali::Accessibility::Text::GetTextAtOffset()
      */
-    Accessibility::Range GetTextAtOffset(size_t offset, Accessibility::TextBoundary boundary) override;
+    Accessibility::Range GetTextAtOffset(size_t offset, Accessibility::TextBoundary boundary) const override;
 
     /**
      * @copydoc Dali::Accessibility::Text::GetRangeOfSelection()
      */
-    Accessibility::Range GetRangeOfSelection(size_t selectionIndex) override;
+    Accessibility::Range GetRangeOfSelection(size_t selectionIndex) const override;
 
     /**
      * @copydoc Dali::Accessibility::Text::RemoveSelection()
index 5b6950f..c6698ff 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -610,6 +610,15 @@ void TextEditor::PropertyHandler::SetProperty(Toolkit::TextEditor textEditor, Pr
       }
       break;
     }
+    case Toolkit::DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE:
+    {
+      const bool enableFontSizeScale = value.Get<bool>();
+      if(!Equals(impl.mController->IsFontSizeScaleEnabled(), enableFontSizeScale))
+      {
+        impl.mController->SetFontSizeScaleEnabled(enableFontSizeScale);
+      }
+      break;
+    }
     case Toolkit::DevelTextEditor::Property::PRIMARY_CURSOR_POSITION:
     {
       uint32_t position = static_cast<uint32_t>(value.Get<int>());
@@ -1060,6 +1069,11 @@ Property::Value TextEditor::PropertyHandler::GetProperty(Toolkit::TextEditor tex
       value = impl.mController->GetFontSizeScale();
       break;
     }
+    case Toolkit::DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE:
+    {
+      value = impl.mController->IsFontSizeScaleEnabled();
+      break;
+    }
     case Toolkit::DevelTextEditor::Property::PRIMARY_CURSOR_POSITION:
     {
       value = static_cast<int>(impl.mController->GetPrimaryCursorPosition());
index cb820b1..3475b36 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -137,6 +137,7 @@ DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextField, "selectedTextStar
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextField, "selectedTextEnd",                  INTEGER,   SELECTED_TEXT_END                   )
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextField, "enableEditing",                    BOOLEAN,   ENABLE_EDITING                      )
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextField, "fontSizeScale",                    FLOAT,     FONT_SIZE_SCALE                     )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextField, "enableFontSizeScale",              BOOLEAN,   ENABLE_FONT_SIZE_SCALE              )
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextField, "primaryCursorPosition",            INTEGER,   PRIMARY_CURSOR_POSITION             )
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextField, "grabHandleColor",                  VECTOR4,   GRAB_HANDLE_COLOR                   )
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextField, "inputFilter",                      MAP,       INPUT_FILTER                        )
@@ -1140,7 +1141,7 @@ Vector<Vector2> TextField::GetTextPosition(const uint32_t startIndex, const uint
   return mController->GetTextPosition(startIndex, endIndex);
 }
 
-std::string TextField::AccessibleImpl::GetName()
+std::string TextField::AccessibleImpl::GetName() const
 {
   auto self = Toolkit::TextField::DownCast(Self());
   if(IsHiddenInput(self))
@@ -1151,7 +1152,7 @@ std::string TextField::AccessibleImpl::GetName()
   return self.GetProperty(Toolkit::TextField::Property::TEXT).Get<std::string>();
 }
 
-std::string TextField::AccessibleImpl::GetText(size_t startOffset, size_t endOffset)
+std::string TextField::AccessibleImpl::GetText(size_t startOffset, size_t endOffset) const
 {
   if(endOffset <= startOffset)
   {
@@ -1172,7 +1173,7 @@ std::string TextField::AccessibleImpl::GetText(size_t startOffset, size_t endOff
   return text.substr(startOffset, endOffset - startOffset);
 }
 
-size_t TextField::AccessibleImpl::GetCharacterCount()
+size_t TextField::AccessibleImpl::GetCharacterCount() const
 {
   auto self = Toolkit::TextField::DownCast(Self());
   auto text = self.GetProperty(Toolkit::TextField::Property::TEXT).Get<std::string>();
@@ -1180,7 +1181,7 @@ size_t TextField::AccessibleImpl::GetCharacterCount()
   return text.size();
 }
 
-size_t TextField::AccessibleImpl::GetCursorOffset()
+size_t TextField::AccessibleImpl::GetCursorOffset() const
 {
   auto self = Toolkit::TextField::DownCast(Self());
   return Dali::Toolkit::GetImpl(self).GetTextController()->GetCursorPosition();
@@ -1203,7 +1204,7 @@ bool TextField::AccessibleImpl::SetCursorOffset(size_t offset)
 }
 
 Dali::Accessibility::Range TextField::AccessibleImpl::GetTextAtOffset(
-  size_t offset, Dali::Accessibility::TextBoundary boundary)
+  size_t offset, Dali::Accessibility::TextBoundary boundary) const
 {
   auto self  = Toolkit::TextField::DownCast(Self());
   auto range = Dali::Accessibility::Range{};
@@ -1301,7 +1302,7 @@ Dali::Accessibility::Range TextField::AccessibleImpl::GetTextAtOffset(
   return range;
 }
 
-Dali::Accessibility::Range TextField::AccessibleImpl::GetRangeOfSelection(size_t selectionIndex)
+Dali::Accessibility::Range TextField::AccessibleImpl::GetRangeOfSelection(size_t selectionIndex) const
 {
   // Since DALi supports only one selection indexes higher than 0 are ignored
   if(selectionIndex > 0)
@@ -1401,13 +1402,13 @@ Dali::Accessibility::States TextField::AccessibleImpl::CalculateStates()
 {
   using namespace Dali::Accessibility;
 
-  auto states = DevelControl::AccessibleImpl::CalculateStates();
+  auto states = DevelControl::ControlAccessible::CalculateStates();
 
   states[State::EDITABLE]  = true;
   states[State::FOCUSABLE] = true;
 
   Toolkit::Control focusControl = Toolkit::KeyInputFocusManager::Get().GetCurrentFocusControl();
-  if(mSelf == focusControl)
+  if(Self() == focusControl)
   {
     states[State::FOCUSED] = true;
   }
index 1f97263..e53189e 100644 (file)
@@ -21,6 +21,9 @@
 // EXTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/clipboard-event-notifier.h>
 #include <dali/devel-api/adaptor-framework/input-method-context.h>
+#include <dali/devel-api/atspi-interfaces/editable-text.h>
+#include <dali/devel-api/atspi-interfaces/hypertext.h>
+#include <dali/devel-api/atspi-interfaces/text.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/controls/control-devel.h>
@@ -501,32 +504,31 @@ protected:
   /**
    * @brief This structure is to connect TextField with Accessible functions.
    */
-  struct AccessibleImpl : public DevelControl::AccessibleImpl,
-                          public virtual Dali::Accessibility::Text,
+  struct AccessibleImpl : public DevelControl::ControlAccessible,
                           public virtual Dali::Accessibility::EditableText,
                           public virtual Dali::Accessibility::Hypertext
   {
-    using DevelControl::AccessibleImpl::AccessibleImpl;
+    using DevelControl::ControlAccessible::ControlAccessible;
 
     /**
      * @copydoc Dali::Accessibility::Accessible::GetName()
      */
-    std::string GetName() override;
+    std::string GetName() const override;
 
     /**
      * @copydoc Dali::Accessibility::Text::GetText()
      */
-    std::string GetText(size_t startOffset, size_t endOffset) override;
+    std::string GetText(size_t startOffset, size_t endOffset) const override;
 
     /**
      * @copydoc Dali::Accessibility::Text::GetCharacterCount()
      */
-    size_t GetCharacterCount() override;
+    size_t GetCharacterCount() const override;
 
     /**
      * @copydoc Dali::Accessibility::Text::GetCursorOffset()
      */
-    size_t GetCursorOffset() override;
+    size_t GetCursorOffset() const override;
 
     /**
      * @copydoc Dali::Accessibility::Text::SetCursorOffset()
@@ -536,12 +538,12 @@ protected:
     /**
      * @copydoc Dali::Accessibility::Text::GetTextAtOffset()
      */
-    Accessibility::Range GetTextAtOffset(size_t offset, Accessibility::TextBoundary boundary) override;
+    Accessibility::Range GetTextAtOffset(size_t offset, Accessibility::TextBoundary boundary) const override;
 
     /**
      * @copydoc Dali::Accessibility::Text::GetRangeOfSelection()
      */
-    Accessibility::Range GetRangeOfSelection(size_t selectionIndex) override;
+    Accessibility::Range GetRangeOfSelection(size_t selectionIndex) const override;
 
     /**
      * @copydoc Dali::Accessibility::Text::RemoveSelection()
index 40b3504..6020ba7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -626,6 +626,15 @@ void TextField::PropertyHandler::SetProperty(Toolkit::TextField textField, Prope
       }
       break;
     }
+    case Toolkit::DevelTextField::Property::ENABLE_FONT_SIZE_SCALE:
+    {
+      const bool enableFontSizeScale = value.Get<bool>();
+      if(!Equals(impl.mController->IsFontSizeScaleEnabled(), enableFontSizeScale))
+      {
+        impl.mController->SetFontSizeScaleEnabled(enableFontSizeScale);
+      }
+      break;
+    }
     case Toolkit::DevelTextField::Property::PRIMARY_CURSOR_POSITION:
     {
       uint32_t position = static_cast<uint32_t>(value.Get<int>());
@@ -1021,6 +1030,11 @@ Property::Value TextField::PropertyHandler::GetProperty(Toolkit::TextField textF
       value = impl.mController->GetFontSizeScale();
       break;
     }
+    case Toolkit::DevelTextField::Property::ENABLE_FONT_SIZE_SCALE:
+    {
+      value = impl.mController->IsFontSizeScaleEnabled();
+      break;
+    }
     case Toolkit::DevelTextField::Property::PRIMARY_CURSOR_POSITION:
     {
       value = static_cast<int>(impl.mController->GetPrimaryCursorPosition());
index d1cde22..9ef8ed1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -136,6 +136,7 @@ DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextLabel, "textFit",
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextLabel, "minLineSize",                  FLOAT,   MIN_LINE_SIZE                  )
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextLabel, "renderingBackend",             INTEGER, RENDERING_BACKEND              )
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextLabel, "fontSizeScale",                FLOAT,   FONT_SIZE_SCALE                )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextLabel, "enableFontSizeScale",          BOOLEAN, ENABLE_FONT_SIZE_SCALE         )
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextLabel, "ellipsisPosition",             INTEGER, ELLIPSIS_POSITION              )
 DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit,           TextLabel, "strikethrough",                MAP,     STRIKETHROUGH                  )
 
@@ -509,6 +510,15 @@ void TextLabel::SetProperty(BaseObject* object, Property::Index index, const Pro
         }
         break;
       }
+      case Toolkit::DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE:
+      {
+        const bool enableFontSizeScale = value.Get<bool>();
+        if(!Equals(impl.mController->IsFontSizeScaleEnabled(), enableFontSizeScale))
+        {
+          impl.mController->SetFontSizeScaleEnabled(enableFontSizeScale);
+        }
+        break;
+      }
       case Toolkit::DevelTextLabel::Property::ELLIPSIS_POSITION:
       {
         DevelText::EllipsisPosition::Type ellipsisPositionType(static_cast<DevelText::EllipsisPosition::Type>(-1)); // Set to invalid value to ensure a valid mode does get set
@@ -762,6 +772,11 @@ Property::Value TextLabel::GetProperty(BaseObject* object, Property::Index index
         value = impl.mController->GetFontSizeScale();
         break;
       }
+      case Toolkit::DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE:
+      {
+        value = impl.mController->IsFontSizeScaleEnabled();
+        break;
+      }
       case Toolkit::DevelTextLabel::Property::ELLIPSIS_POSITION:
       {
         value = impl.mController->GetEllipsisPosition();
@@ -1157,7 +1172,7 @@ Vector<Vector2> TextLabel::GetTextPosition(const uint32_t startIndex, const uint
   return mController->GetTextPosition(startIndex, endIndex);
 }
 
-std::string TextLabel::AccessibleImpl::GetNameRaw()
+std::string TextLabel::AccessibleImpl::GetNameRaw() const
 {
   auto self = Toolkit::TextLabel::DownCast(Self());
   return self.GetProperty(Toolkit::TextLabel::Property::TEXT).Get<std::string>();
@@ -1168,7 +1183,7 @@ Property::Index TextLabel::AccessibleImpl::GetNamePropertyIndex()
   return Toolkit::TextLabel::Property::TEXT;
 }
 
-std::string TextLabel::AccessibleImpl::GetText(size_t startOffset, size_t endOffset)
+std::string TextLabel::AccessibleImpl::GetText(size_t startOffset, size_t endOffset) const
 {
   if(endOffset <= startOffset)
   {
@@ -1186,7 +1201,7 @@ std::string TextLabel::AccessibleImpl::GetText(size_t startOffset, size_t endOff
   return text.substr(startOffset, endOffset - startOffset);
 }
 
-size_t TextLabel::AccessibleImpl::GetCharacterCount()
+size_t TextLabel::AccessibleImpl::GetCharacterCount() const
 {
   auto self = Toolkit::TextLabel::DownCast(Self());
   auto text = self.GetProperty(Toolkit::TextLabel::Property::TEXT).Get<std::string>();
@@ -1194,7 +1209,7 @@ size_t TextLabel::AccessibleImpl::GetCharacterCount()
   return text.size();
 }
 
-size_t TextLabel::AccessibleImpl::GetCursorOffset()
+size_t TextLabel::AccessibleImpl::GetCursorOffset() const
 {
   return {};
 }
@@ -1204,7 +1219,7 @@ bool TextLabel::AccessibleImpl::SetCursorOffset(size_t offset)
   return {};
 }
 
-Dali::Accessibility::Range TextLabel::AccessibleImpl::GetTextAtOffset(size_t offset, Dali::Accessibility::TextBoundary boundary)
+Dali::Accessibility::Range TextLabel::AccessibleImpl::GetTextAtOffset(size_t offset, Dali::Accessibility::TextBoundary boundary) const
 {
   auto self     = Toolkit::TextLabel::DownCast(Self());
   auto text     = self.GetProperty(Toolkit::TextLabel::Property::TEXT).Get<std::string>();
@@ -1295,7 +1310,7 @@ Dali::Accessibility::Range TextLabel::AccessibleImpl::GetTextAtOffset(size_t off
   return range;
 }
 
-Dali::Accessibility::Range TextLabel::AccessibleImpl::GetRangeOfSelection(size_t selectionIndex)
+Dali::Accessibility::Range TextLabel::AccessibleImpl::GetRangeOfSelection(size_t selectionIndex) const
 {
   // Since DALi supports only one selection indexes higher than 0 are ignored
   if(selectionIndex > 0)
index d776c32..8bedc5b 100644 (file)
@@ -19,6 +19,8 @@
  */
 
 // EXTERNAL INCLUDES
+#include <dali/devel-api/atspi-interfaces/hypertext.h>
+#include <dali/devel-api/atspi-interfaces/text.h>
 #include <dali/public-api/object/property-map.h>
 
 // INTERNAL INCLUDES
@@ -241,26 +243,26 @@ protected:
   /**
    * @brief This structure is to connect TextLabel with Accessible functions.
    */
-  struct AccessibleImpl : public DevelControl::AccessibleImpl,
+  struct AccessibleImpl : public DevelControl::ControlAccessible,
                           public virtual Dali::Accessibility::Text,
                           public virtual Dali::Accessibility::Hypertext
   {
-    using DevelControl::AccessibleImpl::AccessibleImpl;
+    using DevelControl::ControlAccessible::ControlAccessible;
 
     /**
      * @copydoc Dali::Accessibility::Text::GetText()
      */
-    std::string GetText(size_t startOffset, size_t endOffset) override;
+    std::string GetText(size_t startOffset, size_t endOffset) const override;
 
     /**
      * @copydoc Dali::Accessibility::Text::GetCharacterCount()
      */
-    size_t GetCharacterCount() override;
+    size_t GetCharacterCount() const override;
 
     /**
      * @copydoc Dali::Accessibility::Text::GetCursorOffset()
      */
-    size_t GetCursorOffset() override;
+    size_t GetCursorOffset() const override;
 
     /**
      * @copydoc Dali::Accessibility::Text::SetCursorOffset()
@@ -270,12 +272,12 @@ protected:
     /**
      * @copydoc Dali::Accessibility::Text::GetTextAtOffset()
      */
-    Accessibility::Range GetTextAtOffset(size_t offset, Accessibility::TextBoundary boundary) override;
+    Accessibility::Range GetTextAtOffset(size_t offset, Accessibility::TextBoundary boundary) const override;
 
     /**
      * @copydoc Dali::Accessibility::Text::GetRangeOfSelection()
      */
-    Accessibility::Range GetRangeOfSelection(size_t selectionIndex) override;
+    Accessibility::Range GetRangeOfSelection(size_t selectionIndex) const override;
 
     /**
      * @copydoc Dali::Accessibility::Text::RemoveSelection()
@@ -290,7 +292,7 @@ protected:
     /**
      * @copydoc Dali::Accessibility::Text::GetNameRaw()
      */
-    std::string GetNameRaw() override;
+    std::string GetNameRaw() const override;
 
     /**
      * @copydoc Dali::Accessibility::Text::GetNamePropertyIndex()
index e2d9f91..2ff1bd4 100644 (file)
@@ -399,7 +399,7 @@ void TextSelectionPopup::OnInitialize()
 
   DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
     return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::DIALOG, true));
+      new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::DIALOG, true));
   });
 
   //Enable highightability
index ba2b8d5..3220328 100644 (file)
@@ -166,7 +166,7 @@ void TextSelectionToolbar::OnInitialize()
 
   DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
     return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::TOOL_BAR));
+      new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::TOOL_BAR));
   });
 }
 
index 2aefaaf..0e894df 100644 (file)
@@ -313,7 +313,7 @@ void ToolBar::OnInitialize()
 
   DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
     return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::TOOL_BAR));
+      new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::TOOL_BAR));
   });
 }
 
index 181a47e..9934f3b 100644 (file)
@@ -120,7 +120,7 @@ void VideoView::OnInitialize()
 
   DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
     return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::VIDEO));
+      new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::VIDEO));
   });
 
   //Enable highightability
index 85b2fe1..f791349 100755 (executable)
@@ -183,6 +183,7 @@ void WebView::OnInitialize()
   Actor self = Self();
 
   self.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
+  self.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, true);
   self.TouchedSignal().Connect(this, &WebView::OnTouchEvent);
   self.HoveredSignal().Connect(this, &WebView::OnHoverEvent);
   self.WheelEventSignal().Connect(this, &WebView::OnWheelEvent);
index 745da15..8c737d2 100644 (file)
@@ -517,7 +517,11 @@ bool KeyboardFocusManager::MoveFocus(Toolkit::Control::KeyboardFocus::Direction
       else if(mEnableDefaultAlgorithm)
       {
         // We should find it among the actors nearby.
-        nextFocusableActor = Toolkit::FocusFinder::GetNearestFocusableActor(currentFocusActor, direction);
+        Integration::SceneHolder window = Integration::SceneHolder::Get(currentFocusActor);
+        if(window)
+        {
+          nextFocusableActor = Toolkit::FocusFinder::GetNearestFocusableActor(window.GetRootLayer(), currentFocusActor, direction);
+        }
       }
     }
 
index c2d35d9..2379bcc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -458,6 +458,7 @@ CharacterIndex GetClosestCursorIndex(VisualModelPtr         visualModel,
 }
 
 void GetCursorPosition(GetCursorPositionParameters& parameters,
+                       float                        defaultFontLineHeight,
                        CursorInfo&                  cursorInfo)
 {
   const LineRun* const modelLines = parameters.visualModel->mLines.Begin();
@@ -479,6 +480,15 @@ void GetCursorPosition(GetCursorPositionParameters& parameters,
   const LineIndex lineIndex = parameters.visualModel->GetLineOfCharacter(characterOfLine);
   const LineRun&  line      = *(modelLines + lineIndex);
 
+  const GlyphIndex* const charactersToGlyphBuffer  = parameters.visualModel->mCharactersToGlyph.Begin();
+  const Length* const     glyphsPerCharacterBuffer = parameters.visualModel->mGlyphsPerCharacter.Begin();
+  const GlyphInfo* const  glyphInfoBuffer          = parameters.visualModel->mGlyphs.Begin();
+  CharacterIndex          index;
+  GlyphMetrics            glyphMetrics;
+  MetricsPtr&             metrics        = parameters.metrics;
+  GlyphIndex              glyphIndex     = 0u;
+  Length                  numberOfGlyphs = 0u;
+
   if(isLastNewParagraph)
   {
     // The cursor is in a new line with no characters. Place the cursor in that line.
@@ -493,8 +503,18 @@ void GetCursorPosition(GetCursorPositionParameters& parameters,
 
     cursorInfo.lineHeight = GetLineHeight(newLine);
 
+    index                                = 0u;
+    const Length totalNumberOfCharacters = parameters.logicalModel->mText.Count();
+    if(totalNumberOfCharacters > 0u)
+    {
+      index = totalNumberOfCharacters - 1u;
+    }
+
+    GetGlyphMetricsFromCharacterIndex(index, glyphInfoBuffer, charactersToGlyphBuffer, glyphsPerCharacterBuffer, metrics, glyphMetrics, glyphIndex, numberOfGlyphs);
+
     // Set the primary cursor's height.
-    cursorInfo.primaryCursorHeight = cursorInfo.lineHeight;
+    // The primary cursor height will take the font height of the last character and if there are no characters, it'll take the default font line height.
+    cursorInfo.primaryCursorHeight = (totalNumberOfCharacters > 0) ? (cursorInfo.isSecondaryCursor ? 0.5f * glyphMetrics.fontHeight : glyphMetrics.fontHeight) : defaultFontLineHeight;
 
     // Set the primary cursor's position.
     cursorInfo.primaryPosition.x = (LTR == line.direction) ? newLine.alignmentOffset : parameters.visualModel->mControlSize.width - newLine.alignmentOffset;
@@ -541,7 +561,7 @@ void GetCursorPosition(GetCursorPositionParameters& parameters,
 
     // Calculate the primary cursor.
 
-    CharacterIndex index = characterIndex;
+    index = characterIndex;
     if(cursorInfo.isSecondaryCursor)
     {
       // If there is a secondary position, the primary cursor may be in a different place than the logical index.
@@ -574,26 +594,14 @@ void GetCursorPosition(GetCursorPositionParameters& parameters,
       }
     }
 
-    const GlyphIndex* const     charactersToGlyphBuffer  = parameters.visualModel->mCharactersToGlyph.Begin();
-    const Length* const         glyphsPerCharacterBuffer = parameters.visualModel->mGlyphsPerCharacter.Begin();
     const Length* const         charactersPerGlyphBuffer = parameters.visualModel->mCharactersPerGlyph.Begin();
     const CharacterIndex* const glyphsToCharactersBuffer = parameters.visualModel->mGlyphsToCharacters.Begin();
     const Vector2* const        glyphPositionsBuffer     = parameters.visualModel->mGlyphPositions.Begin();
-    const GlyphInfo* const      glyphInfoBuffer          = parameters.visualModel->mGlyphs.Begin();
 
-    // Convert the cursor position into the glyph position.
-    const GlyphIndex primaryGlyphIndex         = *(charactersToGlyphBuffer + index);
-    const Length     primaryNumberOfGlyphs     = *(glyphsPerCharacterBuffer + index);
+    GetGlyphMetricsFromCharacterIndex(index, glyphInfoBuffer, charactersToGlyphBuffer, glyphsPerCharacterBuffer, metrics, glyphMetrics, glyphIndex, numberOfGlyphs);
+    const GlyphIndex primaryGlyphIndex         = glyphIndex;
     const Length     primaryNumberOfCharacters = *(charactersPerGlyphBuffer + primaryGlyphIndex);
 
-    // Get the metrics for the group of glyphs.
-    GlyphMetrics glyphMetrics;
-    GetGlyphsMetrics(primaryGlyphIndex,
-                     primaryNumberOfGlyphs,
-                     glyphMetrics,
-                     glyphInfoBuffer,
-                     parameters.metrics);
-
     // Whether to add the glyph's advance to the cursor position.
     // i.e if the paragraph is left to right and the logical cursor is zero, the position is the position of the first glyph and the advance is not added,
     //     if the logical cursor is one, the position is the position of the first glyph and the advance is added.
@@ -676,16 +684,9 @@ void GetCursorPosition(GetCursorPositionParameters& parameters,
         index = (isRightToLeftParagraph == isCurrentRightToLeft) ? nextCharacterIndex : characterIndex;
       }
 
-      const GlyphIndex secondaryGlyphIndex     = *(charactersToGlyphBuffer + index);
-      const Length     secondaryNumberOfGlyphs = *(glyphsPerCharacterBuffer + index);
-
-      const Vector2& secondaryPosition = *(glyphPositionsBuffer + secondaryGlyphIndex);
-
-      GetGlyphsMetrics(secondaryGlyphIndex,
-                       secondaryNumberOfGlyphs,
-                       glyphMetrics,
-                       glyphInfoBuffer,
-                       parameters.metrics);
+      GetGlyphMetricsFromCharacterIndex(index, glyphInfoBuffer, charactersToGlyphBuffer, glyphsPerCharacterBuffer, metrics, glyphMetrics, glyphIndex, numberOfGlyphs);
+      const GlyphIndex secondaryGlyphIndex = glyphIndex;
+      const Vector2&   secondaryPosition   = *(glyphPositionsBuffer + secondaryGlyphIndex);
 
       // Set the secondary cursor's position.
 
index dc005a3..4414743 100644 (file)
@@ -22,6 +22,7 @@
 #include <dali-toolkit/internal/text/logical-model-impl.h>
 #include <dali-toolkit/internal/text/metrics.h>
 #include <dali-toolkit/internal/text/visual-model-impl.h>
+#include <dali-toolkit/internal/text/glyph-metrics-helper.h>
 
 namespace Dali
 {
@@ -142,9 +143,11 @@ CharacterIndex GetClosestCursorIndex(VisualModelPtr         visualModel,
  * if there is a valid alternative cursor, its position and height.
  *
  * @param[in] parameters Parameters used to calculate the cursor's position.
+ * @param[in] defaultFontLineHeight The default font line height.
  * @param[out] cursorInfo The line's height, the cursor's height, the cursor's position and whether there is an alternative cursor.
  */
 void GetCursorPosition(GetCursorPositionParameters& parameters,
+                       float                        defaultFontLineHeight,
                        CursorInfo&                  cursorInfo);
 
 /**
index 1f27a84..f87555e 100644 (file)
@@ -100,6 +100,20 @@ void GetGlyphsMetrics(GlyphIndex             glyphIndex,
   glyphMetrics.width += (firstGlyph.isItalicRequired && !isItalicFont) ? TextAbstraction::FontClient::DEFAULT_ITALIC_ANGLE * firstGlyph.height : 0.f;
 }
 
+void GetGlyphMetricsFromCharacterIndex(CharacterIndex index, const GlyphInfo* const glyphInfoBuffer, const GlyphIndex* const charactersToGlyphBuffer, const Length* const glyphsPerCharacterBuffer, MetricsPtr& metrics, GlyphMetrics& glyphMetrics, GlyphIndex& glyphIndex, Length& numberOfGlyphs)
+{
+  //Takes the character index, obtains the glyph index (and the number of Glyphs) from it and finally gets the glyph metrics.
+  glyphIndex     = *(charactersToGlyphBuffer + index);
+  numberOfGlyphs = *(glyphsPerCharacterBuffer + index);
+
+  // Get the metrics for the group of glyphs.
+  GetGlyphsMetrics(glyphIndex,
+                   numberOfGlyphs,
+                   glyphMetrics,
+                   glyphInfoBuffer,
+                   metrics);
+}
+
 } // namespace Text
 
 } // namespace Toolkit
index 05ba882..dac57f0 100644 (file)
@@ -83,6 +83,28 @@ void GetGlyphsMetrics(GlyphIndex             glyphIndex,
                       const GlyphInfo* const glyphsBuffer,
                       MetricsPtr&            metrics);
 
+/**
+ * @brief Takes the character index, obtains the glyph index (and the number of Glyphs) from it and finally gets the glyph metrics.
+ *
+ * @param[in] index The character index.
+ * @param[in] glyphInfoBuffer The glyphs buffer.
+ * @param[in] charactersToGlyphBuffer A vector containing the glyph index for each character.
+ * @param[in] glyphsPerCharacterBuffer A vector containing the number of glyphs in each character.
+ * @param[in] metrics Used to access metrics from FontClient.
+ * @param[out] glyphMetrics Some glyph metrics (font height, advance, ascender and x bearing).
+ * @param[out] glyphIndex The glyph index obtained from the character index.
+ * @param[out] numberOfGlyphs The number of glyphs in the character of which the index was passed to the function.
+ *
+ */
+void GetGlyphMetricsFromCharacterIndex(CharacterIndex          index,
+                                       const GlyphInfo* const  glyphInfoBuffer,
+                                       const GlyphIndex* const charactersToGlyphBuffer,
+                                       const Length* const     glyphsPerCharacterBuffer,
+                                       MetricsPtr&             metrics,
+                                       GlyphMetrics&           glyphMetrics,
+                                       GlyphIndex&             glyphIndex,
+                                       Length&                 numberOfGlyphs);
+
 } // namespace Text
 
 } // namespace Toolkit
index 1ce7516..bd93e68 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -33,7 +33,6 @@
 
 namespace Dali::Toolkit::Text
 {
-
 namespace
 {
 #if defined(DEBUG_ENABLED)
@@ -90,7 +89,7 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o
   // Check whether the indices for updating the text is valid
   if(numberOfCharacters > 0u &&
      (impl.mTextUpdateInfo.mParagraphCharacterIndex > numberOfCharacters ||
-         impl.mTextUpdateInfo.mRequestedNumberOfCharacters > numberOfCharacters))
+      impl.mTextUpdateInfo.mRequestedNumberOfCharacters > numberOfCharacters))
   {
     std::string currentText;
     Utf32ToUtf8(impl.mModel->mLogicalModel->mText.Begin(), numberOfCharacters, currentText);
@@ -146,7 +145,7 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o
                      lineBreakInfo);
 
     if(impl.mModel->mLineWrapMode == ((Text::LineWrap::Mode)DevelText::LineWrap::HYPHENATION) ||
-        impl.mModel->mLineWrapMode == ((Text::LineWrap::Mode)DevelText::LineWrap::MIXED))
+       impl.mModel->mLineWrapMode == ((Text::LineWrap::Mode)DevelText::LineWrap::MIXED))
     {
       CharacterIndex end                 = startIndex + requestedNumberOfCharacters;
       LineBreakInfo* lineBreakInfoBuffer = lineBreakInfo.Begin();
@@ -212,7 +211,7 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o
 
       // Get the default font's description.
       TextAbstraction::FontDescription defaultFontDescription;
-      TextAbstraction::PointSize26Dot6 defaultPointSize = TextAbstraction::FontClient::DEFAULT_POINT_SIZE * impl.mFontSizeScale;
+      TextAbstraction::PointSize26Dot6 defaultPointSize = TextAbstraction::FontClient::DEFAULT_POINT_SIZE * impl.GetFontSizeScale();
 
       //Get the number of points per one unit of point-size
       uint32_t numberOfPointsPerOneUnitOfPointSize = impl.mFontClient.GetNumberOfPointsPerOneUnitOfPointSize();
@@ -223,7 +222,7 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o
         defaultFontDescription = impl.mEventData->mPlaceholderFont->mFontDescription;
         if(impl.mEventData->mPlaceholderFont->sizeDefined)
         {
-          defaultPointSize = impl.mEventData->mPlaceholderFont->mDefaultPointSize * impl.mFontSizeScale * numberOfPointsPerOneUnitOfPointSize;
+          defaultPointSize = impl.mEventData->mPlaceholderFont->mDefaultPointSize * impl.GetFontSizeScale() * numberOfPointsPerOneUnitOfPointSize;
         }
       }
       else if(nullptr != impl.mFontDefaults)
@@ -237,7 +236,7 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o
         }
         else
         {
-          defaultPointSize = impl.mFontDefaults->mDefaultPointSize * impl.mFontSizeScale * numberOfPointsPerOneUnitOfPointSize;
+          defaultPointSize = impl.mFontDefaults->mDefaultPointSize * impl.GetFontSizeScale() * numberOfPointsPerOneUnitOfPointSize;
         }
       }
 
@@ -352,7 +351,7 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o
   }
 
   if((nullptr != impl.mEventData) &&
-      impl.mEventData->mPreEditFlag &&
+     impl.mEventData->mPreEditFlag &&
      (0u != impl.mModel->mVisualModel->mCharactersToGlyph.Count()))
   {
     Dali::InputMethodContext::PreEditAttributeDataContainer attrs;
@@ -565,7 +564,7 @@ bool ControllerImplModelUpdater::Update(Controller::Impl& impl, OperationsMask o
 
   if((Controller::NO_OPERATION != (Controller::SHAPE_TEXT & operations)) &&
      !((nullptr != impl.mEventData) &&
-         impl.mEventData->mPreEditFlag &&
+       impl.mEventData->mPreEditFlag &&
        (0u != impl.mModel->mVisualModel->mCharactersToGlyph.Count())))
   {
     //Mark-up processor case
index f287daf..6ffa715 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -672,11 +672,11 @@ float Controller::Impl::GetDefaultFontLineHeight()
   if(nullptr == mFontDefaults)
   {
     TextAbstraction::FontDescription fontDescription;
-    defaultFontId = mFontClient.GetFontId(fontDescription, TextAbstraction::FontClient::DEFAULT_POINT_SIZE * mFontSizeScale);
+    defaultFontId = mFontClient.GetFontId(fontDescription, TextAbstraction::FontClient::DEFAULT_POINT_SIZE * GetFontSizeScale());
   }
   else
   {
-    defaultFontId = mFontDefaults->GetFontId(mFontClient, mFontDefaults->mDefaultPointSize * mFontSizeScale);
+    defaultFontId = mFontDefaults->GetFontId(mFontClient, mFontDefaults->mDefaultPointSize * GetFontSizeScale());
   }
 
   Text::FontMetrics fontMetrics;
@@ -1195,7 +1195,10 @@ void Controller::Impl::GetCursorPosition(CharacterIndex logical,
   parameters.logical      = logical;
   parameters.isMultiline  = isMultiLine;
 
+  float defaultFontLineHeight = GetDefaultFontLineHeight();
+
   Text::GetCursorPosition(parameters,
+                          defaultFontLineHeight,
                           cursorInfo);
 
   // Adds Outline offset.
index fa64a95..e697d81 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -357,6 +357,7 @@ struct Controller::Impl
     mTextFitMaxSize(DEFAULT_TEXTFIT_MAX),
     mTextFitStepSize(DEFAULT_TEXTFIT_STEP),
     mFontSizeScale(DEFAULT_FONT_SIZE_SCALE),
+    mFontSizeScaleEnabled(true),
     mTextFitEnabled(false),
     mTextFitChanged(false),
     mIsLayoutDirectionChanged(false)
@@ -497,6 +498,11 @@ struct Controller::Impl
     }
   }
 
+  float GetFontSizeScale()
+  {
+    return mFontSizeScaleEnabled ? mFontSizeScale : 1.0f;
+  }
+
   /**
    * @brief Helper to notify InputMethodContext with surrounding text & cursor changes.
    */
@@ -977,6 +983,7 @@ public:
   float mTextFitMaxSize;               ///< Maximum Font Size for text fit. Default 100
   float mTextFitStepSize;              ///< Step Size for font intervalse. Default 1
   float mFontSizeScale;                ///< Scale value for Font Size. Default 1.0
+  bool  mFontSizeScaleEnabled : 1;     ///< Whether the font size scale is enabled.
   bool  mTextFitEnabled : 1;           ///< Whether the text's fit is enabled.
   bool  mTextFitChanged : 1;           ///< Whether the text fit property has changed.
   bool  mIsLayoutDirectionChanged : 1; ///< Whether the layout has changed.
index 8a3ac3e..988ddd1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -393,7 +393,7 @@ void Controller::InputFontHandler::SetInputFontPointSize(Controller& controller,
                                                                              startOfSelectedText,
                                                                              lengthOfSelectedText);
 
-        fontDescriptionRun.size        = static_cast<PointSize26Dot6>(size * controller.mImpl->mFontSizeScale * 64.f);
+        fontDescriptionRun.size        = static_cast<PointSize26Dot6>(size * controller.mImpl->GetFontSizeScale() * 64.f);
         fontDescriptionRun.sizeDefined = true;
 
         controller.mImpl->mTextUpdateInfo.mCharacterIndex             = startOfSelectedText;
index 34e7053..c9a4fb0 100644 (file)
@@ -397,8 +397,11 @@ Controller::UpdateTextType Controller::Relayouter::Relayout(Controller& controll
     textUpdateInfo.mCharacterIndex     = 0u;
   }
 
+  bool layoutDirectionChanged = false;
   if(impl.mLayoutDirection != layoutDirection)
   {
+    // Flag to indicate that the layout direction has changed.
+    layoutDirectionChanged = true;
     // Clear the update info. This info will be set the next time the text is updated.
     textUpdateInfo.mClearAll = true;
     // Apply modifications to the model
@@ -449,13 +452,25 @@ Controller::UpdateTextType Controller::Relayouter::Relayout(Controller& controll
 
   if(isEditable)
   {
-    if(newSize)
+    if(newSize || layoutDirectionChanged)
     {
-      // If there is a new size, the scroll position needs to be clamped.
+      // If there is a new size or layout direction is changed, the scroll position needs to be clamped.
       impl.ClampHorizontalScroll(layoutSize);
 
       // Update the decorator's positions is needed if there is a new size.
       impl.mEventData->mDecorator->UpdatePositions(model->mScrollPosition - offset);
+
+      // All decorator elements need to be updated.
+      if(EventData::IsEditingState(impl.mEventData->mState))
+      {
+        impl.mEventData->mScrollAfterUpdatePosition = true;
+        impl.mEventData->mUpdateCursorPosition = true;
+        impl.mEventData->mUpdateGrabHandlePosition = true;
+      }
+      else if(impl.mEventData->mState == EventData::SELECTING)
+      {
+        impl.mEventData->mUpdateHighlightBox = true;
+      }
     }
 
     // Move the cursor, grab handle etc.
index 0bcb97f..ab90270 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -351,7 +351,7 @@ void Controller::TextUpdater::InsertText(Controller& controller, const std::stri
 
       if(addFontSizeRun)
       {
-        fontDescriptionRun.size        = static_cast<PointSize26Dot6>(inputStyle.size * impl.mFontSizeScale * 64.f);
+        fontDescriptionRun.size        = static_cast<PointSize26Dot6>(inputStyle.size * impl.GetFontSizeScale() * 64.f);
         fontDescriptionRun.sizeDefined = true;
       }
 
index 5ebd05a..5f75cf9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -667,6 +667,9 @@ void Controller::SetFontSizeScale(float scale)
 {
   mImpl->mFontSizeScale = scale;
 
+  // No relayout is required
+  if(!mImpl->mFontSizeScaleEnabled) return;
+
   // Update the cursor position if it's in editing mode
   UpdateCursorPosition(mImpl->mEventData);
 
@@ -681,6 +684,24 @@ float Controller::GetFontSizeScale() const
   return mImpl->mFontDefaults ? mImpl->mFontSizeScale : 1.0f;
 }
 
+void Controller::SetFontSizeScaleEnabled(bool enabled)
+{
+  mImpl->mFontSizeScaleEnabled = enabled;
+
+  // Update the cursor position if it's in editing mode
+  UpdateCursorPosition(mImpl->mEventData);
+
+  // Clear the font-specific data
+  mImpl->ClearFontData();
+
+  mImpl->RequestRelayout();
+}
+
+bool Controller::IsFontSizeScaleEnabled() const
+{
+  return mImpl->mFontSizeScaleEnabled;
+}
+
 void Controller::SetDefaultFontSize(float fontSize, FontSizeType type)
 {
   EnsureCreated(mImpl->mFontDefaults);
index da396c9..419cd05 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_TEXT_CONTROLLER_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -962,6 +962,20 @@ public: // Default style & Input style
   float GetFontSizeScale() const;
 
   /**
+   * @brief Set the font size scale enabled flag.
+   *
+   * @param[in] enabled whether to enable the font size scale.
+   */
+  void SetFontSizeScaleEnabled(bool enabled);
+
+  /**
+   * @brief Returns whether the font size scale is enabled or not.
+   *
+   * @return @e true if the font size scale is enabled, otherwise returns @e false.
+   */
+  bool IsFontSizeScaleEnabled() const;
+
+  /**
    * @brief Sets the Placeholder text font size.
    * @param[in] fontSize The placeholder text font size
    * @param[in] type The font size type is point size or pixel size
index f85d1f9..6dfd9e3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -213,7 +213,7 @@ Length View::GetGlyphs(GlyphInfo* glyphs,
 
           if(lastGlyphIndexOfLine == index)
           {
-            penY += -line->descender;
+            penY += -line->descender + line->lineSpacing;
 
             // Get the next line.
             ++lineIndex;
@@ -225,7 +225,7 @@ Length View::GetGlyphs(GlyphInfo* glyphs,
 
               lastGlyphIndexOfLine = (line->isSplitToTwoHalves ? line->glyphRunSecondHalf.glyphIndex + line->glyphRunSecondHalf.numberOfGlyphs : line->glyphRun.glyphIndex + line->glyphRun.numberOfGlyphs) - 1u;
 
-              penY += line->ascender + line->lineSpacing;
+              penY += line->ascender;
             }
           }
         }
index 4593bc7..dcb6621 100644 (file)
@@ -131,9 +131,9 @@ void FixedImageCache::LoadBatch()
 
     mReadyFlags.push_back(false);
 
-    // Note, if the image is already loaded, then UploadComplete will get called
+    // Note, if the image is already loaded, then LoadComplete will get called
     // from within this method. This means it won't yet have a texture id, so we
-    // need to account for this inside the UploadComplete method using mRequestingLoad.
+    // need to account for this inside the LoadComplete method using mRequestingLoad.
     mRequestingLoad = true;
 
     bool                               synchronousLoading = false;
@@ -186,42 +186,25 @@ void FixedImageCache::CheckFrontFrame(bool wasReady)
   }
 }
 
-void FixedImageCache::UploadComplete(
-  bool           loadSuccess,
-  int32_t        textureId,
-  TextureSet     textureSet,
-  bool           useAtlasing,
-  const Vector4& atlasRect,
-  bool           preMultiplied)
+void FixedImageCache::LoadComplete(bool loadSuccess, TextureInformation textureInformation)
 {
   bool frontFrameReady = IsFrontReady();
 
   if(!mRequestingLoad)
   {
-    SetImageFrameReady(textureId);
+    SetImageFrameReady(textureInformation.textureId);
 
     CheckFrontFrame(frontFrameReady);
   }
   else
   {
-    // UploadComplete has been called from within RequestLoad. TextureManager must
+    // LoadComplete has been called from within RequestLoad. TextureManager must
     // therefore already have the texture cached, so make the texture ready.
     // (Use the last texture, as the texture id hasn't been assigned yet)
     mReadyFlags.back() = true;
   }
 }
 
-void FixedImageCache::LoadComplete(
-  bool               loadSuccess,
-  Devel::PixelBuffer pixelBuffer,
-  const VisualUrl&   url,
-  bool               preMultiplied)
-{
-  // LoadComplete is called if this TextureUploadObserver requested to load
-  // an image that will be returned as a type of PixelBuffer by using a method
-  // TextureManager::LoadPixelBuffer.
-}
-
 } //namespace Internal
 } //namespace Toolkit
 } //namespace Dali
\ No newline at end of file
index 63212df..dc19937 100644 (file)
@@ -110,19 +110,7 @@ private:
   void CheckFrontFrame(bool wasReady);
 
 protected:
-  void UploadComplete(
-    bool           loadSuccess,
-    int32_t        textureId,
-    TextureSet     textureSet,
-    bool           useAtlasing,
-    const Vector4& atlasRect,
-    bool           premultiplied) override;
-
-  void LoadComplete(
-    bool               loadSuccess,
-    Devel::PixelBuffer pixelBuffer,
-    const VisualUrl&   url,
-    bool               preMultiplied) override;
+  void LoadComplete(bool loadSuccess, TextureInformation textureInformation) override;
 
 private:
   std::vector<UrlStore>& mImageUrls;
index eba9341..490c3be 100644 (file)
@@ -274,28 +274,22 @@ void RollingAnimatedImageCache::CheckFrontFrame(bool wasReady)
   }
 }
 
-void RollingAnimatedImageCache::UploadComplete(
-  bool           loadSuccess,
-  int32_t        textureId,
-  TextureSet     textureSet,
-  bool           useAtlasing,
-  const Vector4& atlasRect,
-  bool           preMultiplied)
+void RollingAnimatedImageCache::LoadComplete(bool loadSuccess, TextureInformation textureInformation)
 {
-  DALI_LOG_INFO(gAnimImgLogFilter, Debug::Concise, "AnimatedImageVisual::UploadComplete(textureId:%d) start\n", textureId);
+  DALI_LOG_INFO(gAnimImgLogFilter, Debug::Concise, "AnimatedImageVisual::LoadComplete(textureId:%d) start\n", textureInformation.textureId);
   LOG_CACHE;
 
   bool frontFrameReady = IsFrontReady();
 
   if(!mRequestingLoad)
   {
-    SetImageFrameReady(textureId);
+    SetImageFrameReady(textureInformation.textureId);
 
     CheckFrontFrame(frontFrameReady);
   }
   else
   {
-    // UploadComplete has been called from within RequestLoad. TextureManager must
+    // LoadComplete has been called from within RequestLoad. TextureManager must
     // therefore already have the texture cached, so make the texture ready.
     // (Use the last texture, as the texture id hasn't been assigned yet)
     mQueue.Back().mReady = true;
@@ -316,17 +310,6 @@ void RollingAnimatedImageCache::UploadComplete(
   LOG_CACHE;
 }
 
-void RollingAnimatedImageCache::LoadComplete(
-  bool               loadSuccess,
-  Devel::PixelBuffer pixelBuffer,
-  const VisualUrl&   url,
-  bool               preMultiplied)
-{
-  // LoadComplete is called if this TextureUploadObserver requested to load
-  // an image that will be returned as a type of PixelBuffer by using a method
-  // TextureManager::LoadPixelBuffer.
-}
-
 } //namespace Internal
 } //namespace Toolkit
 } //namespace Dali
index b1b4afc..e1d201b 100644 (file)
@@ -138,19 +138,7 @@ private:
   void CheckFrontFrame(bool wasReady);
 
 protected:
-  void UploadComplete(
-    bool           loadSuccess,
-    int32_t        textureId,
-    TextureSet     textureSet,
-    bool           useAtlasing,
-    const Vector4& atlasRect,
-    bool           preMultiplied) override;
-
-  void LoadComplete(
-    bool               loadSuccess,
-    Devel::PixelBuffer pixelBuffer,
-    const VisualUrl&   url,
-    bool               preMultiplied) override;
+  void LoadComplete(bool loadSuccess, TextureInformation textureInformation) override;
 
 private:
   /**
index 9bcf8e4..caecf39 100644 (file)
@@ -190,9 +190,9 @@ void RollingImageCache::LoadBatch()
 
     mQueue.PushBack(imageFrame);
 
-    // Note, if the image is already loaded, then UploadComplete will get called
+    // Note, if the image is already loaded, then LoadComplete will get called
     // from within this method. This means it won't yet have a texture id, so we
-    // need to account for this inside the UploadComplete method using mRequestingLoad.
+    // need to account for this inside the LoadComplete method using mRequestingLoad.
     mRequestingLoad = true;
 
     bool                               synchronousLoading = false;
@@ -246,28 +246,22 @@ void RollingImageCache::CheckFrontFrame(bool wasReady)
   }
 }
 
-void RollingImageCache::UploadComplete(
-  bool           loadSuccess,
-  int32_t        textureId,
-  TextureSet     textureSet,
-  bool           useAtlasing,
-  const Vector4& atlasRect,
-  bool           preMultiplied)
+void RollingImageCache::LoadComplete(bool loadSuccess, TextureInformation textureInformation)
 {
-  DALI_LOG_INFO(gAnimImgLogFilter, Debug::Concise, "AnimatedImageVisual::UploadComplete(textureId:%d) start\n", textureId);
+  DALI_LOG_INFO(gAnimImgLogFilter, Debug::Concise, "AnimatedImageVisual::LoadComplete(textureId:%d) start\n", textureInformation.textureId);
   LOG_CACHE;
 
   bool frontFrameReady = IsFrontReady();
 
   if(!mRequestingLoad)
   {
-    SetImageFrameReady(textureId);
+    SetImageFrameReady(textureInformation.textureId);
 
     CheckFrontFrame(frontFrameReady);
   }
   else
   {
-    // UploadComplete has been called from within RequestLoad. TextureManager must
+    // LoadComplete has been called from within RequestLoad. TextureManager must
     // therefore already have the texture cached, so make the texture ready.
     // (Use the last texture, as the texture id hasn't been assigned yet)
     mQueue.Back().mReady = true;
@@ -276,17 +270,6 @@ void RollingImageCache::UploadComplete(
   LOG_CACHE;
 }
 
-void RollingImageCache::LoadComplete(
-  bool               loadSuccess,
-  Devel::PixelBuffer pixelBuffer,
-  const VisualUrl&   url,
-  bool               preMultiplied)
-{
-  // LoadComplete is called if this TextureUploadObserver requested to load
-  // an image that will be returned as a type of PixelBuffer by using a method
-  // TextureManager::LoadPixelBuffer.
-}
-
 } //namespace Internal
 } //namespace Toolkit
 } //namespace Dali
index 1fcbe88..1490c41 100644 (file)
@@ -126,19 +126,7 @@ private:
   void CheckFrontFrame(bool wasReady);
 
 protected:
-  void UploadComplete(
-    bool           loadSuccess,
-    int32_t        textureId,
-    TextureSet     textureSet,
-    bool           useAtlasing,
-    const Vector4& atlasRect,
-    bool           preMultiplied) override;
-
-  void LoadComplete(
-    bool               loadSuccess,
-    Devel::PixelBuffer pixelBuffer,
-    const VisualUrl&   url,
-    bool               preMultiplied) override;
+  void LoadComplete(bool loadSuccess, TextureInformation textureInformation) override;
 
 private:
   /**
index 7676bf8..970e309 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -755,7 +755,7 @@ void ImageVisual::DoCreatePropertyMap(Property::Map& map) const
   map.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
 
   bool sync = IsSynchronousLoadingRequired();
-  map.Insert(SYNCHRONOUS_LOADING, sync);
+  map.Insert(Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING, sync);
   if(mImageUrl.IsValid())
   {
     map.Insert(Toolkit::ImageVisual::Property::URL, mImageUrl.GetUrl());
@@ -853,17 +853,17 @@ void ImageVisual::UploadCompleted()
 }
 
 // From Texture Manager
-void ImageVisual::UploadComplete(bool loadingSuccess, int32_t textureId, TextureSet textureSet, bool usingAtlas, const Vector4& atlasRectangle, bool preMultiplied)
+void ImageVisual::LoadComplete(bool loadingSuccess, TextureInformation textureInformation)
 {
   Toolkit::Visual::ResourceStatus resourceStatus;
   if(mImpl->mRenderer)
   {
-    if(usingAtlas)
+    if(textureInformation.useAtlasing)
     {
       mImpl->mRenderer.RegisterProperty(ATLAS_RECT_UNIFORM_NAME, mAtlasRect);
     }
 
-    EnablePreMultipliedAlpha(preMultiplied);
+    EnablePreMultipliedAlpha(textureInformation.preMultiplied);
 
     Actor actor = mPlacementActor.GetHandle();
     if(!loadingSuccess)
@@ -874,14 +874,14 @@ void ImageVisual::UploadComplete(bool loadingSuccess, int32_t textureId, Texture
         imageSize = actor.GetProperty(Actor::Property::SIZE).Get<Vector2>();
       }
       mFactoryCache.UpdateBrokenImageRenderer(mImpl->mRenderer, imageSize);
-      textureSet = mImpl->mRenderer.GetTextures();
+      textureInformation.textureSet = mImpl->mRenderer.GetTextures();
     }
     else
     {
       Sampler sampler = Sampler::New();
       sampler.SetWrapMode(mWrapModeU, mWrapModeV);
-      textureSet.SetSampler(0u, sampler);
-      mImpl->mRenderer.SetTextures(textureSet);
+      textureInformation.textureSet.SetSampler(0u, sampler);
+      mImpl->mRenderer.SetTextures(textureInformation.textureSet);
     }
 
     if(actor)
@@ -895,7 +895,7 @@ void ImageVisual::UploadComplete(bool loadingSuccess, int32_t textureId, Texture
   // Storing TextureSet needed when renderer staged.
   if(!mImpl->mRenderer)
   {
-    mTextures = textureSet;
+    mTextures = textureInformation.textureSet;
   }
 
   // Image loaded, set status regardless of staged status.
index 55fb59b..bc94ffb 100644 (file)
@@ -248,25 +248,15 @@ public:
   void UploadCompleted() override;
 
   /**
-   * @copydoc TextureUploadObserver::UploadCompleted
+   * @copydoc TextureUploadObserver::LoadCompleted
    *
    * To avoid rendering garbage pixels, renderer should be added to actor after the resources are ready.
    * This callback is the place to add the renderer as it would be called once the loading is finished.
    */
-  void UploadComplete(bool success, int32_t textureId, TextureSet textureSet, bool usingAtlas, const Vector4& atlasRectangle, bool preMultiplied) override;
+  void LoadComplete(bool success, TextureInformation textureInformation) override;
 
 private:
   /**
-   * @copydoc TextureUploadObserver::LoadComplete
-   *
-   * To avoid rendering garbage pixels, renderer should be added to actor after the resources are ready.
-   * This callback is the place to add the renderer as it would be called once the PixelBuffer loading is finished.
-   */
-  void LoadComplete(bool loadSuccess, Devel::PixelBuffer pixelBuffer, const VisualUrl& url, bool preMultiplied) override
-  {
-  }
-
-  /**
    * Allocate the mask data when a masking property is defined in the property map
    */
   void AllocateMaskData();
index cb144b8..e8a6042 100644 (file)
@@ -224,11 +224,11 @@ void NPatchData::SetLoadedNPatchData(Devel::PixelBuffer& pixelBuffer, bool preMu
   mLoadingState = LoadingState::LOAD_COMPLETE;
 }
 
-void NPatchData::LoadComplete(bool loadSuccess, Devel::PixelBuffer pixelBuffer, const VisualUrl& url, bool preMultiplied)
+void NPatchData::LoadComplete(bool loadSuccess, TextureInformation textureInformation)
 {
   if(loadSuccess)
   {
-    SetLoadedNPatchData(pixelBuffer, preMultiplied);
+    SetLoadedNPatchData(textureInformation.pixelBuffer, textureInformation.preMultiplied);
   }
   else
   {
@@ -238,7 +238,7 @@ void NPatchData::LoadComplete(bool loadSuccess, Devel::PixelBuffer pixelBuffer,
   for(uint32_t index = 0; index < mObserverList.Count(); ++index)
   {
     TextureUploadObserver* observer = mObserverList[index];
-    observer->UploadComplete(loadSuccess, TextureManager::INVALID_TEXTURE_ID, mTextureSet, false, Vector4(), preMultiplied);
+    observer->LoadComplete(loadSuccess, TextureUploadObserver::TextureInformation(TextureUploadObserver::ReturnType::TEXTURE, TextureManager::INVALID_TEXTURE_ID, mTextureSet, false, Vector4(), textureInformation.preMultiplied));
   }
 }
 
index 7a052c4..94d7f2b 100644 (file)
@@ -253,22 +253,12 @@ public:
 
 private:
   /**
-   * @copydoc TextureUploadObserver::UploadCompleted
-   *
-   * To avoid rendering garbage pixels, renderer should be added to actor after the resources are ready.
-   * This callback is the place to add the renderer as it would be called once the loading is finished.
-   */
-  void UploadComplete(bool loadSuccess, int32_t textureId, TextureSet textureSet, bool useAtlasing, const Vector4& atlasRect, bool preMultiplied) override
-  {
-  }
-
-  /**
    * @copydoc TextureUploadObserver::LoadComplete
    *
    * To avoid rendering garbage pixels, renderer should be added to actor after the resources are ready.
    * This callback is the place to add the renderer as it would be called once the loading is finished.
    */
-  void LoadComplete(bool loadSuccess, Devel::PixelBuffer pixelBuffer, const VisualUrl& url, bool preMultiplied) override;
+  void LoadComplete(bool loadSuccess, TextureInformation textureInformation) override;
 
 private:
   using ObserverListType = Dali::Vector<TextureUploadObserver*>;
index 1f48eca..4325dea 100644 (file)
@@ -29,6 +29,7 @@
 #include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
 #include <dali-toolkit/internal/visuals/image-visual-shader-factory.h>
 #include <dali-toolkit/internal/visuals/npatch-loader.h>
+#include <dali-toolkit/devel-api/utility/npatch-helper.h>
 #include <dali-toolkit/internal/visuals/rendering-addon.h>
 #include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
@@ -43,91 +44,6 @@ namespace Toolkit
 {
 namespace Internal
 {
-namespace
-{
-/**
- * @brief Creates the geometry formed from the vertices and indices
- *
- * @param[in]  vertices             The vertices to generate the geometry from
- * @param[in]  indices              The indices to generate the geometry from
- * @return The geometry formed from the vertices and indices
- */
-Geometry GenerateGeometry(const Vector<Vector2>& vertices, const Vector<unsigned short>& indices)
-{
-  Property::Map vertexFormat;
-  vertexFormat["aPosition"] = Property::VECTOR2;
-  VertexBuffer vertexBuffer = VertexBuffer::New(vertexFormat);
-  if(vertices.Size() > 0)
-  {
-    vertexBuffer.SetData(&vertices[0], vertices.Size());
-  }
-
-  // Create the geometry object
-  Geometry geometry = Geometry::New();
-  geometry.AddVertexBuffer(vertexBuffer);
-  if(indices.Size() > 0)
-  {
-    geometry.SetIndexBuffer(&indices[0], indices.Size());
-  }
-
-  return geometry;
-}
-
-/**
- * @brief Adds the indices to form a quad composed off two triangles where the indices are organised in a grid
- *
- * @param[out] indices     The indices to add to
- * @param[in]  rowIdx      The row index to start the quad
- * @param[in]  nextRowIdx  The index to the next row
- */
-void AddQuadIndices(Vector<unsigned short>& indices, unsigned int rowIdx, unsigned int nextRowIdx)
-{
-  indices.PushBack(rowIdx);
-  indices.PushBack(nextRowIdx + 1);
-  indices.PushBack(rowIdx + 1);
-
-  indices.PushBack(rowIdx);
-  indices.PushBack(nextRowIdx);
-  indices.PushBack(nextRowIdx + 1);
-}
-
-void AddVertex(Vector<Vector2>& vertices, unsigned int x, unsigned int y)
-{
-  vertices.PushBack(Vector2(x, y));
-}
-
-void RegisterStretchProperties(Renderer& renderer, const char* uniformName, const NPatchUtility::StretchRanges& stretchPixels, uint16_t imageExtent)
-{
-  uint16_t     prevEnd     = 0;
-  uint16_t     prevFix     = 0;
-  uint16_t     prevStretch = 0;
-  unsigned int i           = 1;
-  for(NPatchUtility::StretchRanges::ConstIterator it = stretchPixels.Begin(); it != stretchPixels.End(); ++it, ++i)
-  {
-    uint16_t start = it->GetX();
-    uint16_t end   = it->GetY();
-
-    uint16_t fix     = prevFix + start - prevEnd;
-    uint16_t stretch = prevStretch + end - start;
-
-    std::stringstream uniform;
-    uniform << uniformName << "[" << i << "]";
-    renderer.RegisterProperty(uniform.str(), Vector2(fix, stretch));
-
-    prevEnd     = end;
-    prevFix     = fix;
-    prevStretch = stretch;
-  }
-
-  {
-    prevFix += imageExtent - prevEnd;
-    std::stringstream uniform;
-    uniform << uniformName << "[" << i << "]";
-    renderer.RegisterProperty(uniform.str(), Vector2(prevFix, prevStretch));
-  }
-}
-
-} //unnamed namespace
 
 /////////////////NPatchVisual////////////////
 
@@ -421,12 +337,12 @@ Geometry NPatchVisual::CreateGeometry()
       Uint16Pair gridSize(2 * data->GetStretchPixelsX().Size() + 1, 2 * data->GetStretchPixelsY().Size() + 1);
       if(!data->GetRenderingMap())
       {
-        geometry = !mBorderOnly ? CreateGridGeometry(gridSize) : CreateBorderGeometry(gridSize);
+        geometry = !mBorderOnly ?  NPatchHelper::CreateGridGeometry(gridSize) :  NPatchHelper::CreateBorderGeometry(gridSize);
       }
       else
       {
         uint32_t elementCount[2];
-        geometry = !mBorderOnly ? RenderingAddOn::Get().CreateGeometryGrid(data->GetRenderingMap(), gridSize, elementCount) : CreateBorderGeometry(gridSize);
+        geometry = !mBorderOnly ? RenderingAddOn::Get().CreateGeometryGrid(data->GetRenderingMap(), gridSize, elementCount) :  NPatchHelper::CreateBorderGeometry(gridSize);
         if(mImpl->mRenderer)
         {
           RenderingAddOn::Get().SubmitRenderTask(mImpl->mRenderer, data->GetRenderingMap());
@@ -530,29 +446,7 @@ void NPatchVisual::ApplyTextureAndUniforms()
   if(mLoader.GetNPatchData(mId, data) && data->GetLoadingState() == NPatchData::LoadingState::LOAD_COMPLETE)
   {
     textureSet = data->GetTextures();
-
-    if(data->GetStretchPixelsX().Size() == 1 && data->GetStretchPixelsY().Size() == 1)
-    {
-      //special case for 9 patch
-      Uint16Pair stretchX = data->GetStretchPixelsX()[0];
-      Uint16Pair stretchY = data->GetStretchPixelsY()[0];
-
-      uint16_t stretchWidth  = (stretchX.GetY() >= stretchX.GetX()) ? stretchX.GetY() - stretchX.GetX() : 0;
-      uint16_t stretchHeight = (stretchY.GetY() >= stretchY.GetX()) ? stretchY.GetY() - stretchY.GetX() : 0;
-
-      mImpl->mRenderer.RegisterProperty("uFixed[0]", Vector2::ZERO);
-      mImpl->mRenderer.RegisterProperty("uFixed[1]", Vector2(stretchX.GetX(), stretchY.GetX()));
-      mImpl->mRenderer.RegisterProperty("uFixed[2]", Vector2(data->GetCroppedWidth() - stretchWidth, data->GetCroppedHeight() - stretchHeight));
-      mImpl->mRenderer.RegisterProperty("uStretchTotal", Vector2(stretchWidth, stretchHeight));
-    }
-    else
-    {
-      mImpl->mRenderer.RegisterProperty("uNinePatchFactorsX[0]", Vector2::ZERO);
-      mImpl->mRenderer.RegisterProperty("uNinePatchFactorsY[0]", Vector2::ZERO);
-
-      RegisterStretchProperties(mImpl->mRenderer, "uNinePatchFactorsX", data->GetStretchPixelsX(), data->GetCroppedWidth());
-      RegisterStretchProperties(mImpl->mRenderer, "uNinePatchFactorsY", data->GetStretchPixelsY(), data->GetCroppedHeight());
-    }
+    NPatchHelper::ApplyTextureAndUniforms(mImpl->mRenderer, data);
   }
   else
   {
@@ -611,148 +505,17 @@ Geometry NPatchVisual::GetNinePatchGeometry(VisualFactoryCache::GeometryType sub
   {
     if(DALI_LIKELY(VisualFactoryCache::NINE_PATCH_GEOMETRY == subType))
     {
-      geometry = CreateGridGeometry(Uint16Pair(3, 3));
+      geometry = NPatchHelper::CreateGridGeometry(Uint16Pair(3, 3));
     }
     else if(VisualFactoryCache::NINE_PATCH_BORDER_GEOMETRY == subType)
     {
-      geometry = CreateBorderGeometry(Uint16Pair(3, 3));
+      geometry = NPatchHelper::CreateBorderGeometry(Uint16Pair(3, 3));
     }
     mFactoryCache.SaveGeometry(subType, geometry);
   }
   return geometry;
 }
 
-Geometry NPatchVisual::CreateGridGeometry(Uint16Pair gridSize)
-{
-  uint16_t gridWidth  = gridSize.GetWidth();
-  uint16_t gridHeight = gridSize.GetHeight();
-
-  // Create vertices
-  Vector<Vector2> vertices;
-  vertices.Reserve((gridWidth + 1) * (gridHeight + 1));
-
-  for(int y = 0; y < gridHeight + 1; ++y)
-  {
-    for(int x = 0; x < gridWidth + 1; ++x)
-    {
-      AddVertex(vertices, x, y);
-    }
-  }
-
-  // Create indices
-  Vector<unsigned short> indices;
-  indices.Reserve(gridWidth * gridHeight * 6);
-
-  unsigned int rowIdx     = 0;
-  unsigned int nextRowIdx = gridWidth + 1;
-  for(int y = 0; y < gridHeight; ++y, ++nextRowIdx, ++rowIdx)
-  {
-    for(int x = 0; x < gridWidth; ++x, ++nextRowIdx, ++rowIdx)
-    {
-      AddQuadIndices(indices, rowIdx, nextRowIdx);
-    }
-  }
-
-  return GenerateGeometry(vertices, indices);
-}
-
-Geometry NPatchVisual::CreateBorderGeometry(Uint16Pair gridSize)
-{
-  uint16_t gridWidth  = gridSize.GetWidth();
-  uint16_t gridHeight = gridSize.GetHeight();
-
-  // Create vertices
-  Vector<Vector2> vertices;
-  vertices.Reserve((gridWidth + 1) * (gridHeight + 1));
-
-  //top
-  int y = 0;
-  for(; y < 2; ++y)
-  {
-    for(int x = 0; x < gridWidth + 1; ++x)
-    {
-      AddVertex(vertices, x, y);
-    }
-  }
-
-  for(; y < gridHeight - 1; ++y)
-  {
-    //left
-    AddVertex(vertices, 0, y);
-    AddVertex(vertices, 1, y);
-
-    //right
-    AddVertex(vertices, gridWidth - 1, y);
-    AddVertex(vertices, gridWidth, y);
-  }
-
-  //bottom
-  for(; y < gridHeight + 1; ++y)
-  {
-    for(int x = 0; x < gridWidth + 1; ++x)
-    {
-      AddVertex(vertices, x, y);
-    }
-  }
-
-  // Create indices
-  Vector<unsigned short> indices;
-  indices.Reserve(gridWidth * gridHeight * 6);
-
-  //top
-  unsigned int rowIdx     = 0;
-  unsigned int nextRowIdx = gridWidth + 1;
-  for(int x = 0; x < gridWidth; ++x, ++nextRowIdx, ++rowIdx)
-  {
-    AddQuadIndices(indices, rowIdx, nextRowIdx);
-  }
-
-  if(gridHeight > 2)
-  {
-    rowIdx     = gridWidth + 1;
-    nextRowIdx = (gridWidth + 1) * 2;
-
-    unsigned increment = gridWidth - 1;
-    if(gridHeight > 3)
-    {
-      increment = 2;
-      //second row left
-      AddQuadIndices(indices, rowIdx, nextRowIdx);
-
-      rowIdx     = gridWidth * 2;
-      nextRowIdx = (gridWidth + 1) * 2 + 2;
-      //second row right
-      AddQuadIndices(indices, rowIdx, nextRowIdx);
-
-      //left and right
-      rowIdx     = nextRowIdx - 2;
-      nextRowIdx = rowIdx + 4;
-      for(int y = 2; y < 2 * (gridHeight - 3); ++y, rowIdx += 2, nextRowIdx += 2)
-      {
-        AddQuadIndices(indices, rowIdx, nextRowIdx);
-      }
-    }
-
-    //second row left
-    AddQuadIndices(indices, rowIdx, nextRowIdx);
-
-    rowIdx += increment;
-    nextRowIdx += gridWidth - 1;
-    //second row right
-    AddQuadIndices(indices, rowIdx, nextRowIdx);
-  }
-
-  //bottom
-  rowIdx     = nextRowIdx - gridWidth + 1;
-  nextRowIdx = rowIdx + gridWidth + 1;
-  for(int x = 0; x < gridWidth; ++x, ++nextRowIdx, ++rowIdx)
-  {
-    AddQuadIndices(indices, rowIdx, nextRowIdx);
-  }
-
-  return GenerateGeometry(vertices, indices);
-}
-
 void NPatchVisual::SetResource()
 {
   const NPatchData* data;
@@ -777,32 +540,34 @@ void NPatchVisual::SetResource()
   }
 }
 
-void NPatchVisual::UploadComplete(bool loadSuccess, int32_t textureId, TextureSet textureSet, bool useAtlasing, const Vector4& atlasRect, bool preMultiplied)
+void NPatchVisual::LoadComplete(bool loadSuccess, TextureInformation textureInformation)
 {
-  EnablePreMultipliedAlpha(preMultiplied);
-  if(!loadSuccess)
-  {
-    // Image loaded and ready to display
-    ResourceReady(Toolkit::Visual::ResourceStatus::FAILED);
-  }
-
-  if(mAuxiliaryPixelBuffer || !mAuxiliaryUrl.IsValid())
+  if(textureInformation.returnType == TextureUploadObserver::ReturnType::TEXTURE)
   {
-    SetResource();
-  }
-}
+    EnablePreMultipliedAlpha(textureInformation.preMultiplied);
+    if(!loadSuccess)
+    {
+      // Image loaded and ready to display
+      ResourceReady(Toolkit::Visual::ResourceStatus::FAILED);
+    }
 
-void NPatchVisual::LoadComplete(bool loadSuccess, Devel::PixelBuffer pixelBuffer, const VisualUrl& url, bool preMultiplied)
-{
-  if(loadSuccess && url.GetUrl() == mAuxiliaryUrl.GetUrl())
-  {
-    mAuxiliaryPixelBuffer = pixelBuffer;
-    SetResource();
+    if(mAuxiliaryPixelBuffer || !mAuxiliaryUrl.IsValid())
+    {
+      SetResource();
+    }
   }
-  else
+  else  // for the ReturnType::PIXEL_BUFFER
   {
-    // Image loaded and ready to display
-    ResourceReady(Toolkit::Visual::ResourceStatus::FAILED);
+    if(loadSuccess && textureInformation.url == mAuxiliaryUrl.GetUrl())
+    {
+      mAuxiliaryPixelBuffer = textureInformation.pixelBuffer;
+      SetResource();
+    }
+    else
+    {
+      // Image loaded and ready to display
+      ResourceReady(Toolkit::Visual::ResourceStatus::FAILED);
+    }
   }
 }
 
index 02db5a4..a266edc 100644 (file)
@@ -207,20 +207,12 @@ private:
 
 private:
   /**
-   * @copydoc TextureUploadObserver::UploadCompleted
+   * @copydoc TextureUploadObserver::LoadCompleted
    *
    * To avoid rendering garbage pixels, renderer should be added to actor after the resources are ready.
    * This callback is the place to add the renderer as it would be called once the loading is finished.
    */
-  void UploadComplete(bool loadSuccess, int32_t textureId, TextureSet textureSet, bool useAtlasing, const Vector4& atlasRect, bool preMultiplied) override;
-
-  /**
-   * @copydoc TextureUploadObserver::LoadComplete
-   *
-   * To avoid rendering garbage pixels, renderer should be added to actor after the resources are ready.
-   * This callback is the place to add the renderer as it would be called once the loading is finished.
-   */
-  void LoadComplete(bool loadSuccess, Devel::PixelBuffer pixelBuffer, const VisualUrl& url, bool preMultiplied) override;
+  void LoadComplete(bool loadSuccess, TextureInformation textureInformation) override;
 
 private:
   WeakHandle<Actor>                         mPlacementActor; ///< Weakhandle to contain Actor during texture loading
index 49867c4..3578ede 100644 (file)
@@ -179,7 +179,7 @@ TextureSet TextureManager::LoadAnimatedImageTexture(
     TextureManager::LoadState loadState = GetTextureStateInternal(textureId);
     if(loadState == TextureManager::LoadState::UPLOADED)
     {
-      // UploadComplete has already been called - keep the same texture set
+      // LoadComplete has already been called - keep the same texture set
       textureSet = GetTextureSet(textureId);
     }
   }
@@ -330,7 +330,7 @@ TextureSet TextureManager::LoadTexture(
         TextureManager::LoadState loadState = GetTextureStateInternal(textureId);
         if(loadState == TextureManager::LoadState::UPLOADED)
         {
-          // UploadComplete has already been called - keep the same texture set
+          // LoadComplete has already been called - keep the same texture set
           textureSet = GetTextureSet(textureId);
         }
 
@@ -978,7 +978,7 @@ void TextureManager::LoadOrQueueTexture(TextureInfo& textureInfo, TextureUploadO
       {
         // The Texture has already loaded. The other observers have already been notified.
         // We need to send a "late" loaded notification for this observer.
-        observer->UploadComplete(true, textureInfo.textureId, textureInfo.textureSet, textureInfo.useAtlas, textureInfo.atlasRect, textureInfo.preMultiplied);
+        observer->LoadComplete(true, TextureUploadObserver::TextureInformation(TextureUploadObserver::ReturnType::TEXTURE, textureInfo.textureId, textureInfo.textureSet, textureInfo.useAtlas, textureInfo.atlasRect, textureInfo.preMultiplied));
       }
       break;
     }
@@ -1040,11 +1040,11 @@ void TextureManager::ProcessQueuedTextures()
       TextureInfo& textureInfo(mTextureInfoContainer[cacheIndex]);
       if(textureInfo.loadState == LoadState::UPLOADED)
       {
-        element.mObserver->UploadComplete(true, textureInfo.textureId, textureInfo.textureSet, textureInfo.useAtlas, textureInfo.atlasRect, textureInfo.preMultiplied);
+        element.mObserver->LoadComplete(true, TextureUploadObserver::TextureInformation(TextureUploadObserver::ReturnType::TEXTURE, textureInfo.textureId, textureInfo.textureSet, textureInfo.useAtlas, textureInfo.atlasRect, textureInfo.preMultiplied));
       }
       else if(textureInfo.loadState == LoadState::LOAD_FINISHED && textureInfo.storageType == StorageType::RETURN_PIXEL_BUFFER)
       {
-        element.mObserver->LoadComplete(true, textureInfo.pixelBuffer, textureInfo.url, textureInfo.preMultiplied);
+        element.mObserver->LoadComplete(true, TextureUploadObserver::TextureInformation(TextureUploadObserver::ReturnType::PIXEL_BUFFER, textureInfo.pixelBuffer, textureInfo.url.GetUrl(), textureInfo.preMultiplied));
       }
       else
       {
@@ -1266,7 +1266,7 @@ void TextureManager::NotifyObservers(TextureInfo& textureInfo, bool success)
   {
     TextureUploadObserver* observer = info->observerList[0];
 
-    // During UploadComplete() a Control ResourceReady() signal is emitted.
+    // During LoadComplete() a Control ResourceReady() signal is emitted.
     // During that signal the app may add remove /add Textures (e.g. via
     // ImageViews).
     // It is possible for observers to be removed from the observer list,
@@ -1284,11 +1284,11 @@ void TextureManager::NotifyObservers(TextureInfo& textureInfo, bool success)
 
     if(info->storageType == StorageType::RETURN_PIXEL_BUFFER)
     {
-      observer->LoadComplete(success, info->pixelBuffer, info->url, info->preMultiplied);
+      observer->LoadComplete(success, TextureUploadObserver::TextureInformation(TextureUploadObserver::ReturnType::PIXEL_BUFFER, info->pixelBuffer, info->url.GetUrl(), info->preMultiplied));
     }
     else
     {
-      observer->UploadComplete(success, info->textureId, info->textureSet, info->useAtlas, info->atlasRect, info->preMultiplied);
+      observer->LoadComplete(success, TextureUploadObserver::TextureInformation(TextureUploadObserver::ReturnType::TEXTURE, info->textureId, info->textureSet, info->useAtlas, info->atlasRect, info->preMultiplied));
     }
 
     // Get the textureInfo from the container again as it may have been invalidated.
index 7730d28..7ca7a05 100644 (file)
@@ -219,7 +219,7 @@ public:
    * @brief Requests an image load of the given URL.
    *
    * The parameters are used to specify how the image is loaded.
-   * The observer has the UploadComplete method called when the load is ready.
+   * The observer has the LoadComplete method called when the load is ready.
    *
    * When the client has finished with the Texture, Remove() should be called.
    *
@@ -276,7 +276,7 @@ public:
    * @brief Requests an image load of the given URL.
    *
    * The parameters are used to specify how the image is loaded.
-   * The observer has the UploadComplete method called when the load is ready.
+   * The observer has the LoadComplete method called when the load is ready.
    *
    * When the client has finished with the Texture, Remove() should be called.
    *
@@ -311,7 +311,7 @@ public:
    * the blended texture.
    *
    * The parameters are used to specify how the image is loaded.
-   * The observer has the UploadComplete method called when the load is ready.
+   * The observer has the LoadComplete method called when the load is ready.
    *
    * When the client has finished with the Texture, Remove() should be called.
    *
@@ -469,7 +469,7 @@ private:
    * CPU blend with the mask, and upload the blend texture.
    *
    * The parameters are used to specify how the image is loaded.
-   * The observer has the UploadComplete method called when the load is ready.
+   * The observer has the LoadComplete method called when the load is ready.
    *
    * When the client has finished with the Texture, Remove() should be called.
    *
@@ -752,12 +752,6 @@ private:
   bool CreateTiledGeometry(const Devel::PixelBuffer& pixelBuffer, TextureInfo& textureInfo);
 
   /**
-   * Mark the texture as complete, and inform observers
-   * @param[in] textureInfo The struct associated with this Texture
-   */
-  void UploadComplete(TextureInfo& textureInfo);
-
-  /**
    * Notify the current observers that the texture upload is complete,
    * then remove the observers from the list.
    * @param[in] textureInfo The struct associated with this Texture
index 5c46ff2..6e18175 100644 (file)
 // CLASS HEADER
 #include "texture-upload-observer.h"
 
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/visuals/texture-manager-impl.h>
+
 namespace Dali
 {
 namespace Toolkit
 {
+TextureUploadObserver::TextureInformation::TextureInformation(ReturnType returnType, int32_t textureId, TextureSet textureSet, bool useAtlasing, const Vector4& atlasRect, bool preMultiplied)
+: returnType(returnType),
+  textureId(textureId),
+  textureSet(textureSet),
+  useAtlasing(useAtlasing),
+  atlasRect(atlasRect),
+  preMultiplied(preMultiplied),
+  pixelBuffer(),
+  url()
+{
+}
+
+TextureUploadObserver::TextureInformation::TextureInformation(ReturnType returnType, Devel::PixelBuffer pixelBuffer, const std::string& url, bool preMultiplied)
+: returnType(returnType),
+  textureId(Internal::TextureManager::INVALID_TEXTURE_ID),
+  textureSet(),
+  useAtlasing(false),
+  atlasRect(Vector4::ZERO),
+  preMultiplied(preMultiplied),
+  pixelBuffer(pixelBuffer),
+  url(url)
+{
+}
+
 TextureUploadObserver::TextureUploadObserver()
 {
 }
index d6657a2..4bb21e8 100644 (file)
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
 #include <dali/public-api/signals/dali-signal.h>
+#include <dali/public-api/rendering/texture-set.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/visuals/visual-url.h>
 
 namespace Dali
 {
-class TextureSet;
 
 namespace Toolkit
 {
 /**
  * @brief Base class used to observe the upload status of a texture.
  *
- * Derived class must implement the UploadComplete method which is
+ * Derived class must implement the LoadComplete method which is
  * executed once the texture is ready to draw.
  */
 class TextureUploadObserver
@@ -43,6 +43,30 @@ class TextureUploadObserver
 public:
   typedef Signal<void(TextureUploadObserver*)> DestructionSignalType; ///< Signal prototype for the Destruction Signal.
 
+  enum class ReturnType
+  {
+    TEXTURE = 0,
+    PIXEL_BUFFER
+  };
+
+  struct TextureInformation
+  {
+    TextureInformation(ReturnType returnType, int32_t textureId, TextureSet textureSet, bool useAtlasing, const Vector4& atlasRect, bool preMultiplied);
+    TextureInformation(ReturnType returnType, Devel::PixelBuffer pixelBuffer, const std::string& url, bool preMultiplied);
+
+    TextureInformation();
+
+    ReturnType                 returnType;    ///< Returned Texture type.
+    int32_t                    textureId;     ///< The textureId of the loaded texture in the TextureManager
+    TextureSet                 textureSet;    ///< The TextureSet containing the Texture
+    bool                       useAtlasing;   ///< True if atlasing was used (note: this may be different to what was requested)
+    const Vector4&             atlasRect;     ///< If using atlasing, this is the rectangle within the atlas to use.
+    bool                       preMultiplied; ///< True if the image had pre-multiplied alpha applied
+    Devel::PixelBuffer         pixelBuffer;   ///< The PixelBuffer of the loaded image.
+    std::string_view           url;           ///< The url address of the loaded image.
+  };
+
+public:
   /**
    * @brief Constructor.
    */
@@ -54,28 +78,14 @@ public:
   virtual ~TextureUploadObserver();
 
   /**
-   * The action to be taken once the async load has finished and the upload to GPU is completed.
-   * This should be overridden by the deriving class.
-   *
-   * @param[in] loadSuccess True if the texture load was successful (i.e. the resource is available). If false, then the resource failed to load. In future, this will automatically upload a "broken" image.
-   * @param[in] textureId   The textureId of the loaded texture in the TextureManager
-   * @param[in] textureSet  The TextureSet containing the Texture
-   * @param[in] useAtlasing True if atlasing was used (note: this may be different to what was requested)
-   * @param[in] atlasRect   If using atlasing, this is the rectangle within the atlas to use.
-   * @param[in] preMultiplied True if the image had pre-multiplied alpha applied
-   */
-  virtual void UploadComplete(bool loadSuccess, int32_t textureId, TextureSet textureSet, bool useAtlasing, const Vector4& atlasRect, bool preMultiplied) = 0;
-
-  /**
    * The action to be taken once the async load has finished.
+   * And in case of texture loading, this method is called after uploading.
    * This should be overridden by the deriving class.
    *
-   * @param[in] loadSuccess   True if the image load was successful (i.e. the resource is available). If false, then the resource failed to load.
-   * @param[in] pixelBuffer   The PixelBuffer of the loaded image.
-   * @param[in] url           The url address of the loaded image.
-   * @param[in] preMultiplied True if the image had pre-multiplied alpha applied
+   * @param[in] loadSuccess True if the texture load was successful (i.e. the resource is available). If false, then the resource failed to load. In future, this will automatically upload a "broken" image.
+   * @param[in] textureInformation Structure that contains loaded texture information.
    */
-  virtual void LoadComplete(bool loadSuccess, Devel::PixelBuffer pixelBuffer, const Internal::VisualUrl& url, bool preMultiplied) = 0;
+  virtual void LoadComplete(bool loadSuccess, TextureInformation textureInformation) = 0;
 
   /**
    * @brief Returns the destruction signal.
index febd285..a65c779 100644 (file)
@@ -27,6 +27,7 @@
 #include <dali-toolkit/internal/visuals/image-atlas-manager.h>
 #include <dali-toolkit/internal/visuals/svg/svg-visual.h>
 #include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
+#include <dali-toolkit/devel-api/utility/npatch-helper.h>
 #include <dali/integration-api/debug.h>
 
 namespace Dali
@@ -35,73 +36,14 @@ namespace Toolkit
 {
 namespace Internal
 {
-namespace
-{
-
-/**
- * @brief Creates the geometry formed from the vertices and indices
- *
- * @param[in]  vertices             The vertices to generate the geometry from
- * @param[in]  indices              The indices to generate the geometry from
- * @return The geometry formed from the vertices and indices
- */
-Geometry GenerateGeometry(const Vector<Vector2>& vertices, const Vector<unsigned short>& indices)
-{
-  Property::Map vertexFormat;
-  vertexFormat["aPosition"] = Property::VECTOR2;
-  VertexBuffer vertexBuffer = VertexBuffer::New(vertexFormat);
-  if(vertices.Size() > 0)
-  {
-    vertexBuffer.SetData(&vertices[0], vertices.Size());
-  }
-
-  // Create the geometry object
-  Geometry geometry = Geometry::New();
-  geometry.AddVertexBuffer(vertexBuffer);
-  if(indices.Size() > 0)
-  {
-    geometry.SetIndexBuffer(&indices[0], indices.Size());
-  }
-
-  return geometry;
-}
-
-/**
- * @brief Adds the indices to form a quad composed off two triangles where the indices are organised in a grid
- *
- * @param[out] indices     The indices to add to
- * @param[in]  rowIdx      The row index to start the quad
- * @param[in]  nextRowIdx  The index to the next row
- */
-void AddQuadIndices(Vector<unsigned short>& indices, unsigned int rowIdx, unsigned int nextRowIdx)
-{
-  indices.PushBack(rowIdx);
-  indices.PushBack(nextRowIdx + 1);
-  indices.PushBack(rowIdx + 1);
-
-  indices.PushBack(rowIdx);
-  indices.PushBack(nextRowIdx);
-  indices.PushBack(nextRowIdx + 1);
-}
-
-/**
- * @brief Adds the vertices to create for npatch
- * @param[out] vertices The vertices to add to
- * @param[in]  x        The x value of vector
- * @param[in]  y        The y value of vector
- */
-void AddVertex(Vector<Vector2>& vertices, unsigned int x, unsigned int y)
-{
-  vertices.PushBack(Vector2(x, y));
-}
-
-} //unnamed namespace
 
 VisualFactoryCache::VisualFactoryCache(bool preMultiplyOnLoad)
 : mSvgRasterizeThread(NULL),
   mVectorAnimationManager(),
   mPreMultiplyOnLoad(preMultiplyOnLoad),
-  mBrokenImageInfoContainer()
+  mBrokenImageInfoContainer(),
+  mDefaultBrokenImageUrl(""),
+  mUseDefaultBrokenImageOnly(true)
 {
 }
 
@@ -168,10 +110,7 @@ ImageAtlasManagerPtr VisualFactoryCache::GetAtlasManager()
   if(!mAtlasManager)
   {
     mAtlasManager = new ImageAtlasManager();
-    if(!mBrokenImageInfoContainer.empty())
-    {
-      mAtlasManager->SetBrokenImage(mBrokenImageInfoContainer[0].url);
-    }
+    mAtlasManager->SetBrokenImage(mDefaultBrokenImageUrl);
   }
 
   return mAtlasManager;
@@ -302,14 +241,17 @@ bool VisualFactoryCache::GetPreMultiplyOnLoad()
   return mPreMultiplyOnLoad;
 }
 
-void VisualFactoryCache::SetBrokenImageUrl(const std::vector<std::string>& brokenImageUrlList)
+void VisualFactoryCache::SetBrokenImageUrl(std::string& defaultBrokenUrl, const std::vector<std::string>& brokenImageUrlList)
 {
+  mUseDefaultBrokenImageOnly = false;
   mBrokenImageInfoContainer.clear();
   mBrokenImageInfoContainer.assign(brokenImageUrlList.size(), BrokenImageInfo());
   for(unsigned int i = 0; i < brokenImageUrlList.size(); i++)
   {
     mBrokenImageInfoContainer[i].url = brokenImageUrlList[i];
   }
+
+  mDefaultBrokenImageUrl = defaultBrokenUrl;
 }
 
 VisualUrl::Type VisualFactoryCache::GetBrokenImageVisualType(int index)
@@ -317,40 +259,6 @@ VisualUrl::Type VisualFactoryCache::GetBrokenImageVisualType(int index)
   return mBrokenImageInfoContainer[index].visualType;
 }
 
-Geometry VisualFactoryCache::CreateNPatchGeometry(Uint16Pair gridSize)
-{
-  uint16_t gridWidth  = gridSize.GetWidth();
-  uint16_t gridHeight = gridSize.GetHeight();
-
-  // Create vertices
-  Vector<Vector2> vertices;
-  vertices.Reserve((gridWidth + 1) * (gridHeight + 1));
-
-  for(int y = 0; y < gridHeight + 1; ++y)
-  {
-    for(int x = 0; x < gridWidth + 1; ++x)
-    {
-      AddVertex(vertices, x, y);
-    }
-  }
-
-  // Create indices
-  Vector<unsigned short> indices;
-  indices.Reserve(gridWidth * gridHeight * 6);
-
-  unsigned int rowIdx     = 0;
-  unsigned int nextRowIdx = gridWidth + 1;
-  for(int y = 0; y < gridHeight; ++y, ++nextRowIdx, ++rowIdx)
-  {
-    for(int x = 0; x < gridWidth; ++x, ++nextRowIdx, ++rowIdx)
-    {
-      AddQuadIndices(indices, rowIdx, nextRowIdx);
-    }
-  }
-
-  return GenerateGeometry(vertices, indices);
-}
-
 Geometry VisualFactoryCache::GetNPatchGeometry(int index)
 {
   Geometry          geometry;
@@ -362,14 +270,14 @@ Geometry VisualFactoryCache::GetNPatchGeometry(int index)
       geometry = GetGeometry(VisualFactoryCache::NINE_PATCH_GEOMETRY);
       if(!geometry)
       {
-        geometry = CreateNPatchGeometry(Uint16Pair(3,3));
+        geometry = NPatchHelper::CreateGridGeometry(Uint16Pair(3,3));
         SaveGeometry(VisualFactoryCache::NINE_PATCH_GEOMETRY, geometry);
       }
     }
     else if(data->GetStretchPixelsX().Size() > 0 || data->GetStretchPixelsY().Size() > 0)
     {
       Uint16Pair gridSize(2 * data->GetStretchPixelsX().Size() + 1, 2 * data->GetStretchPixelsY().Size() + 1);
-      geometry = CreateNPatchGeometry(gridSize);
+      geometry = NPatchHelper::CreateGridGeometry(gridSize);
     }
   }
   else
@@ -378,7 +286,7 @@ Geometry VisualFactoryCache::GetNPatchGeometry(int index)
     geometry = GetGeometry(VisualFactoryCache::NINE_PATCH_GEOMETRY);
     if(!geometry)
     {
-      geometry = CreateNPatchGeometry(Uint16Pair(3,3));
+      geometry = NPatchHelper::CreateGridGeometry(Uint16Pair(3,3));
       SaveGeometry(VisualFactoryCache::NINE_PATCH_GEOMETRY, geometry);
     }
   }
@@ -401,7 +309,7 @@ Shader VisualFactoryCache::GetNPatchShader(int index)
     yStretchCount = data->GetStretchPixelsY().Count();
   }
 
-  if(DALI_LIKELY((xStretchCount == 0 && yStretchCount == 0)))
+  if(DALI_LIKELY((xStretchCount == 0 && yStretchCount == 0) || (xStretchCount == 1 && yStretchCount == 1)))
   {
     shader = GetShader(VisualFactoryCache::NINE_PATCH_SHADER);
     if(DALI_UNLIKELY(!shader))
@@ -423,37 +331,6 @@ Shader VisualFactoryCache::GetNPatchShader(int index)
   return shader;
 }
 
-void VisualFactoryCache::RegisterStretchProperties(Renderer& renderer, const char* uniformName, const NPatchUtility::StretchRanges& stretchPixels, uint16_t imageExtent)
-{
-  uint16_t     prevEnd     = 0;
-  uint16_t     prevFix     = 0;
-  uint16_t     prevStretch = 0;
-  unsigned int i           = 1;
-  for(NPatchUtility::StretchRanges::ConstIterator it = stretchPixels.Begin(); it != stretchPixels.End(); ++it, ++i)
-  {
-    uint16_t start = it->GetX();
-    uint16_t end   = it->GetY();
-
-    uint16_t fix     = prevFix + start - prevEnd;
-    uint16_t stretch = prevStretch + end - start;
-
-    std::stringstream uniform;
-    uniform << uniformName << "[" << i << "]";
-    renderer.RegisterProperty(uniform.str(), Vector2(fix, stretch));
-
-    prevEnd     = end;
-    prevFix     = fix;
-    prevStretch = stretch;
-  }
-
-  {
-    prevFix += imageExtent - prevEnd;
-    std::stringstream uniform;
-    uniform << uniformName << "[" << i << "]";
-    renderer.RegisterProperty(uniform.str(), Vector2(prevFix, prevStretch));
-  }
-}
-
 void VisualFactoryCache::ApplyTextureAndUniforms(Renderer& renderer, int index)
 {
   const NPatchData* data;
@@ -461,38 +338,23 @@ void VisualFactoryCache::ApplyTextureAndUniforms(Renderer& renderer, int index)
   if(mNPatchLoader.GetNPatchData(mBrokenImageInfoContainer[index].npatchId, data) && data->GetLoadingState() == NPatchData::LoadingState::LOAD_COMPLETE)
   {
     textureSet = data->GetTextures();
-    mBrokenImageInfoContainer[index].texture = data->GetTextures().GetTexture(0);
-
-    if(data->GetStretchPixelsX().Size() == 1 && data->GetStretchPixelsY().Size() == 1)
-    {
-      //special case for 9 patch
-      Uint16Pair stretchX = data->GetStretchPixelsX()[0];
-      Uint16Pair stretchY = data->GetStretchPixelsY()[0];
-
-      uint16_t stretchWidth  = (stretchX.GetY() >= stretchX.GetX()) ? stretchX.GetY() - stretchX.GetX() : 0;
-      uint16_t stretchHeight = (stretchY.GetY() >= stretchY.GetX()) ? stretchY.GetY() - stretchY.GetX() : 0;
-
-      renderer.RegisterProperty("uFixed[0]", Vector2::ZERO);
-      renderer.RegisterProperty("uFixed[1]", Vector2(stretchX.GetX(), stretchY.GetX()));
-      renderer.RegisterProperty("uFixed[2]", Vector2(data->GetCroppedWidth() - stretchWidth, data->GetCroppedHeight() - stretchHeight));
-      renderer.RegisterProperty("uStretchTotal", Vector2(stretchWidth, stretchHeight));
-    }
-    else
-    {
-      renderer.RegisterProperty("uNinePatchFactorsX[0]", Vector2::ZERO);
-      renderer.RegisterProperty("uNinePatchFactorsY[0]", Vector2::ZERO);
-
-      RegisterStretchProperties(renderer, "uNinePatchFactorsX", data->GetStretchPixelsX(), data->GetCroppedWidth());
-      RegisterStretchProperties(renderer, "uNinePatchFactorsY", data->GetStretchPixelsY(), data->GetCroppedHeight());
-    }
+    mBrokenImageInfoContainer[index].texture = textureSet.GetTexture(0);
+    NPatchHelper::ApplyTextureAndUniforms(renderer, data);
     renderer.SetTextures(textureSet);
   }
 }
 
 void VisualFactoryCache::UpdateBrokenImageRenderer(Renderer& renderer, const Vector2& size)
 {
+
+  bool useDefaultBrokenImage = false;
+  if(mBrokenImageInfoContainer.size() == 0)
+  {
+    useDefaultBrokenImage = true;
+  }
+
   // Load Information for broken image
-  for(uint32_t index = 0; index < mBrokenImageInfoContainer.size(); index++)
+  for(uint32_t index = 0; (index  < mBrokenImageInfoContainer.size()) && !useDefaultBrokenImage; index++)
   {
     if(mBrokenImageInfoContainer[index].width == 0 && mBrokenImageInfoContainer[index].height == 0)
     {
@@ -512,17 +374,36 @@ void VisualFactoryCache::UpdateBrokenImageRenderer(Renderer& renderer, const Vec
           }
           else
           {
-            DALI_LOG_ERROR("Can't update renderer for broken image. maybe image loading is failed [path:%s] \n",mBrokenImageInfoContainer[index].url.c_str());
+            DALI_LOG_ERROR("Can't update renderer for broken image. maybe image loading is failed [index:%d] [path:%s] \n",index, mBrokenImageInfoContainer[index].url.c_str());
+            useDefaultBrokenImage = true;
           }
         }
         else
         {
-          GetBrokenVisualImage(index);
+          if(!GetBrokenVisualImage(index))
+          {
+            DALI_LOG_ERROR("Can't update renderer for broken image. maybe image loading is failed [index:%d] [path:%s] \n",index, mBrokenImageInfoContainer[index].url.c_str());
+            useDefaultBrokenImage = true;
+          }
         }
       }
     }
   }
 
+  if(!mUseDefaultBrokenImageOnly && useDefaultBrokenImage)
+  {
+    // Clear broken info
+    mBrokenImageInfoContainer.clear();
+
+    // assign for broken image
+    const int defaultBrokenIndex = 0;
+    mBrokenImageInfoContainer.assign(1, BrokenImageInfo());
+    mBrokenImageInfoContainer[defaultBrokenIndex].url = mDefaultBrokenImageUrl;
+    VisualUrl visualUrl(mBrokenImageInfoContainer[defaultBrokenIndex].url);
+    mBrokenImageInfoContainer[defaultBrokenIndex].visualType = visualUrl.GetType();
+    mUseDefaultBrokenImageOnly = true;
+  }
+
   // Set Texutre to renderer
   int brokenIndex = GetProperBrokenImageIndex(size);
   if(GetBrokenImageVisualType(brokenIndex) == VisualUrl::N_PATCH)
@@ -547,7 +428,7 @@ int32_t VisualFactoryCache::GetProperBrokenImageIndex(const Vector2& size)
 {
   // Sets the default broken type
   int32_t returnIndex = 0;
-  if((size.width == 0 || size.height == 0))
+  if((size.width == 0 || size.height == 0) || mUseDefaultBrokenImageOnly )
   {
     // To do : Need to add observer about size
     return returnIndex;
index deae0b0..b19bad4 100644 (file)
@@ -195,7 +195,7 @@ public:
    * @brief Set an image to be used when a visual has failed to correctly render
    * @param[in] brokenImageUrlList The broken image url list
    */
-  void SetBrokenImageUrl(const std::vector<std::string>& brokenImageUrlList);
+  void SetBrokenImageUrl(std::string& defaultBrokenUrl, const std::vector<std::string>& brokenImageUrlList);
 
   /**
    * @brief Update the broken image Renderer object
@@ -272,14 +272,6 @@ private:
   void ApplyTextureAndUniforms(Renderer& renderer, int index);
 
   /**
-   * @brief Creates a Npatch Geometry object
-   *
-   * @param[in] gridSize The gridSize for creating a geometry
-   * @return The Geometry for NPatch
-   */
-  Geometry CreateNPatchGeometry(Uint16Pair gridSize);
-
-  /**
    * @brief Gets a geometry for npatch image
    *
    * @param[in] index the index of broken image
@@ -296,16 +288,6 @@ private:
   Shader GetNPatchShader(int index);
 
   /**
-   * @brief Registers a properties for Stretch Ranges
-   *
-   * @param[in,out] renderer The renderer for broken image
-   * @param[in] uniformName The name of the uniform
-   * @param[in] stretchPixels The stretchable pixels in the cropped image space
-   * @param[in] imageExtent The imageExtent
-   */
-  void RegisterStretchProperties(Renderer& renderer, const char* uniformName, const NPatchUtility::StretchRanges& stretchPixels, uint16_t imageExtent);
-
-  /**
    * @brief Returns a broken image type
    * @param[in] index BrokenImage index
    * @return The broken image type.
@@ -349,6 +331,8 @@ private:
   std::unique_ptr<VectorAnimationManager> mVectorAnimationManager;
   bool                                    mPreMultiplyOnLoad;
   std::vector<BrokenImageInfo>            mBrokenImageInfoContainer;
+  std::string                             mDefaultBrokenImageUrl;
+  bool                                    mUseDefaultBrokenImageOnly;
 };
 
 } // namespace Internal
index 112fdd3..4220b00 100644 (file)
@@ -377,20 +377,12 @@ void VisualFactory::SetBrokenImageUrl(Toolkit::StyleManager& styleManager)
   if(styleManager)
   {
     customBrokenImageUrlList = Toolkit::DevelStyleManager::GetBrokenImageUrlList(styleManager);
-    if(customBrokenImageUrlList.size() == 0)
-    {
-      Property::Map config = Toolkit::DevelStyleManager::GetConfigurations(styleManager);
-      config["brokenImageUrl"].Get(brokenImageUrl);
-      customBrokenImageUrlList.push_back(brokenImageUrl);
-    }
-    mFactoryCache->SetBrokenImageUrl(customBrokenImageUrlList);
-  }
-  else
-  {
-    // Set default image
-    customBrokenImageUrlList.push_back(brokenImageUrl);
-    mFactoryCache->SetBrokenImageUrl(customBrokenImageUrlList);
+    Property::Map config = Toolkit::DevelStyleManager::GetConfigurations(styleManager);
+    config["brokenImageUrl"].Get(brokenImageUrl);
   }
+
+  // Add default image
+  mFactoryCache->SetBrokenImageUrl(brokenImageUrl, customBrokenImageUrlList);
 }
 
 Internal::VisualFactoryCache& VisualFactory::GetFactoryCache()
index db99728..9c52f22 100644 (file)
@@ -566,7 +566,7 @@ void Control::OnPropertySet(Property::Index index, const Property::Value& proper
     }
     case Actor::Property::VISIBLE:
     {
-      if(Dali::Accessibility::IsUp())
+      if(Dali::Accessibility::IsUp() && !Self().GetProperty<bool>(Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN))
       {
         Dali::Accessibility::Accessible::Get(Self())->EmitVisible(Self().GetProperty(Actor::Property::VISIBLE).Get<bool>());
       }
index 12a4324..4223c6f 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 = 2;
+const unsigned int TOOLKIT_MICRO_VERSION = 4;
 const char* const  TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index c007a73..d67f76d 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali2-toolkit
 Summary:    Dali 3D engine Toolkit
-Version:    2.1.2
+Version:    2.1.4
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT