fix white space issue in hidden input 63/284863/3
authorBowon Ryu <bowon.ryu@samsung.com>
Tue, 29 Nov 2022 10:48:44 +0000 (19:48 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Wed, 30 Nov 2022 05:00:53 +0000 (14:00 +0900)
The calculated text size is used in atlas renderer.
When the text is all white space, partial render issue occurs because the width is 0.
To avoid issue, do not remove the white space size in hidden input mode.

Change-Id: Id92becdb0103fa6dee20c5cd272ee3d4314121c6
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-CharacterSpacing.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp
dali-toolkit/devel-api/text/text-utils-devel.cpp
dali-toolkit/internal/text/controller/text-controller-relayouter.cpp
dali-toolkit/internal/text/hidden-text.cpp
dali-toolkit/internal/text/hidden-text.h
dali-toolkit/internal/text/layouts/layout-engine.cpp
dali-toolkit/internal/text/layouts/layout-engine.h

index 5fc9349..046f997 100644 (file)
@@ -353,11 +353,13 @@ void CreateTextModel(const std::string&                text,
 
   bool isAutoScroll                   = false;
   bool isAutoScrollMaxTextureExceeded = false;
+  bool isHiddenInputEnabled           = false;
   layoutEngine.LayoutText(layoutParameters,
                           layoutSize,
                           false,
                           isAutoScroll,
                           isAutoScrollMaxTextureExceeded,
+                          isHiddenInputEnabled,
                           ellipsisPosition);
 
   if(options.align)
index 5a15b09..8e84bc4 100644 (file)
@@ -182,11 +182,13 @@ bool LayoutTextTest(const LayoutTextData& data)
 
   bool       isAutoScroll                   = false;
   bool       isAutoScrollMaxTextureExceeded = false;
+  bool       isHiddenInputEnabled           = false;
   const bool updated                        = engine.LayoutText(layoutParameters,
                                          layoutSize,
                                          data.ellipsis,
                                          isAutoScroll,
                                          isAutoScrollMaxTextureExceeded,
+                                         isHiddenInputEnabled,
                                          DevelText::EllipsisPosition::END);
 
   // 4) Compare the results.
index 6ec3bfe..9792612 100644 (file)
@@ -182,11 +182,13 @@ bool LayoutTextTest(const LayoutTextData& data)
 
   bool       isAutoScroll                   = false;
   bool       isAutoScrollMaxTextureExceeded = false;
+  bool       isHiddenInputEnabled           = false;
   const bool updated                        = engine.LayoutText(layoutParameters,
                                          layoutSize,
                                          data.ellipsis,
                                          isAutoScroll,
                                          isAutoScrollMaxTextureExceeded,
+                                         isHiddenInputEnabled,
                                          data.ellipsisPosition);
 
   // 4) Compare the results.
index 401b82f..07c89ff 100644 (file)
@@ -1067,12 +1067,14 @@ Size LayoutText(const RendererParameters& textParameters, TextAbstraction::TextR
   Size newLayoutSize;
   bool isAutoScrollEnabled            = false;
   bool isAutoScrollMaxTextureExceeded = false;
+  bool isHiddenInputEnabled           = false;
 
   layoutEngine.LayoutText(layoutParameters,
                           newLayoutSize,
                           textParameters.ellipsisEnabled,
                           isAutoScrollEnabled,
                           isAutoScrollMaxTextureExceeded,
+                          isHiddenInputEnabled,
                           ellipsisPosition);
 
   return newLayoutSize;
index f95019a..48df46e 100644 (file)
@@ -641,6 +641,11 @@ bool Controller::Relayouter::DoRelayout(Controller::Impl& impl, const Size& size
     // Update the visual model.
     bool isAutoScrollEnabled            = impl.mIsAutoScrollEnabled;
     bool isAutoScrollMaxTextureExceeded = impl.mIsAutoScrollMaxTextureExceeded;
+    bool isHiddenInputEnabled           = false;
+    if(impl.mHiddenInput && impl.mEventData != nullptr && impl.mHiddenInput->GetHideMode() != Toolkit::HiddenInput::Mode::HIDE_NONE)
+    {
+      isHiddenInputEnabled = true;
+    }
 
     Size newLayoutSize;
     viewUpdated               = impl.mLayoutEngine.LayoutText(layoutParameters,
@@ -648,6 +653,7 @@ bool Controller::Relayouter::DoRelayout(Controller::Impl& impl, const Size& size
                                                 elideTextEnabled,
                                                 isAutoScrollEnabled,
                                                 isAutoScrollMaxTextureExceeded,
+                                                isHiddenInputEnabled,
                                                 ellipsisPosition);
     impl.mIsAutoScrollEnabled = isAutoScrollEnabled;
 
index 5259350..4f0cabf 100644 (file)
@@ -190,6 +190,11 @@ void HiddenText::InitPreviousTextCount()
   mPreviousTextCount = 0u;
 }
 
+int HiddenText::GetHideMode()
+{
+  return mHideMode;
+}
+
 bool HiddenText::OnTick()
 {
   if(mObserver != NULL)
index 6dcf0c9..49d8010 100644 (file)
@@ -82,6 +82,12 @@ public: // Intended for internal use
   void InitPreviousTextCount();
 
   /**
+   * @brief Returns the hide mode of hidden text.
+   * @return The hide mode of hidden text.
+   */
+  int GetHideMode();
+
+  /**
    * @brief Invoked when the timer is expired
    */
   bool OnTick();
index 39af47c..7bbf2cc 100644 (file)
@@ -667,6 +667,7 @@ struct Engine::Impl
    * @param[out] lineLayout The line layout.
    * @param[in] completelyFill Whether to completely fill the line ( even if the last word exceeds the boundaries ).
    * @param[in] ellipsisPosition Where is the location the text elide
+   * @param[in] hiddenInputEnabled Whether the hidden input is enabled.
    */
   void GetLineLayoutForBox(const Parameters&                 parameters,
                            LayoutBidiParameters&             bidiParameters,
@@ -674,7 +675,8 @@ struct Engine::Impl
                            bool                              completelyFill,
                            DevelText::EllipsisPosition::Type ellipsisPosition,
                            bool                              enforceEllipsisInSingleLine,
-                           bool                              elideTextEnabled)
+                           bool                              elideTextEnabled,
+                           bool                              hiddenInputEnabled)
   {
     DALI_LOG_INFO(gLogFilter, Debug::Verbose, "-->GetLineLayoutForBox\n");
     DALI_LOG_INFO(gLogFilter, Debug::Verbose, "  initial glyph index : %d\n", lineLayout.glyphIndex);
@@ -826,7 +828,10 @@ struct Engine::Impl
       const float previousTmpLength                    = tmpLineLayout.length;
       const float previousTmpWhiteSpaceLengthEndOfLine = tmpLineLayout.whiteSpaceLengthEndOfLine;
 
-      if(isWhiteSpace)
+      // The calculated text size is used in atlas renderer.
+      // When the text is all white space, partial render issue occurs because the width is 0.
+      // To avoid issue, do not remove the white space size in hidden input mode.
+      if(isWhiteSpace && !hiddenInputEnabled)
       {
         // Add the length to the length of white spaces at the end of the line.
         tmpLineLayout.whiteSpaceLengthEndOfLine += glyphMetrics.advance;
@@ -907,7 +912,7 @@ struct Engine::Impl
             tmpLineLayout.numberOfGlyphs -= numberOfGLyphsInGroup;
           }
 
-          if(isRemovedGlyphWhiteSpace)
+          if(isRemovedGlyphWhiteSpace && !hiddenInputEnabled)
           {
             tmpLineLayout.penX -= glyphMetrics.advance;
             tmpLineLayout.length -= glyphMetrics.advance;
@@ -1247,6 +1252,7 @@ struct Engine::Impl
    * @param[in] penY The vertical layout position.
    * @param[in] currentParagraphDirection The current paragraph's direction.
    * @param[in,out] isAutoScrollEnabled If the isAutoScrollEnabled is true and the height of the text exceeds the boundaries of the control the text is elided and the isAutoScrollEnabled is set to false to disable the autoscroll
+   * @param[in] isHiddenInputEnabled Whether the hidden input is enabled.
    * @param[in] ellipsisPosition Where is the location the text elide
    *
    * return Whether the line is ellipsized.
@@ -1261,6 +1267,7 @@ struct Engine::Impl
                     float                             penY,
                     bool&                             isAutoScrollEnabled,
                     bool                              isAutoScrollMaxTextureExceeded,
+                    bool                              isHiddenInputEnabled,
                     DevelText::EllipsisPosition::Type ellipsisPosition,
                     bool                              enforceEllipsisInSingleLine)
   {
@@ -1310,7 +1317,8 @@ struct Engine::Impl
                           true,
                           ellipsisPosition,
                           enforceEllipsisInSingleLine,
-                          true);
+                          true,
+                          isHiddenInputEnabled);
 
       if(ellipsisPosition == DevelText::EllipsisPosition::START && !isMultiline)
       {
@@ -1608,6 +1616,7 @@ struct Engine::Impl
                   bool                              elideTextEnabled,
                   bool&                             isAutoScrollEnabled,
                   bool                              isAutoScrollMaxTextureExceeded,
+                  bool                              isHiddenInputEnabled,
                   DevelText::EllipsisPosition::Type ellipsisPosition)
   {
     DALI_LOG_INFO(gLogFilter, Debug::Verbose, "-->LayoutText\n");
@@ -1797,7 +1806,8 @@ struct Engine::Impl
                           false,
                           ellipsisPosition,
                           false,
-                          elideTextEnabled);
+                          elideTextEnabled,
+                          isHiddenInputEnabled);
 
       DALI_LOG_INFO(gLogFilter, Debug::Verbose, "           glyph index %d\n", layout.glyphIndex);
       DALI_LOG_INFO(gLogFilter, Debug::Verbose, "       character index %d\n", layout.characterIndex);
@@ -1848,6 +1858,7 @@ struct Engine::Impl
                                 penY,
                                 isAutoScrollEnabled,
                                 isAutoScrollMaxTextureExceeded,
+                                isHiddenInputEnabled,
                                 ellipsisPosition,
                                 false);
       }
@@ -1867,6 +1878,7 @@ struct Engine::Impl
                                   penY,
                                   isAutoScrollEnabled,
                                   isAutoScrollMaxTextureExceeded,
+                                  isHiddenInputEnabled,
                                   ellipsisPosition,
                                   true);
         }
