Support Strikethrough with Height attribute in markup
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / markup-processor-strikethrough.cpp
index 3612461..622a624 100644 (file)
@@ -22,6 +22,7 @@
 #include <dali/public-api/common/dali-vector.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/strikethrough-character-run.h>
 
@@ -34,7 +35,8 @@ 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)
 
@@ -43,6 +45,12 @@ void ProcessColorAttribute(const Attribute& attribute, StrikethroughCharacterRun
   strikethroughRun.properties.colorDefined = true;
 }
 
+void ProcessHeightAttribute(const Attribute& attribute, StrikethroughCharacterRun& strikethroughRun)
+{
+  strikethroughRun.properties.height        = ProcessFloatAttribute(attribute);
+  strikethroughRun.properties.heightDefined = true;
+}
+
 void ProcessStrikethroughTag(const Tag& tag, StrikethroughCharacterRun& strikethroughRun)
 {
   for(Vector<Attribute>::ConstIterator it    = tag.attributes.Begin(),
@@ -51,10 +59,15 @@ void ProcessStrikethroughTag(const Tag& tag, StrikethroughCharacterRun& striketh
       ++it)
   {
     const Attribute& attribute(*it);
+
     if(TokenComparison(XHTML_COLOR_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
     {
       ProcessColorAttribute(attribute, strikethroughRun);
     }
+    else if(TokenComparison(XHTML_HEIGHT_ATTRIBUTE, attribute.nameBuffer, attribute.nameLength))
+    {
+      ProcessHeightAttribute(attribute, strikethroughRun);
+    }
   }
 }