Refactoring and documenting the markup tags and attributes 69/272869/5
authorssabah <s.sabah@samsung.com>
Sun, 27 Mar 2022 21:23:46 +0000 (00:23 +0300)
committerssabah <s.sabah@samsung.com>
Sun, 3 Apr 2022 07:40:06 +0000 (10:40 +0300)
Moved all tags and attributes to separate file.
Added doxygen description for each tag and attribute.

To check doxygen documentation:
   1) Build dali-toolkit
   2)Generate the internal documentation for DALi Toolkit
     https://github.com/dalihub/dali-toolkit/tree/master/docs/generated-internal
   3) Goto: Files > File List > dali-toolkit > internal > text > markup-tags-and-attributes.h

Change-Id: I42693d0c1ce1169614ccad9391ef4f60a04b3f66

12 files changed:
dali-toolkit/internal/text/markup-processor-anchor.cpp
dali-toolkit/internal/text/markup-processor-background.cpp
dali-toolkit/internal/text/markup-processor-character-spacing.cpp
dali-toolkit/internal/text/markup-processor-color.cpp
dali-toolkit/internal/text/markup-processor-embedded-item.cpp
dali-toolkit/internal/text/markup-processor-font.cpp
dali-toolkit/internal/text/markup-processor-paragraph.cpp
dali-toolkit/internal/text/markup-processor-span.cpp
dali-toolkit/internal/text/markup-processor-strikethrough.cpp
dali-toolkit/internal/text/markup-processor-underline.cpp
dali-toolkit/internal/text/markup-processor.cpp
dali-toolkit/internal/text/markup-tags-and-attributes.h [new file with mode: 0644]

