X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fmarkup-processor.cpp;h=68b063201e4439deeb8bf38882fbe64fd68510cd;hp=197dff19a7814fb64fcea90541b44df5db62ee88;hb=41e93476dff5dd7dd826f43e99aa3ef7e3ee2906;hpb=4e9ffb51cbdd54c16b75c21aa30051798a4f8e37 diff --git a/dali-toolkit/internal/text/markup-processor.cpp b/dali-toolkit/internal/text/markup-processor.cpp index 197dff1..68b0632 100644 --- a/dali-toolkit/internal/text/markup-processor.cpp +++ b/dali-toolkit/internal/text/markup-processor.cpp @@ -141,9 +141,11 @@ struct Span RunIndex colorRunIndex; RunIndex fontRunIndex; RunIndex underlinedCharacterRunIndex; + RunIndex backgroundColorRunIndex; bool isColorDefined; bool isFontDefined; bool isUnderlinedCharacterDefined; + bool isBackgroundColorDefined; }; /** @@ -203,6 +205,8 @@ void Initialize(Span& span) span.isFontDefined = false; span.underlinedCharacterRunIndex = 0u; span.isUnderlinedCharacterDefined = false; + span.backgroundColorRunIndex = 0u; + span.isBackgroundColorDefined = false; } /** @@ -728,9 +732,11 @@ void ProcessSpanForRun( Vector& colorRuns, Vector& fontRuns, Vector& underlinedCharacterRuns, + Vector& backgroundColorRuns, RunIndex& colorRunIndex, RunIndex& fontRunIndex, RunIndex& underlinedCharacterRunIndex, + RunIndex& backgroundColorRunIndex, const CharacterIndex characterIndex, int& tagReference) { @@ -746,6 +752,9 @@ void ProcessSpanForRun( UnderlinedCharacterRun underlinedCharacterRun; Initialize(underlinedCharacterRun); + ColorRun backgroundColorRun; + Initialize(backgroundColorRun); + Span span; Initialize(span); @@ -753,12 +762,14 @@ void ProcessSpanForRun( colorRun.characterRun.characterIndex = characterIndex; fontRun.characterRun.characterIndex = characterIndex; underlinedCharacterRun.characterRun.characterIndex = characterIndex; + backgroundColorRun.characterRun.characterIndex = characterIndex; span.colorRunIndex = colorRunIndex; span.fontRunIndex = fontRunIndex; span.underlinedCharacterRunIndex = underlinedCharacterRunIndex; + span.backgroundColorRunIndex = backgroundColorRunIndex; - ProcessSpanTag(spanTag, colorRun, fontRun, underlinedCharacterRun, span.isColorDefined, span.isFontDefined, span.isUnderlinedCharacterDefined); + ProcessSpanTag(spanTag, colorRun, fontRun, underlinedCharacterRun, backgroundColorRun, span.isColorDefined, span.isFontDefined, span.isUnderlinedCharacterDefined, span.isBackgroundColorDefined); // Push the span into the stack. spanStack.Push(span); @@ -785,6 +796,13 @@ void ProcessSpanForRun( ++underlinedCharacterRunIndex; } + if(span.isBackgroundColorDefined) + { + // Push the run in the logical model. + backgroundColorRuns.PushBack(backgroundColorRun); + ++backgroundColorRunIndex; + } + // Increase reference ++tagReference; } @@ -813,6 +831,12 @@ void ProcessSpanForRun( underlinedCharacterRun.characterRun.numberOfCharacters = characterIndex - underlinedCharacterRun.characterRun.characterIndex; } + if(span.isBackgroundColorDefined) + { + ColorRun& backgroundColorRun = *(backgroundColorRuns.Begin() + span.backgroundColorRunIndex); + backgroundColorRun.characterRun.numberOfCharacters = characterIndex - backgroundColorRun.characterRun.characterIndex; + } + --tagReference; } } @@ -1072,7 +1096,7 @@ void ProcessMarkupString(const std::string& markupString, MarkupProcessData& mar } else if(TokenComparison(XHTML_SPAN_TAG, tag.buffer, tag.length)) { - ProcessSpanForRun(tag, spanStack, markupProcessData.colorRuns, markupProcessData.fontRuns, markupProcessData.underlinedCharacterRuns, colorRunIndex, fontRunIndex, underlinedCharacterRunIndex, characterIndex, spanTagReference); + ProcessSpanForRun(tag, spanStack, markupProcessData.colorRuns, markupProcessData.fontRuns, markupProcessData.underlinedCharacterRuns, markupProcessData.backgroundColorRuns, colorRunIndex, fontRunIndex, underlinedCharacterRunIndex, backgroundRunIndex, characterIndex, spanTagReference); } else if(TokenComparison(XHTML_STRIKETHROUGH_TAG, tag.buffer, tag.length)) {