[vlc-devel] [PATCH] ttml: correct element style resolution order

Remita Amine remitamine at gmail.com
Mon Apr 24 14:57:11 CEST 2017


the element style resolution order should start with Inline Styling
than Referential Styling than Region Style Inheritance without
overriding.

if we have:
<style xml:id="captionStyle" tts:color="red"/>
and:
<span style="captionStyle" tts:color="green">test</span>

so in the example the color should be green not red.
---
 modules/codec/ttml/substtml.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/codec/ttml/substtml.c b/modules/codec/ttml/substtml.c
index d4cca23583..3d93fba470 100644
--- a/modules/codec/ttml/substtml.c
+++ b/modules/codec/ttml/substtml.c
@@ -479,17 +479,17 @@ static ttml_style_t * InheritTTMLStyles( ttml_context_t *p_ctx, tt_node_t *p_nod
     /* Merge dics backwards without overwriting */
     for( ; p_node; p_node = p_node->p_parent )
     {
-        const char *psz_regionid = (const char *)
-                vlc_dictionary_value_for_key( &p_node->attr_dict, "region" );
-        if( psz_regionid )
-            DictMergeWithRegionID( p_ctx, psz_regionid, &merged );
+        DictionnaryMerge( &p_node->attr_dict, &merged );
 
         const char *psz_styleid = (const char *)
                 vlc_dictionary_value_for_key( &p_node->attr_dict, "style" );
         if( psz_styleid )
             DictMergeWithStyleID( p_ctx, psz_styleid, &merged );
 
-        DictionnaryMerge( &p_node->attr_dict, &merged );
+        const char *psz_regionid = (const char *)
+                vlc_dictionary_value_for_key( &p_node->attr_dict, "region" );
+        if( psz_regionid )
+            DictMergeWithRegionID( p_ctx, psz_regionid, &merged );
     }
 
     if( merged.i_size && merged.p_entries[0] && (p_ttml_style = ttml_style_New()) )
-- 
2.12.2



More information about the vlc-devel mailing list