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=344cde15b5757073d124ea6b0434f752d6fcbc97;hp=1df19ca48e55888fd4f7fdebc8bc2fffe4c23169;hb=c93f6281a8bafc5b7ba5f0dcdad0eb675b8e3436;hpb=66dc29e50b21f132ca11e1b274c401c243938281 diff --git a/dali-toolkit/internal/text/markup-processor.cpp b/dali-toolkit/internal/text/markup-processor.cpp index 1df19ca..344cde1 100644 --- a/dali-toolkit/internal/text/markup-processor.cpp +++ b/dali-toolkit/internal/text/markup-processor.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include namespace Dali @@ -46,25 +47,6 @@ namespace Text { namespace { -// HTML-ISH tag and attribute constants. -// Note they must be lower case in order to make the comparison to work -// as the parser converts all the read tags to lower case. -const std::string XHTML_COLOR_TAG("color"); -const std::string XHTML_FONT_TAG("font"); -const std::string XHTML_B_TAG("b"); -const std::string XHTML_I_TAG("i"); -const std::string XHTML_U_TAG("u"); -const std::string XHTML_SHADOW_TAG("shadow"); -const std::string XHTML_GLOW_TAG("glow"); -const std::string XHTML_OUTLINE_TAG("outline"); -const std::string XHTML_ITEM_TAG("item"); -const std::string XHTML_ANCHOR_TAG("a"); -const std::string XHTML_BACKGROUND_TAG("background"); -const std::string XHTML_SPAN_TAG("span"); -const std::string XHTML_STRIKETHROUGH_TAG("s"); -const std::string XHTML_PARAGRAPH_TAG("p"); -const std::string XHTML_CHARACTER_SPACING_TAG("char-spacing"); - const char LESS_THAN = '<'; const char GREATER_THAN = '>'; const char EQUAL = '='; @@ -959,10 +941,13 @@ void ResizeModelVectors(MarkupProcessData& markupProcessData, markupProcessData.characterSpacingCharacterRuns.Resize(characterSpacingCharacterRunIndex); #ifdef DEBUG_ENABLED - for(unsigned int i = 0; i < colorRunIndex; ++i) + if(gLogFilter->IsEnabledFor(Debug::Verbose)) { - ColorRun& run = markupProcessData.colorRuns[i]; - DALI_LOG_INFO(gLogFilter, Debug::Verbose, "run[%d] index: %d, length: %d, color %f,%f,%f,%f\n", i, run.characterRun.characterIndex, run.characterRun.numberOfCharacters, run.color.r, run.color.g, run.color.b, run.color.a); + for(uint32_t i = 0; i < colorRunIndex; ++i) + { + ColorRun& run = markupProcessData.colorRuns[i]; + DALI_LOG_INFO(gLogFilter, Debug::Verbose, "run[%d] index: %d, length: %d, color %f,%f,%f,%f\n", i, run.characterRun.characterIndex, run.characterRun.numberOfCharacters, run.color.r, run.color.g, run.color.b, run.color.a); + } } #endif } @@ -1117,12 +1102,12 @@ void ProcessMarkupString(const std::string& markupString, MarkupProcessData& mar markupStringEndBuffer, tag)) { - if(TokenComparison(XHTML_COLOR_TAG, tag.buffer, tag.length)) + if(TokenComparison(MARKUP::TAG::COLOR, tag.buffer, tag.length)) { ProcessTagForRun( markupProcessData.colorRuns, styleStack, tag, characterIndex, colorRunIndex, colorTagReference, [](const Tag& tag, ColorRun& run) { ProcessColorTag(tag, run); }); } // - else if(TokenComparison(XHTML_I_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::ITALIC, tag.buffer, tag.length)) { ProcessTagForRun( markupProcessData.fontRuns, styleStack, tag, characterIndex, fontRunIndex, iTagReference, [](const Tag&, FontDescriptionRun& fontRun) { @@ -1130,12 +1115,12 @@ void ProcessMarkupString(const std::string& markupString, MarkupProcessData& mar fontRun.slantDefined = true; }); } // - else if(TokenComparison(XHTML_U_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::UNDERLINE, tag.buffer, tag.length)) { ProcessTagForRun( markupProcessData.underlinedCharacterRuns, styleStack, tag, characterIndex, underlinedCharacterRunIndex, uTagReference, [](const Tag& tag, UnderlinedCharacterRun& run) { ProcessUnderlineTag(tag, run); }); } // - else if(TokenComparison(XHTML_B_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::BOLD, tag.buffer, tag.length)) { ProcessTagForRun( markupProcessData.fontRuns, styleStack, tag, characterIndex, fontRunIndex, bTagReference, [](const Tag&, FontDescriptionRun& fontRun) { @@ -1143,12 +1128,12 @@ void ProcessMarkupString(const std::string& markupString, MarkupProcessData& mar fontRun.weightDefined = true; }); } // - else if(TokenComparison(XHTML_FONT_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::FONT, tag.buffer, tag.length)) { ProcessTagForRun( markupProcessData.fontRuns, styleStack, tag, characterIndex, fontRunIndex, fontTagReference, [](const Tag& tag, FontDescriptionRun& fontRun) { ProcessFontTag(tag, fontRun); }); } // - else if(TokenComparison(XHTML_ANCHOR_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::ANCHOR, tag.buffer, tag.length)) { /* Anchor */ ProcessAnchorTag(markupProcessData, tag, characterIndex); @@ -1166,31 +1151,31 @@ void ProcessMarkupString(const std::string& markupString, MarkupProcessData& mar ProcessUnderlineTag(tag, run); }); } // tizen - else if(TokenComparison(XHTML_SHADOW_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::SHADOW, tag.buffer, tag.length)) { // TODO: If !tag.isEndTag, then create a new shadow run. // else Pop the top of the stack and set the number of characters of the run. } // - else if(TokenComparison(XHTML_GLOW_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::GLOW, tag.buffer, tag.length)) { // TODO: If !tag.isEndTag, then create a new glow run. // else Pop the top of the stack and set the number of characters of the run. } // - else if(TokenComparison(XHTML_OUTLINE_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::OUTLINE, tag.buffer, tag.length)) { // TODO: If !tag.isEndTag, then create a new outline run. // else Pop the top of the stack and set the number of characters of the run. } // - else if(TokenComparison(XHTML_ITEM_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::EMBEDDED_ITEM, tag.buffer, tag.length)) { ProcessItemTag(markupProcessData, tag, characterIndex); } - else if(TokenComparison(XHTML_BACKGROUND_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::BACKGROUND, tag.buffer, tag.length)) { ProcessTagForRun( markupProcessData.backgroundColorRuns, styleStack, tag, characterIndex, backgroundRunIndex, backgroundTagReference, [](const Tag& tag, ColorRun& run) { ProcessBackground(tag, run); }); } - else if(TokenComparison(XHTML_SPAN_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::SPAN, tag.buffer, tag.length)) { ProcessSpanForRun(tag, spanStack, @@ -1209,18 +1194,18 @@ void ProcessMarkupString(const std::string& markupString, MarkupProcessData& mar characterIndex, spanTagReference); } - else if(TokenComparison(XHTML_STRIKETHROUGH_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::STRIKETHROUGH, tag.buffer, tag.length)) { ProcessTagForRun( markupProcessData.strikethroughCharacterRuns, styleStack, tag, characterIndex, strikethroughCharacterRunIndex, sTagReference, [](const Tag& tag, StrikethroughCharacterRun& run) { ProcessStrikethroughTag(tag, run); }); } // - else if(TokenComparison(XHTML_PARAGRAPH_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::PARAGRAPH, tag.buffer, tag.length)) { ProcessParagraphTag(markupProcessData, tag, (markupStringBuffer == markupStringEndBuffer), characterIndex); ProcessTagForRun( markupProcessData.boundedParagraphRuns, styleStack, tag, characterIndex, boundedParagraphRunIndex, pTagReference, [](const Tag& tag, BoundedParagraphRun& run) { ProcessAttributesOfParagraphTag(tag, run); }); } //

- else if(TokenComparison(XHTML_CHARACTER_SPACING_TAG, tag.buffer, tag.length)) + else if(TokenComparison(MARKUP::TAG::CHARACTER_SPACING, tag.buffer, tag.length)) { ProcessTagForRun( markupProcessData.characterSpacingCharacterRuns, styleStack, tag, characterIndex, characterSpacingCharacterRunIndex, characterSpacingTagReference, [](const Tag& tag, CharacterSpacingCharacterRun& run) { ProcessCharacterSpacingTag(tag, run); });