X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=dali-toolkit%2Finternal%2Ftext%2Fmarkup-processor.cpp;h=dac4f922ef7905abd0408fba82c13f3112300c35;hb=e56c0a2c82c467e236ac64f73b0fe2fbfde2ac9d;hp=4565b9dc14dd31cf3fe1133646fd558863579aa6;hpb=f60b3d8e308a5145efe754cbff2a47b4ae278021;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git
diff --git a/dali-toolkit/internal/text/markup-processor.cpp b/dali-toolkit/internal/text/markup-processor.cpp
index 4565b9d..dac4f92 100755
--- a/dali-toolkit/internal/text/markup-processor.cpp
+++ b/dali-toolkit/internal/text/markup-processor.cpp
@@ -503,6 +503,12 @@ void ProcessMarkupString( const std::string& markupString, MarkupProcessData& ma
StyleStack::RunIndex colorRunIndex = 0u;
StyleStack::RunIndex fontRunIndex = 0u;
+ // check tag reference
+ int colorTagReference = 0u;
+ int fontTagReference = 0u;
+ int iTagReference = 0u;
+ int bTagReference = 0u;
+
// Give an initial default value to the model's vectors.
markupProcessData.colorRuns.Reserve( DEFAULT_VECTOR_SIZE );
markupProcessData.fontRuns.Reserve( DEFAULT_VECTOR_SIZE );
@@ -542,12 +548,19 @@ void ProcessMarkupString( const std::string& markupString, MarkupProcessData& ma
// Point the next color run.
++colorRunIndex;
+
+ // Increase reference
+ ++colorTagReference;
}
else
{
- // Pop the top of the stack and set the number of characters of the run.
- ColorRun& colorRun = *( markupProcessData.colorRuns.Begin() + styleStack.Pop() );
- colorRun.characterRun.numberOfCharacters = characterIndex - colorRun.characterRun.characterIndex;
+ if( colorTagReference > 0 )
+ {
+ // Pop the top of the stack and set the number of characters of the run.
+ ColorRun& colorRun = *( markupProcessData.colorRuns.Begin() + styleStack.Pop() );
+ colorRun.characterRun.numberOfCharacters = characterIndex - colorRun.characterRun.characterIndex;
+ --colorTagReference;
+ }
}
} //
else if( TokenComparison( XHTML_I_TAG, tag.buffer, tag.length ) )
@@ -571,12 +584,19 @@ void ProcessMarkupString( const std::string& markupString, MarkupProcessData& ma
// Point the next free font run.
++fontRunIndex;
+
+ // Increase reference
+ ++iTagReference;
}
else
{
- // Pop the top of the stack and set the number of characters of the run.
- FontDescriptionRun& fontRun = *( markupProcessData.fontRuns.Begin() + styleStack.Pop() );
- fontRun.characterRun.numberOfCharacters = characterIndex - fontRun.characterRun.characterIndex;
+ if( iTagReference > 0 )
+ {
+ // Pop the top of the stack and set the number of characters of the run.
+ FontDescriptionRun& fontRun = *( markupProcessData.fontRuns.Begin() + styleStack.Pop() );
+ fontRun.characterRun.numberOfCharacters = characterIndex - fontRun.characterRun.characterIndex;
+ --iTagReference;
+ }
}
} //
else if( TokenComparison( XHTML_U_TAG, tag.buffer, tag.length ) )
@@ -611,12 +631,19 @@ void ProcessMarkupString( const std::string& markupString, MarkupProcessData& ma
// Point the next free font run.
++fontRunIndex;
+
+ // Increase reference
+ ++bTagReference;
}
else
{
- // Pop the top of the stack and set the number of characters of the run.
- FontDescriptionRun& fontRun = *( markupProcessData.fontRuns.Begin() + styleStack.Pop() );
- fontRun.characterRun.numberOfCharacters = characterIndex - fontRun.characterRun.characterIndex;
+ if( bTagReference > 0 )
+ {
+ // Pop the top of the stack and set the number of characters of the run.
+ FontDescriptionRun& fontRun = *( markupProcessData.fontRuns.Begin() + styleStack.Pop() );
+ fontRun.characterRun.numberOfCharacters = characterIndex - fontRun.characterRun.characterIndex;
+ --bTagReference;
+ }
}
} //
else if( TokenComparison( XHTML_FONT_TAG, tag.buffer, tag.length ) )
@@ -640,12 +667,19 @@ void ProcessMarkupString( const std::string& markupString, MarkupProcessData& ma
// Point the next free font run.
++fontRunIndex;
+
+ // Increase reference
+ ++fontTagReference;
}
else
{
- // Pop the top of the stack and set the number of characters of the run.
- FontDescriptionRun& fontRun = *( markupProcessData.fontRuns.Begin() + styleStack.Pop() );
- fontRun.characterRun.numberOfCharacters = characterIndex - fontRun.characterRun.characterIndex;
+ if( fontTagReference > 0 )
+ {
+ // Pop the top of the stack and set the number of characters of the run.
+ FontDescriptionRun& fontRun = *( markupProcessData.fontRuns.Begin() + styleStack.Pop() );
+ fontRun.characterRun.numberOfCharacters = characterIndex - fontRun.characterRun.characterIndex;
+ --fontTagReference;
+ }
}
} //
else if( TokenComparison( XHTML_SHADOW_TAG, tag.buffer, tag.length ) )