[vlc-commits] ttml: correct element style resolution order

Remita Amine git at videolan.org
Thu Apr 27 20:15:53 CEST 2017


vlc | branch: master | Remita Amine <remitamine at gmail.com> | Mon Apr 24 13:57:11 2017 +0100| [b6e173f0d5321efe6a54ad46f9fa60fa37e2ea8f] | committer: Francois Cartegnie

ttml: correct element style resolution order

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.

Signed-off-by: Francois Cartegnie <fcvlcdev at free.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b6e173f0d5321efe6a54ad46f9fa60fa37e2ea8f
---

 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()) )



More information about the vlc-commits mailing list