@@ -2262,6 +2274,7 @@ bool Engine::LayoutText(Parameters&                       layoutParameters,
                         bool                              elideTextEnabled,
                         bool&                             isAutoScrollEnabled,
                         bool                              isAutoScrollMaxTextureExceeded,
+                        bool                              isHiddenInputEnabled,
                         DevelText::EllipsisPosition::Type ellipsisPosition)
 {
   return mImpl->LayoutText(layoutParameters,
@@ -2269,6 +2282,7 @@ bool Engine::LayoutText(Parameters&                       layoutParameters,
                            elideTextEnabled,
                            isAutoScrollEnabled,
                            isAutoScrollMaxTextureExceeded,
+                           isHiddenInputEnabled,
                            ellipsisPosition);
 }
 
index 9fa22c6..5fa41d6 100644 (file)
@@ -108,6 +108,7 @@ public:
    * @param[in] elideTextEnabled Whether the text elide is enabled.
    * @param[in,out] isAutoScrollEnabled If the isAutoScrollEnabled is true and the height of the text exceeds the boundaries of the control the text is elided and the isAutoScrollEnabled is set to false to disable the autoscroll
    * @param[in] isAutoScrollMaxTextureExceeded If isAutoScrollMaxTextureExceeded is true, enable ellipsis during auro scroll.
+   * @param[in] isHiddenInputEnabled if isHiddenInputEnabled is true, hidden input feature is enabled.
    * @param[in] ellipsisPosition The location of the text ellipsis
    *
    * @return \e true if the text has been re-laid-out. \e false means the given width is too small to layout even a single character.
@@ -117,6 +118,7 @@ public:
                   bool                              elideTextEnabled,
                   bool&                             isAutoScrollEnabled,
                   bool                              isAutoScrollMaxTextureExceeded,
+                  bool                              isHiddenInputEnabled,
                   DevelText::EllipsisPosition::Type ellipsisPosition);
 
   /**