From: Adeel Kazmi Date: Fri, 22 Dec 2017 15:07:43 +0000 (+0000) Subject: Merge "Add the protected code and fix the crash issue" into devel/master X-Git-Tag: dali_1.3.6~9 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=fedf87ade1e326c925e463906b0400a09b86ae0a;hp=-c Merge "Add the protected code and fix the crash issue" into devel/master --- fedf87ade1e326c925e463906b0400a09b86ae0a diff --combined dali-toolkit/internal/text/text-controller.cpp index 6509467,15e7b8b..d454031 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@@ -466,16 -466,6 +466,16 @@@ bool Controller::IsSelectionEnabled() c return mImpl->mEventData->mSelectionEnabled; } +void Controller::SetShiftSelectionEnabled( bool enabled ) +{ + mImpl->mEventData->mShiftSelectionFlag = enabled; +} + +bool Controller::IsShiftSelectionEnabled() const +{ + return mImpl->mEventData->mShiftSelectionFlag; +} + // public : Update void Controller::SetText( const std::string& text ) @@@ -1192,14 -1182,14 +1192,14 @@@ const Vector4& Controller::GetOutlineCo return mImpl->mModel->mVisualModel->GetOutlineColor(); } -void Controller::SetOutlineWidth( float width ) +void Controller::SetOutlineWidth( unsigned int width ) { mImpl->mModel->mVisualModel->SetOutlineWidth( width ); mImpl->RequestRelayout(); } -float Controller::GetOutlineWidth() const +unsigned int Controller::GetOutlineWidth() const { return mImpl->mModel->mVisualModel->GetOutlineWidth(); } @@@ -1244,15 -1234,10 +1244,15 @@@ const std::string& Controller::GetDefau return EMPTY_STRING; } -void Controller::SetDefaultLineSpacing( float lineSpacing ) +bool Controller::SetDefaultLineSpacing( float lineSpacing ) { - //TODO finish implementation - mImpl->mLayoutEngine.SetDefaultLineSpacing( lineSpacing ); + if( std::abs(lineSpacing - mImpl->mLayoutEngine.GetDefaultLineSpacing()) > Math::MACHINE_EPSILON_1000 ) + { + mImpl->mLayoutEngine.SetDefaultLineSpacing(lineSpacing); + mImpl->mRecalculateNaturalSize = true; + return true; + } + return false; } float Controller::GetDefaultLineSpacing() const @@@ -2120,15 -2105,8 +2120,15 @@@ void Controller::GetPlaceholderProperty Toolkit::DevelText::TextDirection::Type Controller::GetTextDirection() { - const LineRun* const firstline = mImpl->mModel->mVisualModel->mLines.Begin(); - if ( firstline && firstline->direction ) + if( ( 0u == mImpl->mModel->mLogicalModel->mText.Count() ) ) + { + return Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT; + } + + const Character character = mImpl->mModel->mLogicalModel->mText[0]; + Script script = TextAbstraction::GetCharacterScript( character ); + + if( TextAbstraction::IsRightToLeftScript( script ) ) { return Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT; } @@@ -2136,16 -2114,6 +2136,16 @@@ return Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT; } +Toolkit::DevelText::VerticalLineAlignment::Type Controller::GetVerticalLineAlignment() const +{ + return mImpl->mModel->GetVerticalLineAlignment(); +} + +void Controller::SetVerticalLineAlignment( Toolkit::DevelText::VerticalLineAlignment::Type alignment ) +{ + mImpl->mModel->mVerticalLineAlignment = alignment; +} + // public : Relayout. Controller::UpdateTextType Controller::Relayout( const Size& size ) @@@ -2178,6 -2146,13 +2178,13 @@@ { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "new size (previous size %f,%f)\n", mImpl->mModel->mVisualModel->mControlSize.width, mImpl->mModel->mVisualModel->mControlSize.height ); + if( ( 0 == mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd ) && + ( 0 == mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters ) && + ( ( mImpl->mModel->mVisualModel->mControlSize.width < Math::MACHINE_EPSILON_1000 ) || ( mImpl->mModel->mVisualModel->mControlSize.height < Math::MACHINE_EPSILON_1000 ) ) ) + { + mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mModel->mLogicalModel->mText.Count(); + } + // Layout operations that need to be done if the size changes. mImpl->mOperationsPending = static_cast( mImpl->mOperationsPending | LAYOUT | @@@ -2769,17 -2744,7 +2776,17 @@@ ImfManager::ImfCallbackData Controller: if( retrieveText ) { - mImpl->GetText( numberOfWhiteSpaces, text ); + if( !mImpl->IsShowingPlaceholderText() ) + { + // Retrieves the normal text string. + mImpl->GetText( numberOfWhiteSpaces, text ); + } + else + { + // When the current text is Placeholder Text, the surrounding text should be empty string. + // It means DALi should send empty string ("") to IME. + text = ""; + } } ImfManager::ImfCallbackData callbackData( ( retrieveText || retrieveCursor ), cursorPosition, text, false ); @@@ -3412,7 -3377,7 +3419,7 @@@ bool Controller::DoRelayout( const Size const Vector& glyphsToCharactersMap = mImpl->mModel->mVisualModel->mGlyphsToCharacters; const Vector& charactersPerGlyph = mImpl->mModel->mVisualModel->mCharactersPerGlyph; const Character* const textBuffer = mImpl->mModel->mLogicalModel->mText.Begin(); - float outlineWidth = mImpl->mModel->GetOutlineWidth(); + const float outlineWidth = static_cast( mImpl->mModel->GetOutlineWidth() ); // Set the layout parameters. Layout::Parameters layoutParameters( size, @@@ -3739,7 -3704,7 +3746,7 @@@ bool Controller::DeleteEvent( int keyCo 1, UPDATE_INPUT_STYLE ); } - else if( ( mImpl->mEventData->mPrimaryCursorPosition >= 0 ) && ( keyCode == Dali::DevelKey::DALI_KEY_DELETE ) ) + else if( keyCode == Dali::DevelKey::DALI_KEY_DELETE ) { // Remove the character after the current cursor position removed = RemoveText( 0, @@@ -3878,7 -3843,6 +3885,7 @@@ void Controller::ClearFontData( mImpl->mOperationsPending = static_cast( mImpl->mOperationsPending | VALIDATE_FONTS | SHAPE_TEXT | + BIDI_INFO | GET_GLYPH_METRICS | LAYOUT | UPDATE_LAYOUT_SIZE |