From: Joogab Yun Date: Wed, 23 Jan 2019 03:54:55 +0000 (+0900) Subject: Checked if mInputStyle has changed. X-Git-Tag: dali_1.4.11~3 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=a9ef88e778c6217a9f005e679d22d5f64f92408a 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 --- 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 )