From: Adeel Kazmi Date: Mon, 19 Nov 2018 08:15:07 +0000 (+0000) Subject: Merge "If the height is small even if scrolling is enabled, it should be elide."... X-Git-Tag: dali_1.3.51~3 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=fe706c2b9e0a2ce31c91317dd6749faecef6d92e;hp=943cc399b1f2fe70e166099cd66c635403bf9f0b Merge "If the height is small even if scrolling is enabled, it should be elide." into devel/master --- diff --git a/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.cpp b/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.cpp index ccd24b5..84df087 100755 --- a/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.cpp +++ b/automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.cpp @@ -323,11 +323,13 @@ void CreateTextModel( const std::string& text, layoutParameters.startLineIndex = 0u; layoutParameters.estimatedNumberOfLines = logicalModel->mParagraphInfo.Count(); + bool isAutoScroll = false; layoutEngine.LayoutText( layoutParameters, glyphPositions, lines, layoutSize, - false ); + false, + isAutoScroll ); // 10) Reorder the lines if( 0u != bidirectionalInfo.Count() ) diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp index b9278e3..8b9bffd 100755 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp @@ -187,11 +187,13 @@ bool LayoutTextTest( const LayoutTextData& data ) layoutSize = Vector2::ZERO; + bool isAutoScroll = false; const bool updated = engine.LayoutText( layoutParameters, glyphPositions, lines, layoutSize, - data.ellipsis ); + data.ellipsis, + isAutoScroll ); // 4) Compare the results. diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp index ffa0a61..b1ae269 100755 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp @@ -553,9 +553,9 @@ int UtcDaliToolkitTextLabelSetPropertyP(void) DALI_TEST_EQUALS( label.GetProperty( TextLabel::Property::PIXEL_SIZE ), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION ); // Check the ellipsis property - DALI_TEST_CHECK( !label.GetProperty( TextLabel::Property::ELLIPSIS ) ); - label.SetProperty( TextLabel::Property::ELLIPSIS, true ); DALI_TEST_CHECK( label.GetProperty( TextLabel::Property::ELLIPSIS ) ); + label.SetProperty( TextLabel::Property::ELLIPSIS, false ); + DALI_TEST_CHECK( !label.GetProperty( TextLabel::Property::ELLIPSIS ) ); // Check the layout direction property label.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT ); diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index 376709a..79dc2cb 100755 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -363,7 +363,6 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr // If request is enable (true) then start autoscroll as not already running else { - impl.mController->SetTextElideEnabled( false ); impl.mController->SetAutoScrollEnabled( enableAutoScroll ); } } diff --git a/dali-toolkit/internal/text/layouts/layout-engine.cpp b/dali-toolkit/internal/text/layouts/layout-engine.cpp index 4f9876c..f97a8ea 100755 --- a/dali-toolkit/internal/text/layouts/layout-engine.cpp +++ b/dali-toolkit/internal/text/layouts/layout-engine.cpp @@ -555,6 +555,7 @@ struct Engine::Impl * @param[in,out] numberOfLines The number of laid-out lines. * @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 * * return Whether the line is ellipsized. */ @@ -565,14 +566,17 @@ struct Engine::Impl Vector2* glyphPositionsBuffer, Length& numberOfLines, float penY, - CharacterDirection currentParagraphDirection ) + CharacterDirection currentParagraphDirection, + bool& isAutoScrollEnabled ) { - const bool ellipsis = ( ( penY - layout.descender > layoutParameters.boundingBox.height ) || - ( ( mLayout == SINGLE_LINE_BOX ) && - ( layout.extraBearing + layout.length + layout.extraWidth > layoutParameters.boundingBox.width ) ) ); + const bool ellipsis = isAutoScrollEnabled ? ( penY - layout.descender > layoutParameters.boundingBox.height ) : + ( ( penY - layout.descender > layoutParameters.boundingBox.height ) || + ( ( mLayout == SINGLE_LINE_BOX ) && + ( layout.extraBearing + layout.length + layout.extraWidth > layoutParameters.boundingBox.width ) ) ); if( ellipsis ) { + isAutoScrollEnabled = false; // Do not layout more lines if ellipsis is enabled. // The last line needs to be completely filled with characters. @@ -791,7 +795,8 @@ struct Engine::Impl Vector& glyphPositions, Vector& lines, Size& layoutSize, - bool elideTextEnabled ) + bool elideTextEnabled, + bool& isAutoScrollEnabled ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->LayoutText\n" ); DALI_LOG_INFO( gLogFilter, Debug::Verbose, " box size %f, %f\n", layoutParameters.boundingBox.width, layoutParameters.boundingBox.height ); @@ -925,7 +930,8 @@ struct Engine::Impl glyphPositionsBuffer, numberOfLines, penY, - currentParagraphDirection ); + currentParagraphDirection, + isAutoScrollEnabled ); } if( ellipsis ) @@ -1291,13 +1297,15 @@ bool Engine::LayoutText( const Parameters& layoutParameters, Vector& glyphPositions, Vector& lines, Size& layoutSize, - bool elideTextEnabled ) + bool elideTextEnabled, + bool& isAutoScrollEnabled ) { return mImpl->LayoutText( layoutParameters, glyphPositions, lines, layoutSize, - elideTextEnabled ); + elideTextEnabled, + isAutoScrollEnabled ); } void Engine::ReLayoutRightToLeftLines( const Parameters& layoutParameters, diff --git a/dali-toolkit/internal/text/layouts/layout-engine.h b/dali-toolkit/internal/text/layouts/layout-engine.h index 5e80d8c..58466a9 100755 --- a/dali-toolkit/internal/text/layouts/layout-engine.h +++ b/dali-toolkit/internal/text/layouts/layout-engine.h @@ -108,6 +108,7 @@ public: * @param[out] lines The laid-out lines. * @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 * * @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. */ @@ -115,7 +116,8 @@ public: Vector& glyphPositions, Vector& lines, Size& layoutSize, - bool elideTextEnabled ); + bool elideTextEnabled, + bool& isAutoScrollEnabled ); /** * @brief Re-lays out those lines with right to left characters. diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 6c1bf75..13d0ab2 100755 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -2328,6 +2328,7 @@ Controller::UpdateTextType Controller::Relayout( const Size& size, Dali::LayoutD mImpl->mOperationsPending, layoutSize ) || updated; + if( updated ) { updateTextType = MODEL_UPDATED; @@ -3601,12 +3602,15 @@ bool Controller::DoRelayout( const Size& size, } // Update the visual model. + bool isAutoScrollEnabled = mImpl->mIsAutoScrollEnabled; Size newLayoutSize; viewUpdated = mImpl->mLayoutEngine.LayoutText( layoutParameters, glyphPositions, mImpl->mModel->mVisualModel->mLines, newLayoutSize, - elideTextEnabled ); + elideTextEnabled, + isAutoScrollEnabled ); + mImpl->mIsAutoScrollEnabled = isAutoScrollEnabled; viewUpdated = viewUpdated || ( newLayoutSize != layoutSize );