[Swfdec] 3 commits - libswfdec/swfdec_html_parser.c libswfdec/swfdec_text_field_movie.c

Pekka Lampila medar at kemper.freedesktop.org
Sun Oct 21 14:00:06 PDT 2007


 libswfdec/swfdec_html_parser.c      |   16 ++++++----------
 libswfdec/swfdec_text_field_movie.c |    4 ++--
 2 files changed, 8 insertions(+), 12 deletions(-)

New commits:
commit a2bb0d97dc4aa9b6d0bb502e72a26fca924c038b
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Sun Oct 21 23:57:36 2007 +0300

    TextField: Don't apply non-left align twice when wordWrap is disabled

diff --git a/libswfdec/swfdec_text_field_movie.c b/libswfdec/swfdec_text_field_movie.c
index 034e6ab..1d3e791 100644
--- a/libswfdec/swfdec_text_field_movie.c
+++ b/libswfdec/swfdec_text_field_movie.c
@@ -515,7 +515,7 @@ swfdec_text_field_movie_get_layouts (SwfdecTextFieldMovie *text, int *num,
       }
       else
       {
-	if (block->align != PANGO_ALIGN_LEFT) {
+	if (!text->text->word_wrap && block->align != PANGO_ALIGN_LEFT) {
 	  int line_width;
 	  pango_layout_get_pixel_size (playout, &line_width, 0);
 	  if (line_width < width) {
commit 2909d64e8dfb84e2074efc85c089fe434c5b6b4c
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Sun Oct 21 23:39:28 2007 +0300

    TextField HTML: Don't close non-matching tags until a match is found after all

diff --git a/libswfdec/swfdec_html_parser.c b/libswfdec/swfdec_html_parser.c
index 305df9e..968d6ce 100644
--- a/libswfdec/swfdec_html_parser.c
+++ b/libswfdec/swfdec_html_parser.c
@@ -271,17 +271,11 @@ swfdec_text_field_movie_html_parse_tag (ParserData *data, const char *p)
 
   if (close)
   {
-    GSList *iter;
-
-    for (iter = data->tags_open; iter != NULL; iter = iter->next)
-    {
-      tag = iter->data;
-
-      swfdec_text_field_movie_html_parse_close_tag (data, tag);
-
+    if (data->tags_open != NULL) {
+      tag = data->tags_open->data;
       if (name_length == tag->name_length &&
 	  !g_strncasecmp (name, tag->name, name_length))
-	break;
+	swfdec_text_field_movie_html_parse_close_tag (data, tag);
     }
 
     end = strchr (end, '>');
commit 9d0204dd657be32a82bdd23986aceece533b9b2b
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Sun Oct 21 23:26:04 2007 +0300

    Add \r after </p> and </li> even in version > 6, if multiline is enabled
    
    Fixed an assert in swfdec_text_field_movie_html_text_append_paragraph

diff --git a/libswfdec/swfdec_html_parser.c b/libswfdec/swfdec_html_parser.c
index 5d9153a..305df9e 100644
--- a/libswfdec/swfdec_html_parser.c
+++ b/libswfdec/swfdec_html_parser.c
@@ -39,6 +39,7 @@ typedef struct {
 
 typedef struct {
   SwfdecAsContext	*cx;
+  gboolean		multiline;
   GString *		text;
   GSList *		tags_open;
   GSList *		tags_closed;
@@ -47,7 +48,7 @@ typedef struct {
 static void
 swfdec_text_field_movie_html_parse_close_tag (ParserData *data, ParserTag *tag)
 {
-  if (data->cx->version < 7 &&
+  if (data->multiline &&
       ((tag->name_length == 1 && !g_strncasecmp (tag->name, "p", 1)) ||
        (tag->name_length == 2 && !g_strncasecmp (tag->name, "li", 2))))
   {
@@ -406,6 +407,7 @@ swfdec_text_field_movie_html_parse (SwfdecTextFieldMovie *text, const char *str)
   g_return_if_fail (str != NULL);
 
   data.cx = SWFDEC_AS_OBJECT (text)->context;
+  data.multiline = (data.cx->version < 7 || text->text->multiline);
   data.text = g_string_new ("");
   data.tags_open = NULL;
   data.tags_closed = NULL;
diff --git a/libswfdec/swfdec_text_field_movie.c b/libswfdec/swfdec_text_field_movie.c
index b0e26a8..034e6ab 100644
--- a/libswfdec/swfdec_text_field_movie.c
+++ b/libswfdec/swfdec_text_field_movie.c
@@ -1237,7 +1237,7 @@ swfdec_text_field_movie_html_text_append_paragraph (SwfdecTextFieldMovie *text,
 
   g_return_val_if_fail (SWFDEC_IS_TEXT_FIELD_MOVIE (text), string);
   g_return_val_if_fail (string != NULL, string);
-  g_return_val_if_fail (start_index < end_index, string);
+  g_return_val_if_fail (start_index <= end_index, string);
 
   g_return_val_if_fail (text->formats != NULL, string);
   for (iter = text->formats; iter->next != NULL &&


More information about the Swfdec mailing list