[dali_2.3.24] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / markup-processor / markup-processor-anchor.cpp
index 87789e3..ed80c40 100644 (file)
@@ -24,6 +24,8 @@
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/internal/text/anchor.h>
+#include <dali-toolkit/internal/text/markup-processor/markup-processor-color.h>
+#include <dali-toolkit/internal/text/markup-processor/markup-processor-underline.h>
 #include <dali-toolkit/internal/text/markup-processor/markup-processor-helper-functions.h>
 #include <dali-toolkit/internal/text/markup-tags-and-attributes.h>
 
@@ -33,10 +35,12 @@ namespace Toolkit
 {
 namespace Text
 {
-void ProcessAnchor(const Tag& tag, Anchor& anchor)
-{
-  anchor.href = nullptr;
 
+void ProcessAnchorTag(const Tag&              tag,
+                      Anchor&                 anchor,
+                      ColorRun&               colorRun,
+                      UnderlinedCharacterRun& underlinedCharacterRun)
+{
   for(auto&& attribute : tag.attributes)
   {
     if(TokenComparison(MARKUP::ANCHOR_ATTRIBUTES::HREF, attribute.nameBuffer, attribute.nameLength))
@@ -47,6 +51,21 @@ void ProcessAnchor(const Tag& tag, Anchor& anchor)
       anchor.href[hrefLength - 1] = '\0';
       // The memory is freed when the font run is removed from the logical model.
     }
+    else if(TokenComparison(MARKUP::ANCHOR_ATTRIBUTES::COLOR, attribute.nameBuffer, attribute.nameLength))
+    {
+      // The markup anchor color is set on the text and underline color runs.
+      // This takes precedence over the anchor color property of the text-label.
+      ProcessColor(attribute, colorRun);
+      ProcessColorAttribute(attribute, underlinedCharacterRun);
+      anchor.isMarkupColorSet = true;
+    }
+    else if(TokenComparison(MARKUP::ANCHOR_ATTRIBUTES::CLICKED_COLOR, attribute.nameBuffer, attribute.nameLength))
+    {
+      // The markup anchor clicked color is stored here.
+      // This is later used when the anchor's click event occurs.
+      ColorStringToVector4(attribute.valueBuffer, attribute.valueLength, anchor.markupClickedColor);
+      anchor.isMarkupClickedColorSet = true;
+    }
   }
 }