* If text is selected from the start of a paragraph
till the end of the text and then deleted, the
layout engine doesn't layout any text and the new
layout size was not updated.
It allows scroll the text with the old layout size
which is wrong.
Change-Id: Ia6c2ab4af9084c81a3d9e21c073df16f78ec7fc5
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
+ // Calculates the layout size.
+ UpdateLayoutSize( lines,
+ layoutSize );
+
// Nothing else do if there are no glyphs to layout.
return false;
}
// Nothing else do if there are no glyphs to layout.
return false;
}
mEventData->mAllTextSelected = ( startOfSelection == 0 ) && ( endOfSelection == mLogicalModel->mText.Count() );
}
mEventData->mAllTextSelected = ( startOfSelection == 0 ) && ( endOfSelection == mLogicalModel->mText.Count() );
}
-void Controller::Impl::ClampHorizontalScroll( const Vector2& actualSize )
+void Controller::Impl::ClampHorizontalScroll( const Vector2& layoutSize )
{
// Clamp between -space & 0.
{
// Clamp between -space & 0.
- if( actualSize.width > mVisualModel->mControlSize.width )
+ if( layoutSize.width > mVisualModel->mControlSize.width )
- const float space = ( actualSize.width - mVisualModel->mControlSize.width );
+ const float space = ( layoutSize.width - mVisualModel->mControlSize.width );
mScrollPosition.x = ( mScrollPosition.x < -space ) ? -space : mScrollPosition.x;
mScrollPosition.x = ( mScrollPosition.x > 0.f ) ? 0.f : mScrollPosition.x;
mScrollPosition.x = ( mScrollPosition.x < -space ) ? -space : mScrollPosition.x;
mScrollPosition.x = ( mScrollPosition.x > 0.f ) ? 0.f : mScrollPosition.x;
-void Controller::Impl::ClampVerticalScroll( const Vector2& actualSize )
+void Controller::Impl::ClampVerticalScroll( const Vector2& layoutSize )
{
// Clamp between -space & 0.
{
// Clamp between -space & 0.
- if( actualSize.height > mVisualModel->mControlSize.height )
+ if( layoutSize.height > mVisualModel->mControlSize.height )
- const float space = ( actualSize.height - mVisualModel->mControlSize.height );
+ const float space = ( layoutSize.height - mVisualModel->mControlSize.height );
mScrollPosition.y = ( mScrollPosition.y < -space ) ? -space : mScrollPosition.y;
mScrollPosition.y = ( mScrollPosition.y > 0.f ) ? 0.f : mScrollPosition.y;
mScrollPosition.y = ( mScrollPosition.y < -space ) ? -space : mScrollPosition.y;
mScrollPosition.y = ( mScrollPosition.y > 0.f ) ? 0.f : mScrollPosition.y;
/**
* @biref Clamps the horizontal scrolling to get the control always filled with text.
*
/**
* @biref Clamps the horizontal scrolling to get the control always filled with text.
*
- * @param[in] actualSize The size of the laid out text.
+ * @param[in] layoutSize The size of the laid out text.
- void ClampHorizontalScroll( const Vector2& actualSize );
+ void ClampHorizontalScroll( const Vector2& layoutSize );
/**
* @biref Clamps the vertical scrolling to get the control always filled with text.
*
/**
* @biref Clamps the vertical scrolling to get the control always filled with text.
*
- * @param[in] actualSize The size of the laid out text.
+ * @param[in] layoutSize The size of the laid out text.
- void ClampVerticalScroll( const Vector2& actualSize );
+ void ClampVerticalScroll( const Vector2& layoutSize );
/**
* @brief Scrolls the text to make a position visible.
/**
* @brief Scrolls the text to make a position visible.
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending |
LAYOUT |
ALIGN |
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending |
LAYOUT |
ALIGN |
UPDATE_DIRECTION |
REORDER );
UPDATE_DIRECTION |
REORDER );
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending |
LAYOUT |
ALIGN |
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending |
LAYOUT |
ALIGN |
SHAPE_TEXT |
GET_GLYPH_METRICS |
LAYOUT |
SHAPE_TEXT |
GET_GLYPH_METRICS |
LAYOUT |
REORDER |
ALIGN );
mImpl->mRecalculateNaturalSize = true;
REORDER |
ALIGN );
mImpl->mRecalculateNaturalSize = true;
SHAPE_TEXT |
GET_GLYPH_METRICS |
LAYOUT |
SHAPE_TEXT |
GET_GLYPH_METRICS |
LAYOUT |
REORDER |
ALIGN );
mImpl->mRecalculateNaturalSize = true;
REORDER |
ALIGN );
mImpl->mRecalculateNaturalSize = true;
SHAPE_TEXT |
GET_GLYPH_METRICS |
LAYOUT |
SHAPE_TEXT |
GET_GLYPH_METRICS |
LAYOUT |
REORDER |
ALIGN );
mImpl->mRecalculateNaturalSize = true;
REORDER |
ALIGN );
mImpl->mRecalculateNaturalSize = true;
SHAPE_TEXT |
GET_GLYPH_METRICS |
LAYOUT |
SHAPE_TEXT |
GET_GLYPH_METRICS |
LAYOUT |
REORDER |
ALIGN );
mImpl->mRecalculateNaturalSize = true;
REORDER |
ALIGN );
mImpl->mRecalculateNaturalSize = true;
SHAPE_TEXT |
GET_GLYPH_METRICS |
LAYOUT |
SHAPE_TEXT |
GET_GLYPH_METRICS |
LAYOUT |
REORDER |
ALIGN );
mImpl->mRecalculateNaturalSize = true;
REORDER |
ALIGN );
mImpl->mRecalculateNaturalSize = true;
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending |
LAYOUT |
ALIGN |
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending |
LAYOUT |
ALIGN |
REORDER );
// Set the update info to relayout the whole text.
mImpl->mTextUpdateInfo.mFullRelayoutNeeded = true;
REORDER );
// Set the update info to relayout the whole text.
mImpl->mTextUpdateInfo.mFullRelayoutNeeded = true;
const CharacterIndex startIndex = mImpl->mTextUpdateInfo.mParagraphCharacterIndex;
const Length requestedNumberOfCharacters = mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters;
const CharacterIndex startIndex = mImpl->mTextUpdateInfo.mParagraphCharacterIndex;
const Length requestedNumberOfCharacters = mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters;
+ // Get the current layout size.
+ layoutSize = mImpl->mVisualModel->GetLayoutSize();
+
if( NO_OPERATION != ( LAYOUT & operations ) )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::DoRelayout LAYOUT & operations\n");
if( NO_OPERATION != ( LAYOUT & operations ) )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::DoRelayout LAYOUT & operations\n");
if( 0u == totalNumberOfGlyphs )
{
if( 0u == totalNumberOfGlyphs )
{
- if( NO_OPERATION != ( UPDATE_ACTUAL_SIZE & operations ) )
+ if( NO_OPERATION != ( UPDATE_LAYOUT_SIZE & operations ) )
{
mImpl->mVisualModel->SetLayoutSize( Size::ZERO );
}
{
mImpl->mVisualModel->SetLayoutSize( Size::ZERO );
}
layoutParameters.estimatedNumberOfLines = mImpl->mTextUpdateInfo.mEstimatedNumberOfLines;
// Update the visual model.
layoutParameters.estimatedNumberOfLines = mImpl->mTextUpdateInfo.mEstimatedNumberOfLines;
// Update the visual model.
viewUpdated = mImpl->mLayoutEngine.LayoutText( layoutParameters,
glyphPositions,
mImpl->mVisualModel->mLines,
viewUpdated = mImpl->mLayoutEngine.LayoutText( layoutParameters,
glyphPositions,
mImpl->mVisualModel->mLines,
+ viewUpdated = viewUpdated || ( newLayoutSize != layoutSize );
+ layoutSize = newLayoutSize;
+
if ( NO_OPERATION != ( UPDATE_DIRECTION & operations ) )
{
mImpl->mAutoScrollDirectionRTL = false;
if ( NO_OPERATION != ( UPDATE_DIRECTION & operations ) )
{
mImpl->mAutoScrollDirectionRTL = false;
- // Sets the actual size.
- if( NO_OPERATION != ( UPDATE_ACTUAL_SIZE & operations ) )
+ // Sets the layout size.
+ if( NO_OPERATION != ( UPDATE_LAYOUT_SIZE & operations ) )
{
mImpl->mVisualModel->SetLayoutSize( layoutSize );
}
{
mImpl->mVisualModel->SetLayoutSize( layoutSize );
}
// Store the size used to layout the text.
mImpl->mVisualModel->mControlSize = size;
}
// Store the size used to layout the text.
mImpl->mVisualModel->mControlSize = size;
}
- else
- {
- layoutSize = mImpl->mVisualModel->GetLayoutSize();
- }
if( NO_OPERATION != ( ALIGN & operations ) )
{
if( NO_OPERATION != ( ALIGN & operations ) )
{
// Set the flags to redo the layout operations
const OperationsMask layoutOperations = static_cast<OperationsMask>( LAYOUT |
// Set the flags to redo the layout operations
const OperationsMask layoutOperations = static_cast<OperationsMask>( LAYOUT |
SHAPE_TEXT |
GET_GLYPH_METRICS |
LAYOUT |
SHAPE_TEXT |
GET_GLYPH_METRICS |
LAYOUT |
SHAPE_TEXT = 0x0040,
GET_GLYPH_METRICS = 0x0080,
LAYOUT = 0x0100,
SHAPE_TEXT = 0x0040,
GET_GLYPH_METRICS = 0x0080,
LAYOUT = 0x0100,
- UPDATE_ACTUAL_SIZE = 0x0200,
+ UPDATE_LAYOUT_SIZE = 0x0200,
REORDER = 0x0400,
ALIGN = 0x0800,
COLOR = 0x1000,
REORDER = 0x0400,
ALIGN = 0x0800,
COLOR = 0x1000,