Revert "Fix GetHeightForWidth for text controller" 35/299335/1
authorBowon Ryu <bowon.ryu@samsung.com>
Tue, 26 Sep 2023 06:50:32 +0000 (15:50 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Tue, 26 Sep 2023 06:56:27 +0000 (15:56 +0900)
This reverts commit da9f7b93ae00d0aa64a959549ed9da3469a49e46.

Change-Id: I9dbcb715d65c97ff40ba9746caab50ce7231c1af

dali-toolkit/internal/text/controller/text-controller-impl.h
dali-toolkit/internal/text/controller/text-controller-relayouter.cpp

index 0f910d0a0ec6d98e25a8317746a3f06ce4e8a701..97010cc8bcc3e67a028be07778354b1b40b198c1 100644 (file)
@@ -341,7 +341,6 @@ struct Controller::Impl
     mMaximumNumberOfCharacters(50u),
     mHiddenInput(NULL),
     mInputFilter(nullptr),
-    mLastHeightForWidth(0.0f, 0.0f),
     mRecalculateNaturalSize(true),
     mMarkupProcessorEnabled(false),
     mClipboardHideEnabled(true),
@@ -1025,7 +1024,6 @@ public:
   HiddenText*                  mHiddenInput;                ///< Avoid allocating this when the user does not specify hidden input mode.
   std::unique_ptr<InputFilter> mInputFilter;                ///< Avoid allocating this when the user does not specify input filter mode.
   Vector2                      mTextFitContentSize;         ///< Size of Text fit content
-  Vector2                      mLastHeightForWidth;         ///< Size of Text content from GetHeightForWidth
 
   bool               mRecalculateNaturalSize : 1;         ///< Whether the natural size needs to be recalculated.
   bool               mMarkupProcessorEnabled : 1;         ///< Whether the mark-up procesor is enabled.
index c3711f31a79a39c636b55b06d705696166015b7c..d595d00111e57354647fce6c111222515fe31bcd 100644 (file)
@@ -345,11 +345,13 @@ float Controller::Relayouter::GetHeightForWidth(Controller& controller, float wi
   EventHandler::ProcessModifyEvents(controller);
 
   Controller::Impl& impl           = *controller.mImpl;
+  ModelPtr&         model          = impl.mModel;
+  VisualModelPtr&   visualModel    = model->mVisualModel;
   TextUpdateInfo&   textUpdateInfo = impl.mTextUpdateInfo;
 
   Size layoutSize;
 
-  if(fabsf(width - impl.mLastHeightForWidth.width) > Math::MACHINE_EPSILON_1000 ||
+  if(fabsf(width - visualModel->mControlSize.width) > Math::MACHINE_EPSILON_1000 ||
      textUpdateInfo.mFullRelayoutNeeded ||
      textUpdateInfo.mClearAll)
   {
@@ -358,14 +360,12 @@ float Controller::Relayouter::GetHeightForWidth(Controller& controller, float wi
     Size           sizeRequestedWidthAndMaxHeight = Size(width, MAX_FLOAT);
 
     layoutSize = CalculateLayoutSizeOnRequiredControllerSize(controller, sizeRequestedWidthAndMaxHeight, requestedOperationsMask);
-    impl.mLastHeightForWidth.width  = width;
-    impl.mLastHeightForWidth.height = layoutSize.height;
 
     DALI_LOG_INFO(gLogFilter, Debug::Verbose, "<--Controller::GetHeightForWidth calculated %f\n", layoutSize.height);
   }
   else
   {
-    layoutSize = impl.mLastHeightForWidth;
+    layoutSize = visualModel->GetLayoutSize();
     DALI_LOG_INFO(gLogFilter, Debug::Verbose, "<--Controller::GetHeightForWidth cached %f\n", layoutSize.height);
   }