index 4c4bb29..771ff4e 100644 (file)
@@ -25,6 +25,7 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/anchor.h>
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/anchor.h>
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
+#include <dali-toolkit/internal/text/markup-tags-and-attributes.h>
 
 namespace Dali
 {
 
 namespace Dali
 {
@@ -32,18 +33,13 @@ namespace Toolkit
 {
 namespace Text
 {
 {
 namespace Text
 {
-namespace
-{
-const std::string XHTML_HREF_ATTRIBUTE("href");
-} // namespace
-
 void ProcessAnchor(const Tag& tag, Anchor& anchor)
 {
   anchor.href = nullptr;
 
   for(auto&& attribute : tag.attributes)
   {
 void ProcessAnchor(const Tag& tag, Anchor& anchor)
 {
   anchor.href = nullptr;
 
   for(auto&& attribute : tag.attributes)
   {
-    if(TokenComparison(XHTML_HREF_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    if(TokenComparison(MARKUP::ANCHOR_ATTRIBUTES::HREF, attribute.nameBuffer, attribute.nameLength))
     {
       Length hrefLength = attribute.valueLength + 1;
       anchor.href       = new char[hrefLength];
     {
       Length hrefLength = attribute.valueLength + 1;
       anchor.href       = new char[hrefLength];
index 8a9910e..7f0e8ae 100644 (file)
@@ -25,6 +25,7 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/color-run.h>
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/color-run.h>
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
+#include <dali-toolkit/internal/text/markup-tags-and-attributes.h>
 
 namespace Dali
 {
 
 namespace Dali
 {
@@ -32,16 +33,11 @@ namespace Toolkit
 {
 namespace Text
 {
 {
 namespace Text
 {
-namespace
-{
-const std::string XHTML_COLOR_ATTRIBUTE("color");
-} // namespace
-
 void ProcessBackground(const Tag& tag, ColorRun& colorRun)
 {
   for(auto&& attribute : tag.attributes)
   {
 void ProcessBackground(const Tag& tag, ColorRun& colorRun)
 {
   for(auto&& attribute : tag.attributes)
   {
-    if(TokenComparison(XHTML_COLOR_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    if(TokenComparison(MARKUP::BACKGROUND_ATTRIBUTES::COLOR, attribute.nameBuffer, attribute.nameLength))
     {
       ColorStringToVector4(attribute.valueBuffer, attribute.valueLength, colorRun.color);
     }
     {
       ColorStringToVector4(attribute.valueBuffer, attribute.valueLength, colorRun.color);
     }
index f0ef362..cce30dd 100644 (file)
@@ -25,6 +25,7 @@
 #include <dali-toolkit/internal/text/character-spacing-character-run.h>
 #include <dali-toolkit/internal/text/markup-processor-attribute-helper-functions.h>
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
 #include <dali-toolkit/internal/text/character-spacing-character-run.h>
 #include <dali-toolkit/internal/text/markup-processor-attribute-helper-functions.h>
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
+#include <dali-toolkit/internal/text/markup-tags-and-attributes.h>
 
 namespace Dali
 {
 
 namespace Dali
 {
@@ -32,12 +33,6 @@ namespace Toolkit
 {
 namespace Text
 {
 {
 namespace Text
 {
-namespace
-{
-const std::string XHTML_VALUE_ATTRIBUTE("value");
-
-} // namespace
-
 void ProcessValueAttribute(const Attribute& attribute, CharacterSpacingCharacterRun& characterSpacingCharacterRun)
 {
   characterSpacingCharacterRun.value = ProcessFloatAttribute(attribute);
 void ProcessValueAttribute(const Attribute& attribute, CharacterSpacingCharacterRun& characterSpacingCharacterRun)
 {
   characterSpacingCharacterRun.value = ProcessFloatAttribute(attribute);
@@ -52,7 +47,7 @@ void ProcessCharacterSpacingTag(const Tag& tag, CharacterSpacingCharacterRun& ch
   {
     const Attribute& attribute(*it);
 
   {
     const Attribute& attribute(*it);
 
-    if(TokenComparison(XHTML_VALUE_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    if(TokenComparison(MARKUP::CHARACTER_SPACING_ATTRIBUTES::VALUE, attribute.nameBuffer, attribute.nameLength))
     {
       ProcessValueAttribute(attribute, characterSpacingCharacterRun);
     }
     {
       ProcessValueAttribute(attribute, characterSpacingCharacterRun);
     }
index d5fce04..4fb95ef 100644 (file)
@@ -24,6 +24,7 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/color-run.h>
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/color-run.h>
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
+#include <dali-toolkit/internal/text/markup-tags-and-attributes.h>
 
 namespace Dali
 {
 
 namespace Dali
 {
@@ -31,11 +32,6 @@ namespace Toolkit
 {
 namespace Text
 {
 {
 namespace Text
 {
-namespace
-{
-const std::string XHTML_VALUE_ATTRIBUTE("value");
-}
-
 void ProcessColor(const Attribute& attribute, ColorRun& colorRun)
 {
   ColorStringToVector4(attribute.valueBuffer, attribute.valueLength, colorRun.color);
 void ProcessColor(const Attribute& attribute, ColorRun& colorRun)
 {
   ColorStringToVector4(attribute.valueBuffer, attribute.valueLength, colorRun.color);
@@ -49,7 +45,7 @@ void ProcessColorTag(const Tag& tag, ColorRun& colorRun)
       ++it)
   {
     const Attribute& attribute(*it);
       ++it)
   {
     const Attribute& attribute(*it);
-    if(TokenComparison(XHTML_VALUE_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    if(TokenComparison(MARKUP::COLOR_ATTRIBUTES::VALUE, attribute.nameBuffer, attribute.nameLength))
     {
       ProcessColor(attribute, colorRun);
     }
     {
       ProcessColor(attribute, colorRun);
     }
index 1bfa3f4..94d6fd4 100644 (file)
@@ -25,6 +25,7 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/embedded-item.h>
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/embedded-item.h>
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
+#include <dali-toolkit/internal/text/markup-tags-and-attributes.h>
 
 namespace Dali
 {
 
 namespace Dali
 {
@@ -34,11 +35,6 @@ namespace Text
 {
 namespace
 {
 {
 namespace
 {
-const std::string XHTML_URL_ATTRIBUTE("url");
-const std::string XHTML_WIDTH_ATTRIBUTE("width");
-const std::string XHTML_HEIGHT_ATTRIBUTE("height");
-const std::string XHTML_COLOR_BLENDING_ATTRIBUTE("color-blending");
-
 const std::string NONE("none");
 const std::string MULTIPLY("multiply");
 } // namespace
 const std::string NONE("none");
 const std::string MULTIPLY("multiply");
 } // namespace
@@ -57,22 +53,22 @@ void ProcessEmbeddedItem(const Tag& tag, EmbeddedItem& embeddedItem)
       ++it)
   {
     const Attribute& attribute(*it);
       ++it)
   {
     const Attribute& attribute(*it);
-    if(TokenComparison(XHTML_URL_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    if(TokenComparison(MARKUP::EMBEDDED_ITEM_ATTRIBUTES::URL, attribute.nameBuffer, attribute.nameLength))
     {
       embeddedItem.urlLength = attribute.valueLength;
       embeddedItem.url       = new char[embeddedItem.urlLength];
       memcpy(embeddedItem.url, attribute.valueBuffer, embeddedItem.urlLength);
       // The memory is freed when the font run is removed from the logical model.
     }
     {
       embeddedItem.urlLength = attribute.valueLength;
       embeddedItem.url       = new char[embeddedItem.urlLength];
       memcpy(embeddedItem.url, attribute.valueBuffer, embeddedItem.urlLength);
       // The memory is freed when the font run is removed from the logical model.
     }
-    else if(TokenComparison(XHTML_WIDTH_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::EMBEDDED_ITEM_ATTRIBUTES::WIDTH, attribute.nameBuffer, attribute.nameLength))
     {
       embeddedItem.width = StringToUint(attribute.valueBuffer);
     }
     {
       embeddedItem.width = StringToUint(attribute.valueBuffer);
     }
-    else if(TokenComparison(XHTML_HEIGHT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::EMBEDDED_ITEM_ATTRIBUTES::HEIGHT, attribute.nameBuffer, attribute.nameLength))
     {
       embeddedItem.height = StringToUint(attribute.valueBuffer);
     }
     {
       embeddedItem.height = StringToUint(attribute.valueBuffer);
     }
-    else if(TokenComparison(XHTML_COLOR_BLENDING_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::EMBEDDED_ITEM_ATTRIBUTES::COLOR_BLENDING, attribute.nameBuffer, attribute.nameLength))
     {
       if(TokenComparison(MULTIPLY, attribute.valueBuffer, attribute.valueLength))
       {
     {
       if(TokenComparison(MULTIPLY, attribute.valueBuffer, attribute.valueLength))
       {
index 0c469b8..802f9e9 100644 (file)
@@ -26,6 +26,7 @@
 #include <dali-toolkit/internal/text/font-description-run.h>
 #include <dali-toolkit/internal/text/markup-processor-attribute-helper-functions.h>
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
 #include <dali-toolkit/internal/text/font-description-run.h>
 #include <dali-toolkit/internal/text/markup-processor-attribute-helper-functions.h>
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
+#include <dali-toolkit/internal/text/markup-tags-and-attributes.h>
 #include <dali-toolkit/internal/text/text-font-style.h>
 
 namespace Dali
 #include <dali-toolkit/internal/text/text-font-style.h>
 
 namespace Dali
@@ -36,12 +37,6 @@ namespace Text
 {
 namespace
 {
 {
 namespace
 {
-const std::string XHTML_FAMILY_ATTRIBUTE("family");
-const std::string XHTML_SIZE_ATTRIBUTE("size");
-const std::string XHTML_WEIGHT_ATTRIBUTE("weight");
-const std::string XHTML_WIDTH_ATTRIBUTE("width");
-const std::string XHTML_SLANT_ATTRIBUTE("slant");
-
 const std::string  FONT_PREFIX("font-");
 const unsigned int FONT_PREFIX_LENGTH      = 5u;
 const unsigned int MIN_FONT_ATTRIBUTE_SIZE = 4u;   ///< The minimum length of any of the possible 'weight', 'width' , 'slant' or 'size' values.
 const std::string  FONT_PREFIX("font-");
 const unsigned int FONT_PREFIX_LENGTH      = 5u;
 const unsigned int MIN_FONT_ATTRIBUTE_SIZE = 4u;   ///< The minimum length of any of the possible 'weight', 'width' , 'slant' or 'size' values.
@@ -97,23 +92,23 @@ void ProcessFontTag(const Tag& tag, FontDescriptionRun& fontRun)
   {
     const Attribute& attribute(*it);
 
   {
     const Attribute& attribute(*it);
 
-    if(TokenComparison(XHTML_FAMILY_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    if(TokenComparison(MARKUP::FONT_ATTRIBUTES::FAMILY, attribute.nameBuffer, attribute.nameLength))
     {
       ProcessFontFamily(attribute, fontRun);
     }
     {
       ProcessFontFamily(attribute, fontRun);
     }
-    else if(TokenComparison(XHTML_SIZE_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::FONT_ATTRIBUTES::SIZE, attribute.nameBuffer, attribute.nameLength))
     {
       ProcessFontSize(attribute, fontRun);
     }
     {
       ProcessFontSize(attribute, fontRun);
     }
-    else if(TokenComparison(XHTML_WEIGHT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::FONT_ATTRIBUTES::WEIGHT, attribute.nameBuffer, attribute.nameLength))
     {
       ProcessFontWeight(attribute, fontRun);
     }
     {
       ProcessFontWeight(attribute, fontRun);
     }
-    else if(TokenComparison(XHTML_WIDTH_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::FONT_ATTRIBUTES::WIDTH, attribute.nameBuffer, attribute.nameLength))
     {
       ProcessFontWidth(attribute, fontRun);
     }
     {
       ProcessFontWidth(attribute, fontRun);
     }
-    else if(TokenComparison(XHTML_SLANT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::FONT_ATTRIBUTES::SLANT, attribute.nameBuffer, attribute.nameLength))
     {
       ProcessFontSlant(attribute, fontRun);
     }
     {
       ProcessFontSlant(attribute, fontRun);
     }
index 859547e..e470bec 100644 (file)
@@ -24,6 +24,7 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/bounded-paragraph-run.h>
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/bounded-paragraph-run.h>
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
+#include <dali-toolkit/internal/text/markup-tags-and-attributes.h>
 
 namespace Dali
 {
 
 namespace Dali
 {
@@ -31,12 +32,6 @@ namespace Toolkit
 {
 namespace Text
 {
 {
 namespace Text
 {
-namespace
-{
-const std::string XHTML_ALIGN_ATTRIBUTE("align");
-const std::string XHTML_RELATIVE_LINE_HEIGHT_ATTRIBUTE("rel-line-height");
-} // namespace
-
 void ProcessHorizontalAlignment(const Attribute& attribute, BoundedParagraphRun& boundedParagraphRun)
 {
   boundedParagraphRun.horizontalAlignmentDefined = HorizontalAlignmentTypeStringToTypeValue(attribute.valueBuffer,
 void ProcessHorizontalAlignment(const Attribute& attribute, BoundedParagraphRun& boundedParagraphRun)
 {
   boundedParagraphRun.horizontalAlignmentDefined = HorizontalAlignmentTypeStringToTypeValue(attribute.valueBuffer,
@@ -61,11 +56,11 @@ void ProcessAttributesOfParagraphTag(const Tag& tag, BoundedParagraphRun& bounde
       ++it)
   {
     const Attribute& attribute(*it);
       ++it)
   {
     const Attribute& attribute(*it);
-    if(TokenComparison(XHTML_ALIGN_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    if(TokenComparison(MARKUP::PARAGRAPH_ATTRIBUTES::ALIGN, attribute.nameBuffer, attribute.nameLength))
     {
       ProcessHorizontalAlignment(attribute, boundedParagraphRun);
     }
     {
       ProcessHorizontalAlignment(attribute, boundedParagraphRun);
     }
-    else if(TokenComparison(XHTML_RELATIVE_LINE_HEIGHT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::PARAGRAPH_ATTRIBUTES::RELATIVE_LINE_HEIGHT, attribute.nameBuffer, attribute.nameLength))
     {
       ProcessRelativeLineHeight(attribute, boundedParagraphRun);
     }
     {
       ProcessRelativeLineHeight(attribute, boundedParagraphRun);
     }
index 19810ee..3e20c6f 100644 (file)
@@ -29,6 +29,7 @@
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
 #include <dali-toolkit/internal/text/markup-processor-strikethrough.h>
 #include <dali-toolkit/internal/text/markup-processor-underline.h>
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
 #include <dali-toolkit/internal/text/markup-processor-strikethrough.h>
 #include <dali-toolkit/internal/text/markup-processor-underline.h>
+#include <dali-toolkit/internal/text/markup-tags-and-attributes.h>
 
 namespace Dali
 {
 
 namespace Dali
 {
@@ -36,35 +37,6 @@ namespace Toolkit
 {
 namespace Text
 {
 {
 namespace Text
 {
-namespace
-{
-const std::string XHTML_FAMILY_ATTRIBUTE("font-family");
-const std::string XHTML_SIZE_ATTRIBUTE("font-size");
-const std::string XHTML_WEIGHT_ATTRIBUTE("font-weight");
-const std::string XHTML_WIDTH_ATTRIBUTE("font-width");
-const std::string XHTML_SLANT_ATTRIBUTE("font-slant");
-
-const std::string XHTML_COLOR_ATTRIBUTE("text-color");
-const std::string XHTML_BACKGROUND_COLOR_ATTRIBUTE("background-color");
-
-//the underlined character's attributes
-const std::string XHTML_UNDERLINE_COLOR_ATTRIBUTE("u-color");
-const std::string XHTML_UNDERLINE_HEIGHT_ATTRIBUTE("u-height");
-const std::string XHTML_UNDERLINE_TYPE_ATTRIBUTE("u-type");
-const std::string XHTML_UNDERLINE_DASH_GAP_ATTRIBUTE("u-dash-gap");
-const std::string XHTML_UNDERLINE_DASH_WIDTH_ATTRIBUTE("u-dash-width");
-
-//the strikethroughed character's attributes
-const std::string XHTML_STRIKETHROUGH_COLOR_ATTRIBUTE("s-color");
-const std::string XHTML_STRIKETHROUGH_HEIGHT_ATTRIBUTE("s-height");
-
-//the character-spacing character's attributes
-const std::string XHTML_CHARACTER_SPACING_VALUE_ATTRIBUTE("char-space-value");
-
-//NOTE: the MAX_NUM_OF_ATTRIBUTES in "markup-processor.cpp" should be updated when add a new attribute for span tag.
-
-} // namespace
-
 void ProcessSpanTag(const Tag&                    tag,
                     ColorRun&                     colorRun,
                     FontDescriptionRun&           fontRun,
 void ProcessSpanTag(const Tag&                    tag,
                     ColorRun&                     colorRun,
                     FontDescriptionRun&           fontRun,
@@ -86,77 +58,77 @@ void ProcessSpanTag(const Tag&                    tag,
   {
     const Attribute& attribute(*it);
 
   {
     const Attribute& attribute(*it);
 
-    if(TokenComparison(XHTML_COLOR_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::TEXT_COLOR, attribute.nameBuffer, attribute.nameLength))
     {
       isColorDefined = true;
       ProcessColor(attribute, colorRun);
     }
     {
       isColorDefined = true;
       ProcessColor(attribute, colorRun);
     }
-    else if(TokenComparison(XHTML_BACKGROUND_COLOR_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::BACKGROUND_COLOR, attribute.nameBuffer, attribute.nameLength))
     {
       isBackgroundColorDefined = true;
       ProcessColor(attribute, backgroundColorRun);
     }
     {
       isBackgroundColorDefined = true;
       ProcessColor(attribute, backgroundColorRun);
     }
-    else if(TokenComparison(XHTML_FAMILY_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::FONT_FAMILY, attribute.nameBuffer, attribute.nameLength))
     {
       isFontDefined = true;
       ProcessFontFamily(attribute, fontRun);
     }
     {
       isFontDefined = true;
       ProcessFontFamily(attribute, fontRun);
     }
-    else if(TokenComparison(XHTML_SIZE_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::FONT_SIZE, attribute.nameBuffer, attribute.nameLength))
     {
       isFontDefined = true;
       ProcessFontSize(attribute, fontRun);
     }
     {
       isFontDefined = true;
       ProcessFontSize(attribute, fontRun);
     }
-    else if(TokenComparison(XHTML_WEIGHT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::FONT_WEIGHT, attribute.nameBuffer, attribute.nameLength))
     {
       isFontDefined = true;
       ProcessFontWeight(attribute, fontRun);
     }
     {
       isFontDefined = true;
       ProcessFontWeight(attribute, fontRun);
     }
-    else if(TokenComparison(XHTML_WIDTH_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::FONT_WIDTH, attribute.nameBuffer, attribute.nameLength))
     {
       isFontDefined = true;
       ProcessFontWidth(attribute, fontRun);
     }
     {
       isFontDefined = true;
       ProcessFontWidth(attribute, fontRun);
     }
-    else if(TokenComparison(XHTML_SLANT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::FONT_SLANT, attribute.nameBuffer, attribute.nameLength))
     {
       isFontDefined = true;
       ProcessFontSlant(attribute, fontRun);
     }
     {
       isFontDefined = true;
       ProcessFontSlant(attribute, fontRun);
     }
-    else if(TokenComparison(XHTML_UNDERLINE_COLOR_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::UNDERLINE_COLOR, attribute.nameBuffer, attribute.nameLength))
     {
       isUnderlinedCharacterDefined = true;
       ProcessColorAttribute(attribute, underlinedCharacterRun);
     }
     {
       isUnderlinedCharacterDefined = true;
       ProcessColorAttribute(attribute, underlinedCharacterRun);
     }
-    else if(TokenComparison(XHTML_UNDERLINE_HEIGHT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::UNDERLINE_HEIGHT, attribute.nameBuffer, attribute.nameLength))
     {
       isUnderlinedCharacterDefined = true;
       ProcessHeightAttribute(attribute, underlinedCharacterRun);
     }
     {
       isUnderlinedCharacterDefined = true;
       ProcessHeightAttribute(attribute, underlinedCharacterRun);
     }
-    else if(TokenComparison(XHTML_UNDERLINE_TYPE_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::UNDERLINE_TYPE, attribute.nameBuffer, attribute.nameLength))
     {
       isUnderlinedCharacterDefined = true;
       ProcessTypeAttribute(attribute, underlinedCharacterRun);
     }
     {
       isUnderlinedCharacterDefined = true;
       ProcessTypeAttribute(attribute, underlinedCharacterRun);
     }
-    else if(TokenComparison(XHTML_UNDERLINE_DASH_GAP_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::UNDERLINE_DASH_GAP, attribute.nameBuffer, attribute.nameLength))
     {
       isUnderlinedCharacterDefined = true;
       ProcessDashGapAttribute(attribute, underlinedCharacterRun);
     }
     {
       isUnderlinedCharacterDefined = true;
       ProcessDashGapAttribute(attribute, underlinedCharacterRun);
     }
-    else if(TokenComparison(XHTML_UNDERLINE_DASH_WIDTH_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::UNDERLINE_DASH_WIDTH, attribute.nameBuffer, attribute.nameLength))
     {
       isUnderlinedCharacterDefined = true;
       ProcessDashWidthAttribute(attribute, underlinedCharacterRun);
     }
     {
       isUnderlinedCharacterDefined = true;
       ProcessDashWidthAttribute(attribute, underlinedCharacterRun);
     }
-    else if(TokenComparison(XHTML_STRIKETHROUGH_COLOR_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::STRIKETHROUGH_COLOR, attribute.nameBuffer, attribute.nameLength))
     {
       isStrikethroughDefined = true;
       ProcessColorAttribute(attribute, strikethroughRun);
     }
     {
       isStrikethroughDefined = true;
       ProcessColorAttribute(attribute, strikethroughRun);
     }
-    else if(TokenComparison(XHTML_STRIKETHROUGH_HEIGHT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::STRIKETHROUGH_HEIGHT, attribute.nameBuffer, attribute.nameLength))
     {
       isStrikethroughDefined = true;
       ProcessHeightAttribute(attribute, strikethroughRun);
     }
     {
       isStrikethroughDefined = true;
       ProcessHeightAttribute(attribute, strikethroughRun);
     }
-    else if(TokenComparison(XHTML_CHARACTER_SPACING_VALUE_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::SPAN_ATTRIBUTES::CHARACTER_SPACING_VALUE, attribute.nameBuffer, attribute.nameLength))
     {
       isCharacterSpacingDefined = true;
       ProcessValueAttribute(attribute, characterSpacingCharacterRun);
     {
       isCharacterSpacingDefined = true;
       ProcessValueAttribute(attribute, characterSpacingCharacterRun);
index 2f0ea5d..10e104c 100644 (file)
@@ -24,6 +24,7 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/markup-processor-attribute-helper-functions.h>
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/markup-processor-attribute-helper-functions.h>
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
+#include <dali-toolkit/internal/text/markup-tags-and-attributes.h>
 #include <dali-toolkit/internal/text/strikethrough-character-run.h>
 
 namespace Dali
 #include <dali-toolkit/internal/text/strikethrough-character-run.h>
 
 namespace Dali
@@ -32,12 +33,6 @@ namespace Toolkit
 {
 namespace Text
 {
 {
 namespace Text
 {
-namespace
-{
-const std::string XHTML_COLOR_ATTRIBUTE("color");
-const std::string XHTML_HEIGHT_ATTRIBUTE("height");
-} // namespace
-
 void ProcessColorAttribute(const Attribute& attribute, StrikethroughCharacterRun& strikethroughRun)
 
 {
 void ProcessColorAttribute(const Attribute& attribute, StrikethroughCharacterRun& strikethroughRun)
 
 {
@@ -60,11 +55,11 @@ void ProcessStrikethroughTag(const Tag& tag, StrikethroughCharacterRun& striketh
   {
     const Attribute& attribute(*it);
 
   {
     const Attribute& attribute(*it);
 
-    if(TokenComparison(XHTML_COLOR_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    if(TokenComparison(MARKUP::STRIKETHROUGH_ATTRIBUTES::COLOR, attribute.nameBuffer, attribute.nameLength))
     {
       ProcessColorAttribute(attribute, strikethroughRun);
     }
     {
       ProcessColorAttribute(attribute, strikethroughRun);
     }
-    else if(TokenComparison(XHTML_HEIGHT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::STRIKETHROUGH_ATTRIBUTES::HEIGHT, attribute.nameBuffer, attribute.nameLength))
     {
       ProcessHeightAttribute(attribute, strikethroughRun);
     }
     {
       ProcessHeightAttribute(attribute, strikethroughRun);
     }
index 8f19b5a..08b9f1e 100644 (file)
@@ -24,6 +24,7 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/markup-processor-attribute-helper-functions.h>
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/markup-processor-attribute-helper-functions.h>
 #include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
+#include <dali-toolkit/internal/text/markup-tags-and-attributes.h>
 #include <dali-toolkit/internal/text/text-effects-style.h>
 #include <dali-toolkit/internal/text/underlined-character-run.h>
 
 #include <dali-toolkit/internal/text/text-effects-style.h>
 #include <dali-toolkit/internal/text/underlined-character-run.h>
 
@@ -35,12 +36,6 @@ namespace Text
 {
 namespace
 {
 {
 namespace
 {
-const std::string XHTML_COLOR_ATTRIBUTE("color");
-const std::string XHTML_HEIGHT_ATTRIBUTE("height");
-const std::string XHTML_TYPE_ATTRIBUTE("type");
-const std::string XHTML_DASH_GAP_ATTRIBUTE("dash-gap");
-const std::string XHTML_DASH_WIDTH_ATTRIBUTE("dash-width");
-
 const unsigned int MAX_TYPE_ATTRIBUTE_SIZE = 7u; ///< The maximum length of any of the possible 'type' values.
 
 } // namespace
 const unsigned int MAX_TYPE_ATTRIBUTE_SIZE = 7u; ///< The maximum length of any of the possible 'type' values.
 
 } // namespace
@@ -85,23 +80,23 @@ void ProcessUnderlineTag(const Tag& tag, UnderlinedCharacterRun& underlinedChara
   {
     const Attribute& attribute(*it);
 
   {
     const Attribute& attribute(*it);
 
-    if(TokenComparison(XHTML_COLOR_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    if(TokenComparison(MARKUP::UNDERLINE_ATTRIBUTES::COLOR, attribute.nameBuffer, attribute.nameLength))
     {
       ProcessColorAttribute(attribute, underlinedCharacterRun);
     }
     {
       ProcessColorAttribute(attribute, underlinedCharacterRun);
     }
-    else if(TokenComparison(XHTML_HEIGHT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::UNDERLINE_ATTRIBUTES::HEIGHT, attribute.nameBuffer, attribute.nameLength))
     {
       ProcessHeightAttribute(attribute, underlinedCharacterRun);
     }
     {
       ProcessHeightAttribute(attribute, underlinedCharacterRun);
     }
-    else if(TokenComparison(XHTML_TYPE_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::UNDERLINE_ATTRIBUTES::TYPE, attribute.nameBuffer, attribute.nameLength))
     {
       ProcessTypeAttribute(attribute, underlinedCharacterRun);
     }
     {
       ProcessTypeAttribute(attribute, underlinedCharacterRun);
     }
-    else if(TokenComparison(XHTML_DASH_GAP_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::UNDERLINE_ATTRIBUTES::DASH_GAP, attribute.nameBuffer, attribute.nameLength))
     {
       ProcessDashGapAttribute(attribute, underlinedCharacterRun);
     }
     {
       ProcessDashGapAttribute(attribute, underlinedCharacterRun);
     }
-    else if(TokenComparison(XHTML_DASH_WIDTH_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    else if(TokenComparison(MARKUP::UNDERLINE_ATTRIBUTES::DASH_WIDTH, attribute.nameBuffer, attribute.nameLength))
     {
       ProcessDashWidthAttribute(attribute, underlinedCharacterRun);
     }
     {
       ProcessDashWidthAttribute(attribute, underlinedCharacterRun);
     }
index 1df19ca..60eb03b 100644 (file)
@@ -36,6 +36,7 @@
 #include <dali-toolkit/internal/text/markup-processor-span.h>
 #include <dali-toolkit/internal/text/markup-processor-strikethrough.h>
 #include <dali-toolkit/internal/text/markup-processor-underline.h>
 #include <dali-toolkit/internal/text/markup-processor-span.h>
 #include <dali-toolkit/internal/text/markup-processor-strikethrough.h>
 #include <dali-toolkit/internal/text/markup-processor-underline.h>
+#include <dali-toolkit/internal/text/markup-tags-and-attributes.h>
 #include <dali-toolkit/internal/text/xhtml-entities.h>
 
 namespace Dali
 #include <dali-toolkit/internal/text/xhtml-entities.h>
 
 namespace Dali
@@ -46,25 +47,6 @@ namespace Text
 {
 namespace
 {
 {
 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          = '=';
 const char LESS_THAN      = '<';
 const char GREATER_THAN   = '>';
 const char EQUAL          = '=';
@@ -1117,12 +1099,12 @@ void ProcessMarkupString(const std::string& markupString, MarkupProcessData& mar
              markupStringEndBuffer,
              tag))
     {
              markupStringEndBuffer,
              tag))
     {
-      if(TokenComparison(XHTML_COLOR_TAG, tag.buffer, tag.length))
+      if(TokenComparison(MARKUP::TAG::COLOR, tag.buffer, tag.length))
       {
         ProcessTagForRun<ColorRun>(
           markupProcessData.colorRuns, styleStack, tag, characterIndex, colorRunIndex, colorTagReference, [](const Tag& tag, ColorRun& run) { ProcessColorTag(tag, run); });
       } // <color></color>
       {
         ProcessTagForRun<ColorRun>(
           markupProcessData.colorRuns, styleStack, tag, characterIndex, colorRunIndex, colorTagReference, [](const Tag& tag, ColorRun& run) { ProcessColorTag(tag, run); });
       } // <color></color>
-      else if(TokenComparison(XHTML_I_TAG, tag.buffer, tag.length))
+      else if(TokenComparison(MARKUP::TAG::ITALIC, tag.buffer, tag.length))
       {
         ProcessTagForRun<FontDescriptionRun>(
           markupProcessData.fontRuns, styleStack, tag, characterIndex, fontRunIndex, iTagReference, [](const Tag&, FontDescriptionRun& fontRun) {
       {
         ProcessTagForRun<FontDescriptionRun>(
           markupProcessData.fontRuns, styleStack, tag, characterIndex, fontRunIndex, iTagReference, [](const Tag&, FontDescriptionRun& fontRun) {
@@ -1130,12 +1112,12 @@ void ProcessMarkupString(const std::string& markupString, MarkupProcessData& mar
             fontRun.slantDefined = true;
           });
       } // <i></i>
             fontRun.slantDefined = true;
           });
       } // <i></i>
-      else if(TokenComparison(XHTML_U_TAG, tag.buffer, tag.length))
+      else if(TokenComparison(MARKUP::TAG::UNDERLINE, tag.buffer, tag.length))
       {
         ProcessTagForRun<UnderlinedCharacterRun>(
           markupProcessData.underlinedCharacterRuns, styleStack, tag, characterIndex, underlinedCharacterRunIndex, uTagReference, [](const Tag& tag, UnderlinedCharacterRun& run) { ProcessUnderlineTag(tag, run); });
       } // <u></u>
       {
         ProcessTagForRun<UnderlinedCharacterRun>(
           markupProcessData.underlinedCharacterRuns, styleStack, tag, characterIndex, underlinedCharacterRunIndex, uTagReference, [](const Tag& tag, UnderlinedCharacterRun& run) { ProcessUnderlineTag(tag, run); });
       } // <u></u>
-      else if(TokenComparison(XHTML_B_TAG, tag.buffer, tag.length))
+      else if(TokenComparison(MARKUP::TAG::BOLD, tag.buffer, tag.length))
       {
         ProcessTagForRun<FontDescriptionRun>(
           markupProcessData.fontRuns, styleStack, tag, characterIndex, fontRunIndex, bTagReference, [](const Tag&, FontDescriptionRun& fontRun) {
       {
         ProcessTagForRun<FontDescriptionRun>(
           markupProcessData.fontRuns, styleStack, tag, characterIndex, fontRunIndex, bTagReference, [](const Tag&, FontDescriptionRun& fontRun) {
@@ -1143,12 +1125,12 @@ void ProcessMarkupString(const std::string& markupString, MarkupProcessData& mar
             fontRun.weightDefined = true;
           });
       } // <b></b>
             fontRun.weightDefined = true;
           });
       } // <b></b>
-      else if(TokenComparison(XHTML_FONT_TAG, tag.buffer, tag.length))
+      else if(TokenComparison(MARKUP::TAG::FONT, tag.buffer, tag.length))
       {
         ProcessTagForRun<FontDescriptionRun>(
           markupProcessData.fontRuns, styleStack, tag, characterIndex, fontRunIndex, fontTagReference, [](const Tag& tag, FontDescriptionRun& fontRun) { ProcessFontTag(tag, fontRun); });
       } // <font></font>
       {
         ProcessTagForRun<FontDescriptionRun>(
           markupProcessData.fontRuns, styleStack, tag, characterIndex, fontRunIndex, fontTagReference, [](const Tag& tag, FontDescriptionRun& fontRun) { ProcessFontTag(tag, fontRun); });
       } // <font></font>
-      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);
       {
         /* Anchor */
         ProcessAnchorTag(markupProcessData, tag, characterIndex);
@@ -1166,31 +1148,31 @@ void ProcessMarkupString(const std::string& markupString, MarkupProcessData& mar
             ProcessUnderlineTag(tag, run);
           });
       } // <a href=https://www.tizen.org>tizen</a>
             ProcessUnderlineTag(tag, run);
           });
       } // <a href=https://www.tizen.org>tizen</a>
-      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.
       } // <shadow></shadow>
       {
         // 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.
       } // <shadow></shadow>
-      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.
       } // <glow></glow>
       {
         // 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.
       } // <glow></glow>
-      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.
       } // <outline></outline>
       {
         // 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.
       } // <outline></outline>
-      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);
       }
       {
         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<ColorRun>(
           markupProcessData.backgroundColorRuns, styleStack, tag, characterIndex, backgroundRunIndex, backgroundTagReference, [](const Tag& tag, ColorRun& run) { ProcessBackground(tag, run); });
       }
       {
         ProcessTagForRun<ColorRun>(
           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,
       {
         ProcessSpanForRun(tag,
                           spanStack,
@@ -1209,18 +1191,18 @@ void ProcessMarkupString(const std::string& markupString, MarkupProcessData& mar
                           characterIndex,
                           spanTagReference);
       }
                           characterIndex,
                           spanTagReference);
       }
-      else if(TokenComparison(XHTML_STRIKETHROUGH_TAG, tag.buffer, tag.length))
+      else if(TokenComparison(MARKUP::TAG::STRIKETHROUGH, tag.buffer, tag.length))
       {
         ProcessTagForRun<StrikethroughCharacterRun>(
           markupProcessData.strikethroughCharacterRuns, styleStack, tag, characterIndex, strikethroughCharacterRunIndex, sTagReference, [](const Tag& tag, StrikethroughCharacterRun& run) { ProcessStrikethroughTag(tag, run); });
       } // <s></s>
       {
         ProcessTagForRun<StrikethroughCharacterRun>(
           markupProcessData.strikethroughCharacterRuns, styleStack, tag, characterIndex, strikethroughCharacterRunIndex, sTagReference, [](const Tag& tag, StrikethroughCharacterRun& run) { ProcessStrikethroughTag(tag, run); });
       } // <s></s>
-      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<BoundedParagraphRun>(
           markupProcessData.boundedParagraphRuns, styleStack, tag, characterIndex, boundedParagraphRunIndex, pTagReference, [](const Tag& tag, BoundedParagraphRun& run) { ProcessAttributesOfParagraphTag(tag, run); });
       } // <p></p>
       {
         ProcessParagraphTag(markupProcessData, tag, (markupStringBuffer == markupStringEndBuffer), characterIndex);
         ProcessTagForRun<BoundedParagraphRun>(
           markupProcessData.boundedParagraphRuns, styleStack, tag, characterIndex, boundedParagraphRunIndex, pTagReference, [](const Tag& tag, BoundedParagraphRun& run) { ProcessAttributesOfParagraphTag(tag, run); });
       } // <p></p>
-      else if(TokenComparison(XHTML_CHARACTER_SPACING_TAG, tag.buffer, tag.length))
+      else if(TokenComparison(MARKUP::TAG::CHARACTER_SPACING, tag.buffer, tag.length))
       {
         ProcessTagForRun<CharacterSpacingCharacterRun>(
           markupProcessData.characterSpacingCharacterRuns, styleStack, tag, characterIndex, characterSpacingCharacterRunIndex, characterSpacingTagReference, [](const Tag& tag, CharacterSpacingCharacterRun& run) { ProcessCharacterSpacingTag(tag, run); });
       {
         ProcessTagForRun<CharacterSpacingCharacterRun>(
           markupProcessData.characterSpacingCharacterRuns, styleStack, tag, characterIndex, characterSpacingCharacterRunIndex, characterSpacingTagReference, [](const Tag& tag, CharacterSpacingCharacterRun& run) { ProcessCharacterSpacingTag(tag, run); });
diff --git a/dali-toolkit/internal/text/markup-tags-and-attributes.h b/dali-toolkit/internal/text/markup-tags-and-attributes.h
new file mode 100644 (file)
index 0000000..0f75d6a
--- /dev/null
@@ -0,0 +1,719 @@
+#ifndef DALI_TOOLKIT_TEXT_MARKUPS_AND_ATTRIBUTES_H
+#define DALI_TOOLKIT_TEXT_MARKUPS_AND_ATTRIBUTES_H
+
+/*
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace Text
+{
+/**
+ * @brief Use markup styling to style Text-Controller.
+ * The markup tag is opend by <> and closed by </>
+ *
+ * @details You can use markup elements to change the style of the text.
+ * Since the text controls do not process markup elements by default, you must first set the EnableMarkup property of the Text-Controller  to true:
+ *
+ * @note The markup processor does not check for markup validity, and styles are rendered in priority order.
+ * Incorrect or incompatible elements can cause the text to be rendered incorrectly.
+ */
+namespace MARKUP
+{
+namespace TAG
+{
+// 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.
+
+/**
+ * @brief Sets the color for the characters inside the element.
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<color value='red'>Hello world</color>";
+ *
+ * @endcode
+ *
+ * @see COLOR_ATTRIBUTES
+ *
+ */
+static const std::string COLOR("color");
+
+/**
+ * @brief Sets the font values for the characters inside the element.
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<font family='DejaVuSerif' size='18'>Hello world</font>";
+ *
+ * @endcode
+ *
+ * @see FONT_ATTRIBUTES
+ */
+static const std::string FONT("font");
+
+/**
+ * @brief Sets Bold decoration for the characters inside the element.
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<b>Hello world</b>";
+ *
+ * @endcode
+ *
+ * @see
+ */
+static const std::string BOLD("b");
+
+/**
+ * @brief Sets Italic decoration for the characters inside the element.
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<i>Hello world</i>";
+ *
+ * @endcode
+ *
+ */
+static const std::string ITALIC("i");
+
+/**
+ * @brief Sets the underlined values for the characters inside the element.
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<u>Hello world</u>";
+ *
+ * @endcode
+ *
+ * @see UNDERLINE_ATTRIBUTES
+ */
+static const std::string UNDERLINE("u");
+
+/**
+ * @todo Sets the shadow for the characters inside the element.
+ *
+ */
+static const std::string SHADOW("shadow"); ///< This tag under construction.
+
+/**
+ * @todo Sets the glow for the characters inside the element.
+ *
+ */
+static const std::string GLOW("glow"); ///< This tag under construction.
+
+/**
+ * @todo Sets the outline for the characters inside the element.
+ *
+ */
+static const std::string OUTLINE("outline"); ///< This tag under construction.
+
+/**
+ * @brief Defines an embedded item within the text.
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<item 'width'=26 'height'=26 'url'='path/image.png' 'color-blending'='multiply'/>";
+ *
+ * @endcode
+ *
+ * @see EMBEDDED_ITEM_ATTRIBUTES
+ */
+static const std::string EMBEDDED_ITEM("item");
+
+/**
+ * @brief Defines a hyperlink for the text inside the element.
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<a href='https://www.tizen.org'>TIZEN</a>";
+ *
+ * @endcode
+ *
+ * @see ANCHOR_ATTRIBUTES
+ */
+static const std::string ANCHOR("a");
+
+/**
+ * @brief Sets the background color for the characters inside the element.
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<background color='yellow'>Hello world</background>";
+ *
+ * @endcode
+ *
+ * @see BACKGROUND_ATTRIBUTES
+ */
+static const std::string BACKGROUND("background");
+
+/**
+ * @brief Use span tag to set many styles on character's level for the characters inside the element.
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<span font-size='20' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='green' char-space-value='10.0f'>Hello world</span>";
+ *
+ * @endcode
+ *
+ * @see SPAN_ATTRIBUTES
+ */
+static const std::string SPAN("span");
+
+/**
+ * @brief Sets the strikethrough values for the characters inside the element.
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<s>Hello world</s>";
+ *
+ * @endcode
+ *
+ * @see STRIKETHROUGH_ATTRIBUTES
+ */
+static const std::string STRIKETHROUGH("s");
+
+/**
+ * @brief Use paragraph tag to set many styles on paragraph's level for the lines inside the element.
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "test before paragraph tag <p>test paragraph tag </p>test after paragraph tag ";
+ *
+ * @endcode
+ *
+ * @see PARAGRAPH_ATTRIBUTES
+ */
+static const std::string PARAGRAPH("p");
+
+/**
+ * @brief Sets the character spacing values for the characters inside the element.
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<char-spacing value='3.0f'>Hello world</char-spacing>";
+ *
+ * @endcode
+ *
+ * @see CHARACTER_SPACING_ATTRIBUTES
+ */
+static const std::string CHARACTER_SPACING("char-spacing");
+} // namespace TAG
+
+namespace COLOR_ATTRIBUTES
+{
+/**
+ * @brief Use the value attribute to define the color.
+ * The supported attribute values are red, green, blue, yellow, magenta, cyan, white, black, and transparent.
+ * Web colors and colors represented in 32-bit hexadecimal 0xAARRGGBB format are also supported.
+ *
+ * The following examples show text in red color:
+ * @code
+ *
+ * textController.Text = "<color value='red'>Hello world</color>"; /// Color coded with a text constant
+ *
+ * @endcode
+ *
+ * @code
+ *
+ * textController.Text = "<color value='0xFFFF0000'>Hello world</color>"); /// Color packed inside an ARGB hexadecimal value
+ *
+ * @endcode
+ */
+static const std::string VALUE("value");
+} // namespace COLOR_ATTRIBUTES
+
+namespace FONT_ATTRIBUTES
+{
+/**
+ * @brief Use the family attribute to define the font name.
+ *
+ * Example:
+ * @code
+ *
+ * textController.Text = "<font family='SamsungSans' >Hello world</font>";
+ *
+ * @endcode
+ *
+ */
+static const std::string FAMILY("family");
+
+/**
+ * @brief Use the size attribute to define the font size in points.
+ *
+ * Example:
+ * @code
+ *
+ * textController.Text = "<font size='50' >Hello world</font>";
+ *
+ * @endcode
+ *
+ */
+static const std::string SIZE("size");
+
+/**
+ * @brief Use the weight attribute to define the font weight.
+ *
+ * Example:
+ * @code
+ *
+ * textController.Text = "<font weight='bold' >Hello world</font>";
+ *
+ * @endcode
+ *
+ */
+static const std::string WEIGHT("weight");
+
+/**
+ * @brief Use the width attribute to define the font width.
+ *
+ * Example:
+ * @code
+ *
+ * textController.Text = "<font width='condensed' >Hello world</font>";
+ *
+ * @endcode
+ *
+ */
+static const std::string WIDTH("width");
+
+/**
+ * @brief Use the slant attribute to define the font slant.
+ *
+ * Example:
+ * @code
+ *
+ * textController.Text = "<font slant='italic' >Hello world</font>";
+ *
+ * @endcode
+ *
+ */
+static const std::string SLANT("slant");
+} // namespace FONT_ATTRIBUTES
+
+namespace UNDERLINE_ATTRIBUTES
+{
+/**
+ * @brief Use the color attribute to define the color of underline.
+ * The supported attribute values are red, green, blue, yellow, magenta, cyan, white, black, and transparent.
+ * Web colors and colors represented in 32-bit hexadecimal 0xAARRGGBB format are also supported.
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<u color='green'>Hello world</u>";
+ *
+ * @endcode
+ */
+static const std::string COLOR("color");
+
+/**
+ * @brief Use the height attribute to define the height of underline.
+ * It is float value.
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<u height='2.0f'>Hello world</u>";
+ *
+ * @endcode
+ */
+static const std::string HEIGHT("height");
+
+/**
+ * @brief Use the type attribute to define the type of underline.
+ * The supported attribute values are solid, dashed and double
+ * The default value is solid
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<u type='double'>Hello world</u>";
+ *
+ * @endcode
+ */
+static const std::string TYPE("type");
+
+/**
+ * @brief Use the dash-gap attribute to define the dash-gap of underline.
+ * The gap in pixels between the dashes of the dashed underline. Only valid when "DASHED" underline type is used.
+ *
+ * It is float value.
+ * @note If not provided then the default gap is used (1 pixel).
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<u type='dashed' dash-gap='2.0f'>Hello world</u>";
+ *
+ * @endcode
+ */
+static const std::string DASH_GAP("dash-gap");
+
+/**
+ * @brief Use the dash-width attribute to define the dash-width of underline.
+ * The width in pixels of the dashes of the dashed underline. Only valid when "DASHED" underline type is used.
+ * It is float value.
+ * @note If not provided then the default width is used (2 pixel).
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<u type='dashed' dash-width='3.0f'>Hello world</u>";
+ *
+ * @endcode
+ */
+static const std::string DASH_WIDTH("dash-width");
+
+} // namespace UNDERLINE_ATTRIBUTES
+
+namespace SPAN_ATTRIBUTES
+{
+//NOTE: the MAX_NUM_OF_ATTRIBUTES in "markup-processor.cpp" should be updated when add a new attribute for span tag.
+
+/**
+ * @brief The font family attribute.
+ *
+ * Example:
+ * @code
+ * textController.Text = "<span font-family='SamsungSans' >Hello world</span>";
+ * @endcode
+ * @see FONT_ATTRIBUTES::FAMILY
+ */
+static const std::string FONT_FAMILY("font-family");
+
+/**
+ * @brief The font size attribute.
+ *
+ * Example:
+ * @code
+ * textController.Text = "<span font-size='50' >Hello world</span>";
+ * @endcode
+ * @see FONT_ATTRIBUTES::SIZE
+ */
+static const std::string FONT_SIZE("font-size");
+
+/**
+ * @brief The font weight attribute.
+ *
+ * Example:
+ * @code
+ * textController.Text = "<span font-weight='bold' >Hello world</span>";
+ * @endcode
+ * @see FONT_ATTRIBUTES::WEIGHT
+ */
+static const std::string FONT_WEIGHT("font-weight");
+
+/**
+ * @brief The font width attribute.
+ *
+ * Example:
+ * @code
+ * textController.Text = "<span font-width='condensed' >Hello world</span>";
+ * @endcode
+ * @see FONT_ATTRIBUTES::WIDTH
+ */
+static const std::string FONT_WIDTH("font-width");
+
+/**
+ * @brief The font slant attribute.
+ *
+ * Example:
+ * @code
+ * textController.Text = "<span font-slant='italic' >Hello world</span>";
+ * @endcode
+ * @see FONT_ATTRIBUTES::SLANT
+ */
+static const std::string FONT_SLANT("font-slant");
+
+/**
+ * @brief The color value attribute.
+ *
+ * Example:
+ * @code
+ * textController.Text = "<span text-color='blue' >Hello world</span>";
+ * @endcode
+ * @see COLOR_ATTRIBUTES::VALUE
+ */
+static const std::string TEXT_COLOR("text-color");
+
+/**
+ * @brief The background color attribute.
+ *
+ * Example:
+ * @code
+ * textController.Text = "<span background-color='yellow' >Hello world</span>";
+ * @endcode
+ * @see BACKGROUND_ATTRIBUTES::COLOR
+ */
+static const std::string BACKGROUND_COLOR("background-color");
+
+/**
+ * @brief The undeline color attribute.
+ *
+ * Example:
+ * @code
+ * textController.Text = "<span u-color='green' >Hello world</span>";
+ * @endcode
+ * @see UNDERLINE_ATTRIBUTES::COLOR
+ */
+static const std::string UNDERLINE_COLOR("u-color");
+
+/**
+ * @brief The undeline height attribute.
+ *
+ * Example:
+ * @code
+ * textController.Text = "<span u-height='3.0f' >Hello world</span>";
+ * @endcode
+ * @see UNDERLINE_ATTRIBUTES::HEIGHT
+ */
+static const std::string UNDERLINE_HEIGHT("u-height");
+
+/**
+ * @brief The undeline type attribute.
+ *
+ * Example:
+ * @code
+ * textController.Text = "<span u-type='solid' >Hello world</span>";
+ * @endcode
+ * @see UNDERLINE_ATTRIBUTES::TYPE
+ */
+static const std::string UNDERLINE_TYPE("u-type");
+
+/**
+ * @brief The undeline dash-gap attribute.
+ *
+ * Example:
+ * @code
+ * textController.Text = "<span u-type='dashed' u-dash-gap='2.0f' >Hello world</span>";
+ * @endcode
+ * @see UNDERLINE_ATTRIBUTES::DASH_GAP
+ */
+static const std::string UNDERLINE_DASH_GAP("u-dash-gap");
+
+/**
+ * @brief The undeline dash-width attribute.
+ *
+ * Example:
+ * @code
+ * textController.Text = "<span u-type='dashed' u-dash-width='4.0f' >Hello world</span>";
+ * @endcode
+ * @see UNDERLINE_ATTRIBUTES::DASH_WIDTH
+ */
+static const std::string UNDERLINE_DASH_WIDTH("u-dash-width");
+
+/**
+ * @brief The strikethrough color attribute.
+ *
+ * Example:
+ * @code
+ * textController.Text = "<span s-color='green' >Hello world</span>";
+ * @endcode
+ * @see STRIKETHROUGH_ATTRIBUTES::COLOR
+ */
+static const std::string STRIKETHROUGH_COLOR("s-color");
+
+/**
+ * @brief The strikethrough height attribute.
+ *
+ * Example:
+ * @code
+ * textController.Text = "<span s-height='3.0f' >Hello world</span>";
+ * @endcode
+ * @see STRIKETHROUGH_ATTRIBUTES::HEIGHT
+ */
+static const std::string STRIKETHROUGH_HEIGHT("s-height");
+
+/**
+ * @brief The character-spacing value attribute.
+ *
+ * Example:
+ * @code
+ * textController.Text = "<span char-space-value='5.0f' >Hello world</span>";
+ * @endcode
+ * @see CHARACTER_SPACING_ATTRIBUTES::VALUE
+ */
+static const std::string CHARACTER_SPACING_VALUE("char-space-value");
+} // namespace SPAN_ATTRIBUTES
+
+namespace STRIKETHROUGH_ATTRIBUTES
+{
+/**
+ * @brief Use the color attribute to define the color of strikethrough.
+ * The supported attribute values are red, green, blue, yellow, magenta, cyan, white, black, and transparent.
+ * Web colors and colors represented in 32-bit hexadecimal 0xAARRGGBB format are also supported.
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<s color='green'>Hello world</s>";
+ *
+ * @endcode
+ */
+static const std::string COLOR("color");
+
+/**
+ * @brief Use the height attribute to define the height of strikethrough.
+ * It is float value.
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<s height='2.0f'>Hello world</s>";
+ *
+ * @endcode
+ */
+static const std::string HEIGHT("height");
+} // namespace STRIKETHROUGH_ATTRIBUTES
+
+namespace PARAGRAPH_ATTRIBUTES
+{
+/**
+ * @brief Use the align attribute to define the horizontal alignment of paragraph.
+ * The supported attribute values are begin, center and end .
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = ""text outside<p align='end'>Paragraph end</p>text outside<p align='center'>Paragraph center</p>text outside<p align='begin' >Paragraph begin</p>";
+ *
+ * @endcode
+ */
+static const std::string ALIGN("align");
+
+/**
+ * @brief Use the rrel-line-height attribute to define the relative height of the line (a factor that will be multiplied by text height).
+ * It is float value.
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<p>line 1</p><p rel-line-height=0.5>line\n2</p>line 3<p rel-line-height=3>line\n4</p>line 5";
+ *
+ * @endcode
+ * @note If the value is less than 1, the lines could to be overlapped.
+ */
+static const std::string RELATIVE_LINE_HEIGHT("rel-line-height");
+
+} // namespace PARAGRAPH_ATTRIBUTES
+
+namespace CHARACTER_SPACING_ATTRIBUTES
+{
+/**
+ * @brief Use the value attribute to define the spaces between characters in Pixels.
+ *  A positive value will make the characters far apart (expanded) and a negative value will bring them closer (condensed).
+ *
+ * Examples:
+ * @code
+ *
+ * textController.Text = "<char-spacing value='5.0f'>Hello world</char-spacing>"; /// Expanded
+ *
+ * @endcode
+ *
+ * @code
+ *
+ * textController.Text = "<char-spacing value='-5.0f'>Hello world</char-spacing>"); /// Condensed
+ *
+ * @endcode
+ */
+static const std::string VALUE("value");
+} // namespace CHARACTER_SPACING_ATTRIBUTES
+namespace BACKGROUND_ATTRIBUTES
+{
+/**
+ * @brief Use the value attribute to define the color of background.
+ * The supported attribute values are red, green, blue, yellow, magenta, cyan, white, black, and transparent.
+ * Web colors and colors represented in 32-bit hexadecimal 0xAARRGGBB format are also supported.
+ *
+ * The following example explains how to apply it:
+ * @code
+ *
+ * textController.Text = "<background color='green'>Hello world</background>";
+ *
+ * @endcode
+ */
+static const std::string COLOR("color");
+
+} // namespace BACKGROUND_ATTRIBUTES
+
+namespace EMBEDDED_ITEM_ATTRIBUTES
+{
+/**
+ * @brief Use the url attribute to define url path of the image.
+ *
+ * @note  The url of the image is optional. If there is no image
+ * the layout engine will use the width and height to
+ * create a space inside the text. This gap can be filled later.
+ */
+static const std::string URL("url");
+
+/**
+ * @brief Use the width attribute to define the width of the item.
+ */
+static const std::string WIDTH("width");
+
+/**
+ * @brief Use the height attribute to define the height of the item.
+ */
+static const std::string HEIGHT("height");
+
+/**
+ * @brief Use the color-blending attribute to define whether the color of the image is multiplied by the color of the text.
+ *
+ * @note A color blending mode can be set. The default is NONE, the image will use its own color. If MULTIPLY is set, the color
+ * of the image will be multiplied by the color of the text.
+ */
+static const std::string COLOR_BLENDING("color-blending");
+} // namespace EMBEDDED_ITEM_ATTRIBUTES
+
+namespace ANCHOR_ATTRIBUTES
+{
+/**
+ * @brief Use the href attribute to define the url of hyperlink.
+ */
+static const std::string HREF("href");
+
+} // namespace ANCHOR_ATTRIBUTES
+
+} // namespace MARKUP
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_TEXT_MARKUPS_AND_ATTRIBUTES_H