Fix assetion error in FocusManager
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / public-api / markup-processor / markup-processor.cpp
index dddaea7..5d50c03 100644 (file)
@@ -549,7 +549,18 @@ void GetStyledTextArray( const std::string& markupString, StyledTextArray& style
 
   if ( !scanForMarkup )
   {
-    styledTextArray.push_back( StyledText( Text( markupString ), TextStyle() ) );
+    const Text text( markupString );
+    const std::size_t size = text.GetLength();
+
+    styledTextArray.resize( size, StyledText( Text(), TextStyle() ) );
+
+    std::size_t index = 0;
+    for( StyledTextArray::iterator it = styledTextArray.begin(), endIt = styledTextArray.end(); it != endIt; ++it, ++index )
+    {
+      StyledText& styledText( *it );
+
+      styledText.mText.Append( text[index] );
+    }
     return;
   }
 
@@ -881,9 +892,9 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku
   {
     const StyledText& styledText( *it );
 
-    bool isItalics = styledText.mStyle.GetItalics();
+    bool isItalics = styledText.mStyle.IsItalicsEnabled();
     bool isBold = defaultStyle.GetWeight() != styledText.mStyle.GetWeight();
-    bool isUnderline = styledText.mStyle.GetUnderline();
+    bool isUnderline = styledText.mStyle.IsUnderlineEnabled();
     bool hasFontFace = defaultStyle.GetFontName() != styledText.mStyle.GetFontName();
     bool hasFontStyle = defaultStyle.GetFontStyle() != styledText.mStyle.GetFontStyle();
     bool hasFontSize = fabsf( defaultStyle.GetFontPointSize() - styledText.mStyle.GetFontPointSize() ) > GetRangedEpsilon( defaultStyle.GetFontPointSize(), styledText.mStyle.GetFontPointSize() );
@@ -950,7 +961,7 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku
     }
 
     // Write shadow.
-    if( styledText.mStyle.GetShadow() )
+    if( styledText.mStyle.IsShadowEnabled() )
     {
       markupString += LESS_THAN + XHTML_SHADOW_TAG;
 
@@ -969,7 +980,7 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku
     }
 
     // Write glow.
-    if( styledText.mStyle.GetGlow() )
+    if( styledText.mStyle.IsGlowEnabled() )
     {
       markupString += LESS_THAN + XHTML_GLOW_TAG;
 
@@ -987,7 +998,7 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku
     } // <glow>
 
     // Write outline.
-    if( styledText.mStyle.GetOutline() )
+    if( styledText.mStyle.IsOutlineEnabled() )
     {
       markupString += LESS_THAN + XHTML_OUTLINE_TAG;
 
@@ -1016,19 +1027,19 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku
     }
 
     // Write outline close tag.
-    if( styledText.mStyle.GetOutline() )
+    if( styledText.mStyle.IsOutlineEnabled() )
     {
       markupString += LESS_THAN + ( SLASH + XHTML_OUTLINE_TAG + GREATER_THAN ); // </outline>
     }
 
     // Write glow close tag.
-    if( styledText.mStyle.GetGlow() )
+    if( styledText.mStyle.IsGlowEnabled() )
     {
       markupString += LESS_THAN + ( SLASH + XHTML_GLOW_TAG + GREATER_THAN ); // </glow>
     }
 
     // Write shadow close tag.
-    if( styledText.mStyle.GetShadow() )
+    if( styledText.mStyle.IsShadowEnabled() )
     {
       markupString += LESS_THAN + ( SLASH + XHTML_SHADOW_TAG + GREATER_THAN ); // </shadow>
     }
@@ -1065,7 +1076,7 @@ void GetMarkupString( const StyledTextArray& styledTextArray, std::string& marku
   }
 }
 
-void SetTextStyle( StyledTextArray& styledTextArray, const TextStyle& style, const TextStyle::Mask mask )
+void SetTextStyle( StyledTextArray& styledTextArray, const TextStyle& style, TextStyle::Mask mask )
 {
   if( !styledTextArray.empty() )
   {
@@ -1074,7 +1085,7 @@ void SetTextStyle( StyledTextArray& styledTextArray, const TextStyle& style, con
   }
 }
 
-void SetTextStyle( const Text& text, StyledTextArray& styledTextArray, const TextStyle& style, const TextStyle::Mask mask )
+void SetTextStyle( const Text& text, StyledTextArray& styledTextArray, const TextStyle& style, TextStyle::Mask mask )
 {
   if( !text.IsEmpty() )
   {
@@ -1093,7 +1104,7 @@ void SetTextStyle( const Text& text, StyledTextArray& styledTextArray, const Tex
   }
 }
 
-void SetTextStyleToRange( StyledTextArray& styledTextArray, const TextStyle& style, const TextStyle::Mask mask, const std::size_t begin, const std::size_t end )
+void SetTextStyleToRange( StyledTextArray& styledTextArray, const TextStyle& style, TextStyle::Mask mask, std::size_t begin, std::size_t end )
 {
   const size_t size = styledTextArray.size();
   DALI_ASSERT_ALWAYS( begin < size );