+ if( 1u < numberOfLines )
+ {
+ // Boxify the first line.
+ lineRun = mVisualModel->mLines.Begin() + firstLineIndex;
+ const SelectionBoxInfo& firstSelectionBoxLineInfo = *( selectionBoxLinesInfo.Begin() );
+
+ bool boxifyBegin = ( LTR != lineRun->direction ) && ( LTR != startDirection );
+ bool boxifyEnd = ( LTR == lineRun->direction ) && ( LTR == startDirection );
+
+ if( boxifyBegin )
+ {
+ quad.x = 0.f;
+ quad.y = firstSelectionBoxLineInfo.lineOffset;
+ quad.z = firstSelectionBoxLineInfo.minX;
+ quad.w = firstSelectionBoxLineInfo.lineOffset + firstSelectionBoxLineInfo.lineHeight;
+
+ // Boxify at the beginning of the line.
+ mEventData->mDecorator->AddHighlight( actualNumberOfQuads,
+ quad );
+ ++actualNumberOfQuads;
+
+ // Update the size of the highlighted text.
+ minHighlightX = 0.f;
+ }
+
+ if( boxifyEnd )
+ {
+ quad.x = firstSelectionBoxLineInfo.maxX;
+ quad.y = firstSelectionBoxLineInfo.lineOffset;
+ quad.z = mVisualModel->mControlSize.width;
+ quad.w = firstSelectionBoxLineInfo.lineOffset + firstSelectionBoxLineInfo.lineHeight;
+
+ // Boxify at the end of the line.
+ mEventData->mDecorator->AddHighlight( actualNumberOfQuads,
+ quad );
+ ++actualNumberOfQuads;
+
+ // Update the size of the highlighted text.
+ maxHighlightX = mVisualModel->mControlSize.width;
+ }
+
+ // Boxify the central lines.
+ if( 2u < numberOfLines )
+ {
+ for( Vector<SelectionBoxInfo>::ConstIterator it = selectionBoxLinesInfo.Begin() + 1u,
+ endIt = selectionBoxLinesInfo.End() - 1u;
+ it != endIt;
+ ++it )
+ {
+ const SelectionBoxInfo& info = *it;
+
+ quad.x = 0.f;
+ quad.y = info.lineOffset;
+ quad.z = info.minX;
+ quad.w = info.lineOffset + info.lineHeight;
+
+ mEventData->mDecorator->AddHighlight( actualNumberOfQuads,
+ quad );
+ ++actualNumberOfQuads;
+
+ quad.x = info.maxX;
+ quad.y = info.lineOffset;
+ quad.z = mVisualModel->mControlSize.width;
+ quad.w = info.lineOffset + info.lineHeight;
+
+ mEventData->mDecorator->AddHighlight( actualNumberOfQuads,
+ quad );
+ ++actualNumberOfQuads;
+ }
+
+ // Update the size of the highlighted text.
+ minHighlightX = 0.f;
+ maxHighlightX = mVisualModel->mControlSize.width;
+ }
+
+ // Boxify the last line.
+ lineRun = mVisualModel->mLines.Begin() + firstLineIndex + numberOfLines - 1u;
+ const SelectionBoxInfo& lastSelectionBoxLineInfo = *( selectionBoxLinesInfo.End() - 1u );
+
+ boxifyBegin = ( LTR == lineRun->direction ) && ( LTR == endDirection );
+ boxifyEnd = ( LTR != lineRun->direction ) && ( LTR != endDirection );
+
+ if( boxifyBegin )
+ {
+ quad.x = 0.f;
+ quad.y = lastSelectionBoxLineInfo.lineOffset;
+ quad.z = lastSelectionBoxLineInfo.minX;
+ quad.w = lastSelectionBoxLineInfo.lineOffset + lastSelectionBoxLineInfo.lineHeight;
+
+ // Boxify at the beginning of the line.
+ mEventData->mDecorator->AddHighlight( actualNumberOfQuads,
+ quad );
+ ++actualNumberOfQuads;
+
+ // Update the size of the highlighted text.
+ minHighlightX = 0.f;
+ }
+
+ if( boxifyEnd )
+ {
+ quad.x = lastSelectionBoxLineInfo.maxX;
+ quad.y = lastSelectionBoxLineInfo.lineOffset;
+ quad.z = mVisualModel->mControlSize.width;
+ quad.w = lastSelectionBoxLineInfo.lineOffset + lastSelectionBoxLineInfo.lineHeight;
+
+ // Boxify at the end of the line.
+ mEventData->mDecorator->AddHighlight( actualNumberOfQuads,
+ quad );
+ ++actualNumberOfQuads;
+
+ // Update the size of the highlighted text.
+ maxHighlightX = mVisualModel->mControlSize.width;
+ }
+ }
+
+ // Set the actual number of quads.
+ mEventData->mDecorator->ResizeHighlightQuads( actualNumberOfQuads );
+
+ // Sets the highlight's size and position. In decorator's coords.
+ // The highlight's height has been calculated above (before 'boxifying' the highlight).
+ highLightSize.width = maxHighlightX - minHighlightX;
+
+ highLightPosition.x = minHighlightX;
+ const SelectionBoxInfo& firstSelectionBoxLineInfo = *( selectionBoxLinesInfo.Begin() );
+ highLightPosition.y = firstSelectionBoxLineInfo.lineOffset;
+
+ mEventData->mDecorator->SetHighLightBox( highLightPosition, highLightSize );
+
+ if( !mEventData->mDecorator->IsSmoothHandlePanEnabled() )
+ {
+ CursorInfo primaryCursorInfo;
+ GetCursorPosition( mEventData->mLeftSelectionPosition,
+ primaryCursorInfo );
+
+ const Vector2 primaryPosition = primaryCursorInfo.primaryPosition + mScrollPosition;
+
+ mEventData->mDecorator->SetPosition( LEFT_SELECTION_HANDLE,
+ primaryPosition.x,
+ primaryCursorInfo.lineOffset + mScrollPosition.y,
+ primaryCursorInfo.lineHeight );
+
+ CursorInfo secondaryCursorInfo;
+ GetCursorPosition( mEventData->mRightSelectionPosition,
+ secondaryCursorInfo );