From a9ef88e778c6217a9f005e679d22d5f64f92408a Mon Sep 17 00:00:00 2001 From: Joogab Yun Date: Wed, 23 Jan 2019 12:54:55 +0900 Subject: [PATCH 1/1] Checked if mInputStyle has changed. If InsertText () is called while mEventData-> mInputStyle is not yet set to defaultInputStyle(), it will behave wrong action. ex) corner case : style.size = 30 but mImpl->mEventData->mInputStyle.size = 0 in InsertText() then this code will behave wrong action. const bool addFontSizeRun = style.size != mImpl->mEventData->mInputStyle.size; Normally, ProcessInputEvents () is called before InsertText(), and the value of mImpl-> mEventData-> mInputStyle.size is set to 30. So there is usually no problem. Change-Id: I7ac15fe4b1bdd55c224e43a23c389fcd74a093a3 --- dali-toolkit/internal/text/text-controller.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 75a9e66..0088e93 100755 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -3226,14 +3226,14 @@ void Controller::InsertText( const std::string& text, Controller::InsertType typ mImpl->mModel->mLogicalModel->RetrieveStyle( styleIndex, style ); // Whether to add a new text color run. - const bool addColorRun = ( style.textColor != mImpl->mEventData->mInputStyle.textColor ); + const bool addColorRun = ( style.textColor != mImpl->mEventData->mInputStyle.textColor ) && !mImpl->mEventData->mInputStyle.isDefaultColor; // Whether to add a new font run. - const bool addFontNameRun = style.familyName != mImpl->mEventData->mInputStyle.familyName; - const bool addFontWeightRun = style.weight != mImpl->mEventData->mInputStyle.weight; - const bool addFontWidthRun = style.width != mImpl->mEventData->mInputStyle.width; - const bool addFontSlantRun = style.slant != mImpl->mEventData->mInputStyle.slant; - const bool addFontSizeRun = style.size != mImpl->mEventData->mInputStyle.size; + const bool addFontNameRun = ( style.familyName != mImpl->mEventData->mInputStyle.familyName ) && mImpl->mEventData->mInputStyle.isFamilyDefined; + const bool addFontWeightRun = ( style.weight != mImpl->mEventData->mInputStyle.weight ) && mImpl->mEventData->mInputStyle.isWeightDefined; + const bool addFontWidthRun = ( style.width != mImpl->mEventData->mInputStyle.width ) && mImpl->mEventData->mInputStyle.isWidthDefined; + const bool addFontSlantRun = ( style.slant != mImpl->mEventData->mInputStyle.slant ) && mImpl->mEventData->mInputStyle.isSlantDefined; + const bool addFontSizeRun = ( style.size != mImpl->mEventData->mInputStyle.size ) && mImpl->mEventData->mInputStyle.isSizeDefined ; // Add style runs. if( addColorRun ) -- 2.7.4