[Tizen] fix white space issue in hidden input 12/288912/1
authorBowon Ryu <bowon.ryu@samsung.com>
Tue, 29 Nov 2022 10:48:44 +0000 (19:48 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Fri, 24 Feb 2023 08:25:25 +0000 (17:25 +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>
dali-toolkit/devel-api/text/text-utils-devel.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
dali-toolkit/internal/text/text-controller-relayouter.cpp

index fc402bb..bd2550d 100644 (file)
@@ -1052,11 +1052,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 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 a1603e6..d27527e 100644 (file)
@@ -593,6 +593,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,
@@ -600,7 +601,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);
@@ -736,7 +738,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; // The advance is used as the width is always zero for the white spaces.
@@ -813,7 +818,7 @@ struct Engine::Impl
             tmpLineLayout.numberOfGlyphs -= numberOfGLyphsInGroup;
           }
 
-          if(isRemovedGlyphWhiteSpace)
+          if(isRemovedGlyphWhiteSpace && !hiddenInputEnabled)
           {
             tmpLineLayout.penX -= glyphMetrics.advance;
             tmpLineLayout.length -= glyphMetrics.advance;
@@ -1202,6 +1207,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.
@@ -1216,6 +1222,7 @@ struct Engine::Impl
                     float                             penY,
                     bool&                             isAutoScrollEnabled,
                     bool                              isAutoScrollMaxTextureExceeded,
+                    bool                              isHiddenInputEnabled,
                     DevelText::EllipsisPosition::Type ellipsisPosition,
                     bool                              enforceEllipsisInSingleLine)
   {
@@ -1262,7 +1269,8 @@ struct Engine::Impl
                           true,
                           ellipsisPosition,
                           enforceEllipsisInSingleLine,
-                          true);
+                          true,
+                          isHiddenInputEnabled);
 
       if(ellipsisPosition == DevelText::EllipsisPosition::START && !isMultiline)
       {
@@ -1507,6 +1515,7 @@ struct Engine::Impl
                   bool                              elideTextEnabled,
                   bool&                             isAutoScrollEnabled,
                   bool                              isAutoScrollMaxTextureExceeded,
+                  bool                              isHiddenInputEnabled,
                   DevelText::EllipsisPosition::Type ellipsisPosition)
   {
     DALI_LOG_INFO(gLogFilter, Debug::Verbose, "-->LayoutText\n");
@@ -1691,7 +1700,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);
@@ -1734,6 +1744,7 @@ struct Engine::Impl
                                 penY,
                                 isAutoScrollEnabled,
                                 isAutoScrollMaxTextureExceeded,
+                                isHiddenInputEnabled,
                                 ellipsisPosition,
                                 false);
       }
@@ -1753,6 +1764,7 @@ struct Engine::Impl
                                   penY,
                                   isAutoScrollEnabled,
                                   isAutoScrollMaxTextureExceeded,
+                                  isHiddenInputEnabled,
                                   ellipsisPosition,
                                   true);
         }
@@ -2154,6 +2166,7 @@ bool Engine::LayoutText(Parameters&                       layoutParameters,
                         bool                              elideTextEnabled,
                         bool&                             isAutoScrollEnabled,
                         bool                              isAutoScrollMaxTextureExceeded,
+                        bool                              isHiddenInputEnabled,
                         DevelText::EllipsisPosition::Type ellipsisPosition)
 {
   return mImpl->LayoutText(layoutParameters,
@@ -2161,6 +2174,7 @@ bool Engine::LayoutText(Parameters&                       layoutParameters,
                            elideTextEnabled,
                            isAutoScrollEnabled,
                            isAutoScrollMaxTextureExceeded,
+                           isHiddenInputEnabled,
                            ellipsisPosition);
 }
 
index 1e664b8..b755e14 100644 (file)
@@ -107,7 +107,8 @@ public:
    * @param[out] layoutSize The size of the text after it has been laid-out.
    * @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 auto scroll.
+   * @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);
 
   /**
index 0fabadf..70dab7b 100644 (file)
@@ -620,12 +620,19 @@ bool Controller::Relayouter::DoRelayout(Controller& controller, 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,
                                                 newLayoutSize,
                                                 elideTextEnabled,
                                                 isAutoScrollEnabled,
                                                 isAutoScrollMaxTextureExceeded,
+                                                isHiddenInputEnabled,
                                                 ellipsisPosition);
     impl.mIsAutoScrollEnabled = isAutoScrollEnabled;