[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-186-gbe99a003e

jonathan at claws-mail.org jonathan at claws-mail.org
Tue Sep 14 04:37:34 CEST 2021


The branch, gtk3 has been updated
       via  be99a003e1bce0232a303811b38169a2e90b56fc (commit)
       via  7ed063fd8be79264c775e5f309fd928b40d17a22 (commit)
       via  9c4b4aea5619d3f952a0af3a718a45b68710e048 (commit)
       via  1653583d591a07242f68ef0f9094a2230241fc1a (commit)
       via  b4c9e520621f46303550d3b31ffb53189f53beb1 (commit)
       via  ce62446d9de730bf5dab415094cf1f228a860861 (commit)
       via  fac24c59d7ed028f1ecb9ccae3aa759c756f7115 (commit)
       via  1205ad823850ac5d6c90df1d4390a25480f44be1 (commit)
       via  a2e991d8e8eb6d322024fe414a3f604fa67451a5 (commit)
       via  849778a7594493c7deb4706595199590b85f6c3f (commit)
       via  8446f26578496685f7426603b984cbe921f72bc8 (commit)
       via  bbe6c209ad225afe074752aa15a3ced80b85e77c (commit)
       via  73b5271fb60300c04fb173cbcf2348802bdd3506 (commit)
       via  44a873753d09c1c9e59af28161922837ff9e6a57 (commit)
       via  bc7f670ba9ea99314a53cf99592842c92c30e606 (commit)
      from  36d10734f286e20c1844184552b21f6a35df3b3f (commit)

Summary of changes:
 configure.ac                                       |  13 ++
 src/common/ssl_certificate.c                       |   6 +-
 src/compose.c                                      |  30 ++---
 src/editaddress.c                                  |   3 +-
 src/gtk/gtkcmclist.c                               |   8 +-
 src/gtk/prefswindow.c                              |   3 +-
 src/gtk/quicksearch.c                              |   3 -
 src/inc.c                                          |   2 +-
 src/main.c                                         |   2 +
 src/matcher.c                                      |   8 +-
 src/mh.c                                           |   2 +-
 src/plugins/libravatar/libravatar_missing.c        |   6 +-
 src/plugins/litehtml_viewer/Makefile.am            |   2 +-
 src/plugins/litehtml_viewer/http.cpp               |   2 +-
 src/plugins/litehtml_viewer/litehtml/Makefile.am   |   4 +-
 src/plugins/litehtml_viewer/litehtml/README.md     |  87 ++++++-------
 src/plugins/litehtml_viewer/litehtml/borders.h     |   1 +
 .../litehtml_viewer/litehtml/css_selector.cpp      |   1 +
 src/plugins/litehtml_viewer/litehtml/document.cpp  |  88 ++++++++++++-
 src/plugins/litehtml_viewer/litehtml/document.h    |   7 +-
 src/plugins/litehtml_viewer/litehtml/el_image.cpp  |  26 +++-
 src/plugins/litehtml_viewer/litehtml/el_image.h    |   2 +
 src/plugins/litehtml_viewer/litehtml/el_li.cpp     |  38 ++++++
 src/plugins/litehtml_viewer/litehtml/el_li.h       |  21 ++++
 src/plugins/litehtml_viewer/litehtml/element.cpp   |   3 +-
 src/plugins/litehtml_viewer/litehtml/element.h     |   7 +-
 src/plugins/litehtml_viewer/litehtml/html.cpp      |   4 +-
 src/plugins/litehtml_viewer/litehtml/html.h        |   2 +
 src/plugins/litehtml_viewer/litehtml/html_tag.cpp  | 137 +++++++++++++++++----
 src/plugins/litehtml_viewer/litehtml/html_tag.h    |   3 +-
 src/plugins/litehtml_viewer/litehtml/litehtml.h    |  10 +-
 .../litehtml_viewer/litehtml/media_query.cpp       |   2 +-
 src/plugins/litehtml_viewer/litehtml/num_cvt.cpp   | 109 ++++++++++++++++
 src/plugins/litehtml_viewer/litehtml/num_cvt.h     |  19 +++
 src/plugins/litehtml_viewer/litehtml/os_types.h    |  21 ++--
 src/plugins/litehtml_viewer/litehtml/style.cpp     |  26 ++--
 src/plugins/litehtml_viewer/litehtml/types.h       |   7 +-
 .../litehtml_viewer/litehtml/utf8_strings.cpp      |   2 +-
 .../litehtml_viewer/litehtml/utf8_strings.h        |  13 +-
 src/plugins/notification/notification_banner.c     |  10 --
 src/plugins/notification/notification_plugin.c     |   2 +
 src/plugins/rssyl/parse822.c                       |   2 +-
 src/plugins/rssyl/rssyl_add_item.c                 |   6 +-
 src/plugins/vcalendar/vcal_folder.c                |   2 +-
 src/plugins/vcalendar/vcal_manager.c               |   2 +-
 src/plugins/vcalendar/vcal_meeting_gtk.c           |   2 +-
 src/procmime.c                                     |   2 +-
 47 files changed, 576 insertions(+), 182 deletions(-)
 create mode 100644 src/plugins/litehtml_viewer/litehtml/el_li.cpp
 create mode 100644 src/plugins/litehtml_viewer/litehtml/el_li.h
 create mode 100644 src/plugins/litehtml_viewer/litehtml/num_cvt.cpp
 create mode 100644 src/plugins/litehtml_viewer/litehtml/num_cvt.h


- Log -----------------------------------------------------------------
commit be99a003e1bce0232a303811b38169a2e90b56fc
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Mon Sep 13 02:02:18 2021 -0700

    Fix time_t format specifier warnings

diff --git a/configure.ac b/configure.ac
index ae7cd3a16..7a60bff00 100644
--- a/configure.ac
+++ b/configure.ac
@@ -174,6 +174,19 @@ esac
 AC_MSG_RESULT([$env_cygwin])
 AM_CONDITIONAL(CYGWIN, test x"$env_cygwin" = x"yes")
 
+AC_MSG_CHECKING([for time_t format specifier])
+case "$host" in
+  x86_64-w64-mingw32)
+    time_t_fmt=lld
+    ;;
+  *)
+    time_t_fmt=ld
+    ;;
+esac
+AC_MSG_RESULT([$time_t_fmt])
+AC_DEFINE_UNQUOTED([CM_TIME_FORMAT], ["$time_t_fmt"],
+	[Define printf format specifier for time_t])
+
 if test "$GCC" = "yes"
 then
 	CFLAGS="$CFLAGS -Wno-unused-function"
diff --git a/src/matcher.c b/src/matcher.c
index 655e32051..f63bcb02c 100644
--- a/src/matcher.c
+++ b/src/matcher.c
@@ -951,11 +951,11 @@ static gboolean matcherprop_match(MatcherProp *prop,
 				&& prefs_common.filtering_debug_level >= FILTERING_DEBUG_LEVEL_HIGH) {
 			if (ret) {
 				log_print(LOG_DEBUG_FILTERING,
-						"message date [ %"G_GSIZE_FORMAT" ] is after [ %d ]\n",
+						"message date [ %" CM_TIME_FORMAT " ] is after [ %d ]\n",
 						info->date_t, prop->value);
 			} else {
 				log_print(LOG_DEBUG_FILTERING,
-						"message date [ %ld ] is not after [ %d ]\n",
+						"message date [ %" CM_TIME_FORMAT " ] is not after [ %d ]\n",
 						info->date_t, prop->value);
 			}
 		}
@@ -999,11 +999,11 @@ static gboolean matcherprop_match(MatcherProp *prop,
 				&& prefs_common.filtering_debug_level >= FILTERING_DEBUG_LEVEL_HIGH) {
 			if (ret) {
 				log_print(LOG_DEBUG_FILTERING,
-						"message date [ %ld ] is before [ %d ]\n",
+						"message date [ %" CM_TIME_FORMAT " ] is before [ %d ]\n",
 						info->date_t, prop->value);
 			} else {
 				log_print(LOG_DEBUG_FILTERING,
-						"message date [ %ld ] is not before [ %d ]\n",
+						"message date [ %" CM_TIME_FORMAT " ] is not before [ %d ]\n",
 						info->date_t, prop->value);
 			}
 		}
diff --git a/src/mh.c b/src/mh.c
index 85be5e907..42b0e49f4 100644
--- a/src/mh.c
+++ b/src/mh.c
@@ -1468,6 +1468,6 @@ static void mh_set_mtime(Folder *folder, FolderItem *item)
 	}
 
 	item->mtime = s.st_mtime;
-	debug_print("MH: forced mtime of %s to %"G_GSIZE_FORMAT"\n", item->name?item->name:"(null)", item->mtime);
+	debug_print("MH: forced mtime of %s to %"CM_TIME_FORMAT"\n", item->name?item->name:"(null)", item->mtime);
 	g_free(path);
 }
diff --git a/src/plugins/libravatar/libravatar_missing.c b/src/plugins/libravatar/libravatar_missing.c
index 9878bab28..cc4ae30a6 100644
--- a/src/plugins/libravatar/libravatar_missing.c
+++ b/src/plugins/libravatar/libravatar_missing.c
@@ -83,7 +83,7 @@ close_exit:
 static void missing_save_item(gpointer key, gpointer value, gpointer data)
 {
 	FILE *file = (FILE *)data;
-	gchar *line = g_strdup_printf("%s %"G_GSIZE_FORMAT"\n", (gchar *)key, *(time_t *)value);
+	gchar *line = g_strdup_printf("%s %"CM_TIME_FORMAT"\n", (gchar *)key, *(time_t *)value);
 	if (claws_fputs(line, file) < 0)
 		g_warning("error saving missing item");
 	g_free(line);
@@ -138,10 +138,10 @@ void missing_add_md5(GHashTable *table, const gchar *md5)
 		seen = g_malloc0(sizeof(time_t));
 		*seen = t;
 		g_hash_table_insert(table, g_strdup(md5), seen);
-		debug_print("New md5 %s added with time %"G_GSIZE_FORMAT"\n", md5, t);
+		debug_print("New md5 %s added with time %"CM_TIME_FORMAT"\n", md5, t);
 	} else {
 		*seen = t; /* just update */
-		debug_print("Updated md5 %s with time %"G_GSIZE_FORMAT"\n", md5, t);
+		debug_print("Updated md5 %s with time %"CM_TIME_FORMAT"\n", md5, t);
 	}
 }
 
diff --git a/src/plugins/rssyl/parse822.c b/src/plugins/rssyl/parse822.c
index efbf7450e..c675e4376 100644
--- a/src/plugins/rssyl/parse822.c
+++ b/src/plugins/rssyl/parse822.c
@@ -138,7 +138,7 @@ FeedItem *rssyl_parse_folder_item_file(gchar *path)
 				/* Last-Seen timestamp */
 				if( !strcmp(line[0], "X-RSSyl-Last-Seen") ) {
 					ctx->last_seen = atol(line[1]);
-					debug_print("RSSyl: got last_seen timestamp %"G_GSIZE_FORMAT"\n", ctx->last_seen);
+					debug_print("RSSyl: got last_seen timestamp %"CM_TIME_FORMAT"\n", ctx->last_seen);
 				}
 
 				/* ID */
diff --git a/src/plugins/rssyl/rssyl_add_item.c b/src/plugins/rssyl/rssyl_add_item.c
index 8621b32c8..bafc817b8 100644
--- a/src/plugins/rssyl/rssyl_add_item.c
+++ b/src/plugins/rssyl/rssyl_add_item.c
@@ -314,13 +314,13 @@ void rssyl_add_item(RFolderItem *ritem, FeedItem *feed_item)
 	/* If one of the timestamps is empty, set it to value of the other one. */
 	if( feed_item_get_date_modified(feed_item) == -1 &&
 			feed_item_get_date_published(feed_item) >= 0 ) {
-		debug_print("RSSyl: setting missing moddate to pubdate %"G_GSIZE_FORMAT"\n",
+		debug_print("RSSyl: setting missing moddate to pubdate %"CM_TIME_FORMAT"\n",
 				feed_item_get_date_published(feed_item));
 		feed_item_set_date_modified(feed_item,
 				feed_item_get_date_published(feed_item));
 	} else if( feed_item_get_date_published(feed_item) == -1 &&
 			feed_item_get_date_modified(feed_item) >= 0 ) {
-		debug_print("RSSyl: setting missing pubdate to modddate %"G_GSIZE_FORMAT"\n",
+		debug_print("RSSyl: setting missing pubdate to modddate %"CM_TIME_FORMAT"\n",
 				feed_item_get_date_modified(feed_item));
 		feed_item_set_date_published(feed_item,
 				feed_item_get_date_modified(feed_item));
@@ -328,7 +328,7 @@ void rssyl_add_item(RFolderItem *ritem, FeedItem *feed_item)
 			feed_item_get_date_published(feed_item) == -1 &&
 			feed_item_get_sourcedate(feed_item) >= 0 ) {
 		/* If neither item date is set, use date from source (Atom only). */
-		debug_print("RSSyl: setting missing pubdate and moddate to feed source date %"G_GSIZE_FORMAT"\n",
+		debug_print("RSSyl: setting missing pubdate and moddate to feed source date %"CM_TIME_FORMAT"\n",
 				feed_item_get_sourcedate(feed_item));
 		feed_item_set_date_modified(feed_item,
 				feed_item_get_sourcedate(feed_item));
diff --git a/src/plugins/vcalendar/vcal_folder.c b/src/plugins/vcalendar/vcal_folder.c
index 82c8feded..86ea99527 100644
--- a/src/plugins/vcalendar/vcal_folder.c
+++ b/src/plugins/vcalendar/vcal_folder.c
@@ -1170,7 +1170,7 @@ static void vcal_set_mtime(Folder *folder, FolderItem *item)
 	}
 
 	item->mtime = s.st_mtime;
-	debug_print("VCAL: forced mtime of %s to %"G_GSIZE_FORMAT"\n",
+	debug_print("VCAL: forced mtime of %s to %"CM_TIME_FORMAT"\n",
 			item->name?item->name:"(null)", item->mtime);
 	g_free(path);
 }
diff --git a/src/plugins/vcalendar/vcal_manager.c b/src/plugins/vcalendar/vcal_manager.c
index c851cf636..f49271ce2 100644
--- a/src/plugins/vcalendar/vcal_manager.c
+++ b/src/plugins/vcalendar/vcal_manager.c
@@ -926,7 +926,7 @@ void vcal_manager_save_event (VCalEvent *event, gboolean export_after)
 	xml_tag_add_attr(tag, xml_attr_new("type", tmp));
 	g_free(tmp);
 	
-	tmp = g_strdup_printf("%"G_GSIZE_FORMAT, event->postponed);
+	tmp = g_strdup_printf("%"CM_TIME_FORMAT, event->postponed);
 	xml_tag_add_attr(tag, xml_attr_new("postponed", tmp));
 	g_free(tmp);
 	
diff --git a/src/plugins/vcalendar/vcal_meeting_gtk.c b/src/plugins/vcalendar/vcal_meeting_gtk.c
index af39bf0cc..fa4ed2dac 100644
--- a/src/plugins/vcalendar/vcal_meeting_gtk.c
+++ b/src/plugins/vcalendar/vcal_meeting_gtk.c
@@ -1838,7 +1838,7 @@ void multisync_export(void)
 	list = vcal_folder_get_waiting_events();
 	for (cur = list; cur; cur = cur->next) {
 		VCalEvent *event = (VCalEvent *)cur->data;
-		file = g_strdup_printf("multisync%"G_GSIZE_FORMAT"-%d",
+		file = g_strdup_printf("multisync%"CM_TIME_FORMAT"-%d",
 				time(NULL), i);
 
 		i++;

commit 7ed063fd8be79264c775e5f309fd928b40d17a22
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Mon Sep 13 01:25:35 2021 -0700

    Fix -Wmaybe-uninitialized warning

diff --git a/src/inc.c b/src/inc.c
index a085cc0d8..e33fb9cee 100644
--- a/src/inc.c
+++ b/src/inc.c
@@ -417,7 +417,7 @@ void inc_all_account_mail(MainWindow *mainwin, gboolean autocheck,
 			  gboolean check_at_startup, gboolean notify)
 {
 	GList *list, *list2 = NULL;
-	gboolean condition;
+	gboolean condition = FALSE;
 	gboolean hide_dialog = FALSE;
 
 	debug_print("INC: inc_all_account_mail(), autocheck: %s\n",

commit 9c4b4aea5619d3f952a0af3a718a45b68710e048
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Mon Sep 13 01:19:02 2021 -0700

    Fix litehtml warnings

diff --git a/src/plugins/litehtml_viewer/litehtml/html_tag.cpp b/src/plugins/litehtml_viewer/litehtml/html_tag.cpp
index 9937fbbe2..f33b59901 100644
--- a/src/plugins/litehtml_viewer/litehtml/html_tag.cpp
+++ b/src/plugins/litehtml_viewer/litehtml/html_tag.cpp
@@ -3064,6 +3064,8 @@ litehtml::tstring litehtml::html_tag::get_list_marker_text(int index)
 		break;
 	case litehtml::list_style_type_katakana_iroha:
 		break;
+	default:
+		break;
 	}
 	return _t("");
 }
@@ -3145,14 +3147,10 @@ void litehtml::html_tag::render_positioned(render_type rt)
 		{
 			int parent_height	= 0;
 			int parent_width	= 0;
-			int client_x		= 0;
-			int client_y		= 0;
 			if(el_position == element_position_fixed)
 			{
 				parent_height	= wnd_position.height;
 				parent_width	= wnd_position.width;
-				client_x		= wnd_position.left();
-				client_y		= wnd_position.top();
 			} else
 			{
 				element::ptr el_parent = el->parent();
@@ -4571,7 +4569,6 @@ int litehtml::html_tag::render_table(int x, int y, int max_width, bool second_pa
 		min_height = (int)m_css_min_height.val();
 	}
 
-	int extra_row_height = 0;
 	int minimum_table_height = std::max(block_height, min_height);
 
 	m_grid->calc_rows_height(minimum_table_height - table_height_spacing, m_border_spacing_y);

commit 1653583d591a07242f68ef0f9094a2230241fc1a
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Mon Sep 13 01:03:32 2021 -0700

    Fix wrong return value

diff --git a/src/procmime.c b/src/procmime.c
index a51782f6d..4e1ae1728 100644
--- a/src/procmime.c
+++ b/src/procmime.c
@@ -894,7 +894,7 @@ FILE *procmime_get_binary_content(MimeInfo *mimeinfo)
 	tmpfile = procmime_get_tmp_file_name(mimeinfo);
 	if (tmpfile == NULL) {
 		g_warning("no filename");
-		return TRUE;
+		return NULL;
 	}
 
 	outfp = claws_fopen(tmpfile, "w+");

commit b4c9e520621f46303550d3b31ffb53189f53beb1
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Mon Sep 13 00:59:25 2021 -0700

    Fix size_t format specifier warnings

diff --git a/src/common/ssl_certificate.c b/src/common/ssl_certificate.c
index b56e8042f..dc61960a7 100644
--- a/src/common/ssl_certificate.c
+++ b/src/common/ssl_certificate.c
@@ -179,11 +179,7 @@ static void gnutls_export_X509_fp(FILE *fp, gnutls_x509_crt_t x509_cert, gnutls_
 		g_warning("couldn't export cert %s (%"G_GSIZE_FORMAT")", gnutls_strerror(r), cert_size);
 		return;
 	}
-#ifdef G_OS_WIN32
-	debug_print("writing %Iu bytes\n",cert_size);
-#else
-	debug_print("writing %zd bytes\n",cert_size);
-#endif
+	debug_print("writing %" G_GSIZE_FORMAT " bytes\n",cert_size);
 	if (claws_fwrite(&output, 1, cert_size, fp) < cert_size) {
 		g_warning("failed to write cert: %d %s", errno, g_strerror(errno));
 	}
diff --git a/src/compose.c b/src/compose.c
index 92db4a8bf..f75057bef 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -5843,11 +5843,7 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool
 		encoding = ENC_QUOTED_PRINTABLE;
 	}
 
-#ifdef G_OS_WIN32
-	debug_print("main text: %Id bytes encoded as %s in %d\n",
-#else
-	debug_print("main text: %zd bytes encoded as %s in %d\n",
-#endif
+	debug_print("main text: %" G_GSIZE_FORMAT " bytes encoded as %s in %d\n",
 		strlen(buf), out_codeset, encoding);
 
 	/* check for line length limit */
diff --git a/src/plugins/litehtml_viewer/http.cpp b/src/plugins/litehtml_viewer/http.cpp
index 453a56c7b..3d97c99d0 100644
--- a/src/plugins/litehtml_viewer/http.cpp
+++ b/src/plugins/litehtml_viewer/http.cpp
@@ -111,7 +111,7 @@ GInputStream *http::load_url(const gchar *url, GError **error)
 			_error = g_error_new_literal(G_FILE_ERROR, res, curl_easy_strerror(res));
 			g_object_unref(data.memory);
 		} else {
-			debug_print("Image size: %d\n", data.size);
+			debug_print("Image size: %" G_GSIZE_FORMAT "\n", data.size);
 			stream = data.memory;
 		}
 	}

commit ce62446d9de730bf5dab415094cf1f228a860861
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Mon Sep 13 00:53:29 2021 -0700

    Fix missing GTK casts

diff --git a/src/compose.c b/src/compose.c
index 535d9013c..92db4a8bf 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -9172,7 +9172,8 @@ static void compose_destroy(Compose *compose)
 #endif
 
 	if (!compose->batch) {
-		gtk_window_get_size(compose->window, &allocation.width, &allocation.height);
+		gtk_window_get_size(GTK_WINDOW(compose->window),
+			&allocation.width, &allocation.height);
 		prefs_common.compose_width = allocation.width;
 		prefs_common.compose_height = allocation.height;
 	}
diff --git a/src/editaddress.c b/src/editaddress.c
index ccde9b26a..861b03b76 100644
--- a/src/editaddress.c
+++ b/src/editaddress.c
@@ -877,7 +877,8 @@ static void addressbook_edit_person_dialog_create( gboolean *cancelled ) {
 
 	gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
 				      GDK_HINT_MIN_SIZE);
-	gtk_window_set_default_size(window, prefs_common.addressbookeditpersonwin_width,
+	gtk_window_set_default_size(GTK_WINDOW(window),
+				    prefs_common.addressbookeditpersonwin_width,
 				    prefs_common.addressbookeditpersonwin_height);
 
 	personeditdlg.container  = window;
diff --git a/src/gtk/gtkcmclist.c b/src/gtk/gtkcmclist.c
index f27d78647..b32af24d6 100644
--- a/src/gtk/gtkcmclist.c
+++ b/src/gtk/gtkcmclist.c
@@ -5672,7 +5672,7 @@ draw_row (GtkCMCList     *clist,
   cm_return_if_fail (clist != NULL);
 
   if (clist->draw_now) {
-      gtk_widget_queue_draw(clist);
+      gtk_widget_queue_draw(GTK_WIDGET(clist));
       return;
   }
 
@@ -5968,7 +5968,7 @@ draw_rows (GtkCMCList     *clist,
       cairo_fill(cr);
       cairo_destroy(cr);
     } else {
-      gtk_widget_queue_draw(clist);
+      gtk_widget_queue_draw(GTK_WIDGET(clist));
     }
   }
 }
@@ -6544,7 +6544,7 @@ gtk_cmclist_draw_focus (GtkWidget *widget)
       cairo_stroke(cr);
       cairo_destroy(cr);
     } else {
-      gtk_widget_queue_draw(clist);
+      gtk_widget_queue_draw(GTK_WIDGET(clist));
     }
   }
 }
@@ -6577,7 +6577,7 @@ gtk_cmclist_undraw_focus (GtkWidget *widget)
       cairo_stroke(cr);
       cairo_destroy(cr);
     } else {
-      gtk_widget_queue_draw(clist);
+      gtk_widget_queue_draw(GTK_WIDGET(clist));
     }
   }
 

commit fac24c59d7ed028f1ecb9ccae3aa759c756f7115
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Mon Sep 13 00:30:27 2021 -0700

    GPid is a HANDLE on Windows

diff --git a/src/compose.c b/src/compose.c
index 4e80eab15..535d9013c 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -203,6 +203,12 @@ typedef enum {
 			   "message."));						\
 }
 
+#ifdef G_OS_WIN32
+#define INVALID_PID INVALID_HANDLE_VALUE
+#else
+#define INVALID_PID -1
+#endif
+
 static GdkRGBA default_header_bgcolor =
 	{0, 0, 0, 1};
 
@@ -8251,7 +8257,7 @@ static Compose *compose_create(PrefsAccount *account,
 	compose->sig_str = NULL;
 
 	compose->exteditor_file    = NULL;
-	compose->exteditor_pid     = -1;
+	compose->exteditor_pid     = INVALID_PID;
 	compose->exteditor_tag     = -1;
 	compose->exteditor_socket  = NULL;
 	compose->draft_timeout_tag = COMPOSE_DRAFT_TIMEOUT_FORBIDDEN; /* inhibit auto-drafting while loading */
@@ -9737,7 +9743,7 @@ static void compose_ext_editor_closed_cb(GPid pid, gint exit_status, gpointer da
 
 	g_free(compose->exteditor_file);
 	compose->exteditor_file    = NULL;
-	compose->exteditor_pid     = -1;
+	compose->exteditor_pid     = INVALID_PID;
 	compose->exteditor_tag     = -1;
 	if (compose->exteditor_socket) {
 		gtk_widget_destroy(compose->exteditor_socket);
@@ -9781,7 +9787,7 @@ static gboolean compose_ext_editor_kill(Compose *compose)
 		msg = g_strdup_printf
 			(_("The external editor is still working.\n"
 			   "Force terminating the process?\n"
-			   "process id: %d"), pid);
+			   "process id: %" G_PID_FORMAT), pid);
 		val = alertpanel_full(_("Notice"), msg, _("_No"), _("_Yes"),
 		      		      NULL, ALERTFOCUS_FIRST, FALSE, NULL,
 				      ALERT_WARNING);
@@ -9799,7 +9805,7 @@ static gboolean compose_ext_editor_kill(Compose *compose)
 			waitpid(compose->exteditor_pid, NULL, 0);
 #endif /* G_OS_WIN32 */
 
-			g_warning("terminated process id: %d, "
+			g_warning("terminated process id: %" G_PID_FORMAT ", "
 				  "temporary file: %s", pid, compose->exteditor_file);
 			g_spawn_close_pid(compose->exteditor_pid);
 
@@ -9807,7 +9813,7 @@ static gboolean compose_ext_editor_kill(Compose *compose)
 
 			g_free(compose->exteditor_file);
 			compose->exteditor_file    = NULL;
-			compose->exteditor_pid     = -1;
+			compose->exteditor_pid     = INVALID_PID;
 			compose->exteditor_tag     = -1;
 		} else
 			return FALSE;

commit 1205ad823850ac5d6c90df1d4390a25480f44be1
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Sun Sep 12 23:56:56 2021 -0700

    Fix -Wunused-variable warnings

diff --git a/src/compose.c b/src/compose.c
index 70988de11..4e80eab15 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -9595,14 +9595,14 @@ static gboolean compose_can_autosave(Compose *compose)
 static void compose_exec_ext_editor(Compose *compose)
 {
 	gchar *tmp;
-	GtkWidget *socket;
 #ifndef G_OS_WIN32
+	GtkWidget *socket;
 	Window socket_wid = 0;
+	gchar *p, *s;
 #endif /* G_OS_WIN32 */
 	GPid pid;
 	GError *error = NULL;
 	gchar *cmd;
-	gchar *p, *s;
 	gchar **argv;
 
 	tmp = g_strdup_printf("%s%ctmpmsg.%p", get_tmp_dir(),
@@ -9773,7 +9773,6 @@ static gboolean compose_get_ext_editor_cmd_valid()
 static gboolean compose_ext_editor_kill(Compose *compose)
 {
 	GPid pid = compose->exteditor_pid;
-	gint ret;
 
 	if (pid > 0) {
 		AlertValue val;

commit a2e991d8e8eb6d322024fe414a3f604fa67451a5
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Sun Sep 12 23:50:02 2021 -0700

    Fix -Wunused-but-set-variable warnings

diff --git a/src/gtk/prefswindow.c b/src/gtk/prefswindow.c
index 665035ad5..899cee8db 100644
--- a/src/gtk/prefswindow.c
+++ b/src/gtk/prefswindow.c
@@ -253,7 +253,7 @@ static gint prefswindow_tree_sort_by_weight(GtkTreeModel *model,
 
 static void prefswindow_build_page(PrefsWindow *prefswindow, PrefsPage *page)
 {
-	GtkWidget *scrolledwin, *tmp;
+	GtkWidget *scrolledwin;
 
 	if (!page->page_open) {
 		scrolledwin = gtk_scrolled_window_new(NULL, NULL);
@@ -265,7 +265,6 @@ static void prefswindow_build_page(PrefsWindow *prefswindow, PrefsPage *page)
 		gtk_container_add(GTK_CONTAINER(scrolledwin), page->widget);
 
 		gtk_container_add(GTK_CONTAINER(prefswindow->notebook), scrolledwin);
-		tmp = gtk_bin_get_child(GTK_BIN(scrolledwin));
 
 		page->widget	= scrolledwin;
 		page->page_open	= TRUE;
diff --git a/src/gtk/quicksearch.c b/src/gtk/quicksearch.c
index 6ba924203..a308885cb 100644
--- a/src/gtk/quicksearch.c
+++ b/src/gtk/quicksearch.c
@@ -1044,7 +1044,6 @@ void quicksearch_show(QuickSearch *quicksearch)
 {
 	gint active_type;
 	MainWindow *mainwin = mainwindow_get_mainwindow();
-	GtkWidget *ctree = NULL;
 	gtk_widget_show(quicksearch->hbox_search);
 	update_extended_buttons(quicksearch);
 	gtk_widget_grab_focus(quicksearch->search_string_entry);
@@ -1053,8 +1052,6 @@ void quicksearch_show(QuickSearch *quicksearch)
 		return;
 	}
 	
-	ctree = summary_get_main_widget(mainwin->summaryview);
-	
 	active_type = prefs_common_get_prefs()->summary_quicksearch_type;
 	quicksearch_set_type(quicksearch, active_type);
 }
diff --git a/src/plugins/notification/notification_banner.c b/src/plugins/notification/notification_banner.c
index 99d12df76..9ebbe5e2a 100644
--- a/src/plugins/notification/notification_banner.c
+++ b/src/plugins/notification/notification_banner.c
@@ -468,16 +468,6 @@ static gboolean notification_banner_button_press(GtkWidget *widget,
 static void notification_banner_show_popup(GtkWidget *widget,
 					   GdkEventButton *event)
 {
-	int button, event_time;
-
-	if (event) {
-		button = event->button;
-		event_time = event->time;
-	} else {
-		button = 0;
-		event_time = gtk_get_current_event_time();
-	}
-
   	gtk_menu_popup_at_pointer(GTK_MENU(banner_popup), NULL);
 }
 

commit 849778a7594493c7deb4706595199590b85f6c3f
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Sun Sep 12 23:23:00 2021 -0700

    Add glib version check for g_thread_supported

diff --git a/src/main.c b/src/main.c
index e53ccd50e..642649c02 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1180,9 +1180,11 @@ int main(int argc, char *argv[])
 	/* Create container for all the menus we will be adding */
 	MENUITEM_ADDUI("/", "Menus", NULL, GTK_UI_MANAGER_MENUBAR);
 
+#if !GLIB_CHECK_VERSION(2,32,0)
 	if (!g_thread_supported()) {
 		g_error("g_thread is not supported by glib");
 	}
+#endif
 
 #ifdef G_OS_WIN32
 	CHDIR_EXEC_CODE_RETURN_VAL_IF_FAIL(get_home_dir(), 1, win32_close_log(););
diff --git a/src/plugins/notification/notification_plugin.c b/src/plugins/notification/notification_plugin.c
index 6fad9c50c..e9151bd1a 100644
--- a/src/plugins/notification/notification_plugin.c
+++ b/src/plugins/notification/notification_plugin.c
@@ -220,11 +220,13 @@ gint plugin_init(gchar **error)
 			   VERSION_NUMERIC, _("Notification"), error))
     return -1;
 
+#if !GLIB_CHECK_VERSION(2,32,0)
   /* Check if threading is enabled */
   if(!g_thread_supported()) {
     *error = g_strdup(_("The Notification plugin needs threading support."));
     return -1;
   }
+#endif
 
   hook_f_item = hooks_register_hook(FOLDER_ITEM_UPDATE_HOOKLIST,
 				    my_folder_item_update_hook, NULL);

commit 8446f26578496685f7426603b984cbe921f72bc8
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Sun Sep 12 21:25:07 2021 -0700

    Remove unneeded define for litehtml

diff --git a/src/plugins/litehtml_viewer/Makefile.am b/src/plugins/litehtml_viewer/Makefile.am
index 2f3b634eb..fcee147f6 100644
--- a/src/plugins/litehtml_viewer/Makefile.am
+++ b/src/plugins/litehtml_viewer/Makefile.am
@@ -32,7 +32,7 @@ plugin_ldflags += \
 	-export-symbols $(srcdir)/plugin.def
 plugin_extra_deps += libclaws.a version.lo plugin.def
 plugin_libadd += -L. -lclaws
-plugin_cppflags += -DWIN32 -DLITEHTML_UTF8
+plugin_cppflags += -DLITEHTML_UTF8
 
 endif
 
diff --git a/src/plugins/litehtml_viewer/litehtml/Makefile.am b/src/plugins/litehtml_viewer/litehtml/Makefile.am
index 1a5144d2b..7a539fecd 100644
--- a/src/plugins/litehtml_viewer/litehtml/Makefile.am
+++ b/src/plugins/litehtml_viewer/litehtml/Makefile.am
@@ -4,7 +4,7 @@
 # See COPYING file for license details.
 
 if OS_WIN32
-lh_cppflags = -DWIN32 -DLITEHTML_UTF8
+lh_cppflags = -DLITEHTML_UTF8
 else
 lh_cppflags =
 endif

commit bbe6c209ad225afe074752aa15a3ced80b85e77c
Author: paul <paul at claws-mail.org>
Date:   Tue Aug 3 12:10:01 2021 +0100

    fix bug 4312, 'litehtml plugin loops (hangup)'
    
    patch by Frank Mueller
    
    (cherry picked from commit 00d0212ccbcaa608a91c5f3a50639fed98f654c6)

diff --git a/src/plugins/litehtml_viewer/litehtml/html_tag.cpp b/src/plugins/litehtml_viewer/litehtml/html_tag.cpp
index f3524dfc9..9937fbbe2 100644
--- a/src/plugins/litehtml_viewer/litehtml/html_tag.cpp
+++ b/src/plugins/litehtml_viewer/litehtml/html_tag.cpp
@@ -4014,6 +4014,9 @@ int litehtml::html_tag::render_box(int x, int y, int max_width, bool second_pass
 {
 	int parent_width = max_width;
 
+	if (max_width <= 0)
+		return 0;
+
 	calc_outlines(parent_width);
 
 	m_pos.clear();

commit 73b5271fb60300c04fb173cbcf2348802bdd3506
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Sun Sep 12 21:28:48 2021 -0700

    Add updated fix for litehtml os_types.h
    
    Original fix from b1bc36d2f7ca19cd61e335561d2a44c421ba9678

diff --git a/src/plugins/litehtml_viewer/litehtml/os_types.h b/src/plugins/litehtml_viewer/litehtml/os_types.h
index e3b18e648..53fd76643 100644
--- a/src/plugins/litehtml_viewer/litehtml/os_types.h
+++ b/src/plugins/litehtml_viewer/litehtml/os_types.h
@@ -51,11 +51,14 @@ namespace litehtml
 
 #endif
 
+/*
 	#ifdef _WIN64
 		typedef unsigned __int64 uint_ptr;
 	#else
 		typedef unsigned int	uint_ptr;
 	#endif
+*/
+	typedef std::uintptr_t			uint_ptr;
 
 #else
 	#define LITEHTML_UTF8

commit 44a873753d09c1c9e59af28161922837ff9e6a57
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Wed Apr 10 21:12:57 2019 +0200

    Add a getter for litehtml::document's m_over_element member
    
    This allows us to avoid some expensive GDK calls in
    lh_widget::set_cursor().
    
    (cherry picked from commit 7c6693d7085636df23c44d1b40895f0e43c1f166)

diff --git a/src/plugins/litehtml_viewer/litehtml/document.h b/src/plugins/litehtml_viewer/litehtml/document.h
index a5c152c38..cb297e991 100644
--- a/src/plugins/litehtml_viewer/litehtml/document.h
+++ b/src/plugins/litehtml_viewer/litehtml/document.h
@@ -89,6 +89,7 @@ namespace litehtml
 		bool							on_mouse_leave(position::vector& redraw_boxes);
 		litehtml::element::ptr			create_element(const tchar_t* tag_name, const string_map& attributes);
 		element::ptr					root();
+		const element::ptr					over_element() const;
 		void							get_fixed_boxes(position::vector& fixed_boxes);
 		void							add_fixed_box(const position& pos);
 		void							add_media_list(media_query_list::ptr list);
@@ -118,6 +119,10 @@ namespace litehtml
 	{
 		return m_root;
 	}
+	inline const element::ptr document::over_element() const
+	{
+		return m_over_element;
+	}
 	inline void document::add_tabular(const element::ptr& el)
 	{
 		m_tabular_elements.push_back(el);

commit bc7f670ba9ea99314a53cf99592842c92c30e606
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Sun Sep 12 20:40:02 2021 -0700

    Sync with upstream litehtml
    
    Sync with commit 294780d910607850e91f3a066561bbbce03d1aaf

diff --git a/src/plugins/litehtml_viewer/litehtml/Makefile.am b/src/plugins/litehtml_viewer/litehtml/Makefile.am
index e88fef5e3..1a5144d2b 100644
--- a/src/plugins/litehtml_viewer/litehtml/Makefile.am
+++ b/src/plugins/litehtml_viewer/litehtml/Makefile.am
@@ -36,6 +36,7 @@ liblitehtml_la_SOURCES = \
 	element.cpp element.h \
 	el_font.cpp el_font.h \
 	el_image.cpp el_image.h \
+	el_li.cpp el_li.h \
 	el_link.cpp el_link.h \
 	el_para.cpp el_para.h \
 	el_script.cpp el_script.h \
@@ -51,6 +52,7 @@ liblitehtml_la_SOURCES = \
 	iterators.cpp iterators.h \
 	litehtml.h \
 	media_query.cpp media_query.h \
+	num_cvt.cpp num_cvt.h \
 	os_types.h \
 	style.cpp style.h \
 	stylesheet.cpp stylesheet.h \
diff --git a/src/plugins/litehtml_viewer/litehtml/README.md b/src/plugins/litehtml_viewer/litehtml/README.md
index 86be96ebf..293f591bc 100644
--- a/src/plugins/litehtml_viewer/litehtml/README.md
+++ b/src/plugins/litehtml_viewer/litehtml/README.md
@@ -1,42 +1,45 @@
-#What is litehtml?
-
-**litehtml** is the lightweight HTML rendering engine with CSS2/CSS3 support. Note, **litehtml** itself does not draw any text, pictures or other graphics and **litehtml** does not depend of any image/draw/font library. You are free to use any library to draw images, fonts and any other graphics. **litehtml** just parses HTML/CSS and places the HTML elements into right position (renders HTML). To draw the html elemens you have to implement the simple callback interface [document_container](https://github.com/litehtml/litehtml/wiki/document_container). This interface is really simple, check it! Note, the [document_container](https://github.com/litehtml/litehtml/wiki/document_container) implementation is required to render HTML correctly. 
-
-#Where litehtml can be used
-
-**litehtml** can be used when you need to show the html-formated texts or even to create a mini-browser, but the using full-featured html engine is not possible. Usually you don't need something like WebKit to show some html tooltips or html-formated text, **litehtml** is much better for these.
-
-##HTML Parser
-
-**litehtml** uses the [gumbo-parser](https://github.com/google/gumbo-parser) to parse HTML. Gumbo is an implementation of the HTML5 parsing algorithm implemented as a pure C99 library with no outside dependencies. It's designed to serve as a building block for other tools and libraries such as linters, validators, templating languages, and refactoring and analysis tools.
-
-##Compatibility
-
-**litehtml** is compatible with any platform suported C++ and STL. For Windows the MS Visual Studio 2013 is recommended. **litehtml** supports both utf-8 and unicode strings on Windows and utf-8 strings on Linux.
-
-##Support for HTML and CSS standards
-
-Unfortunately **litehtml** is not fully compatible with HTML/CSS standards. There are lots of work to do to make **litehtml** as well as modern browsers. But **litehtml** supports most HTML tags and CSS properties. You can find the list of supported CSS properties in  [this table](https://docs.google.com/spreadsheet/ccc?key=0AvHXl5n24PuhdHdELUdhaUl4OGlncXhDcDJuM1JpMnc&usp=sharing). In the most cases the html/css features supported by **litehtml** are enough. Right now **litehtml** supports the pages with very complex html/css designs. As example the pages created with [bootstrap framework](http://getbootstrap.com/) are usually well formated by **litehtml**.
-
-##Testing litehtml
-
-You can [download the simple browser](http://www.litehtml.com/download.html) (**litebrowser**) to test the **litehtml** rendering engine. 
-
-The litebrowser source codes are available on GitHub:
-  * [For Windows](https://github.com/tordex/litebrowser)
-  * [For Linux](https://github.com/tordex/litebrowser-linux)
-
-##License
-
-**litehtml** is distributed under [New BSD License](http://opensource.org/licenses/BSD-3-Clause).
-The **gumbo-parser** is disributed under [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
-
-##Support litehtml project
-
-If you think litehtml is amazing please consider a small donation:
-
-[ ![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif) ](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UHBQG6EAFCRBA)
-
-Bitcoin: **1CS1174GVSLbP33TBp8RFwqPS6KmQK6kLY**
-
-![BitCoin](https://www.tordex.com/assets/images/litehtml-bitcoin.png)
+[![Travis Build Status](https://travis-ci.org/litehtml/litehtml.svg?branch=master)](https://travis-ci.org/litehtml/litehtml)
+
+# What is litehtml?
+
+**litehtml** is the lightweight HTML rendering engine with CSS2/CSS3 support. Note that **litehtml** itself does not draw any text, pictures or other graphics and that **litehtml** does not depend on any image/draw/font library. You are free to use any library to draw images, fonts and any other graphics. **litehtml** just parses HTML/CSS and places the HTML elements into the correct positions (renders HTML). To draw the HTML elements you have to implement the simple callback interface [document_container](https://github.com/litehtml/litehtml/wiki/document_container). This interface is really simple, check it out! The [document_container](https://github.com/litehtml/litehtml/wiki/document_container) implementation is required to render HTML correctly.
+
+# Where litehtml can be used
+
+**litehtml** can be used when you need to show HTML formatted text or even to create a mini-browser, but using it as a full-featured HTML engine is not recommended. Usually you don't need something like WebKit to show simple HTML tooltips or HTML-formatted text, **litehtml** is much better for these as it's more lightweight and easier to integrate into your application.
+
+## HTML Parser
+
+**litehtml** uses the [gumbo-parser](https://github.com/google/gumbo-parser) to parse HTML. Gumbo is an implementation of the HTML5 parsing algorithm implemented as a pure C99 library with no outside dependencies. It's designed to serve as a building block for other tools and libraries such as linters, validators, templating languages, and refactoring and analysis tools.
+
+## Compatibility
+
+**litehtml** is compatible with any platform suported by C++ and STL. For Windows MS Visual Studio 2013 is recommended. **litehtml** supports both UTF-8 and Unicode strings on Windows and UTF-8 strings on Linux and Haiku.
+
+## Support for HTML and CSS standards
+
+Unfortunately **litehtml** is not fully compatible with HTML/CSS standards. There is lots of work to do to make **litehtml** work as well as modern browsers. But **litehtml** supports most HTML tags and CSS properties. You can find the list of supported CSS properties in  [this table](https://docs.google.com/spreadsheet/ccc?key=0AvHXl5n24PuhdHdELUdhaUl4OGlncXhDcDJuM1JpMnc&usp=sharing). For most simple usecases the HTML/CSS features supported by **litehtml** are enough. Right now **litehtml** supports even some pages with very complex HTML/CSS designs. As an example the pages created with [bootstrap framework](http://getbootstrap.com/) are usually well formatted by **litehtml**.
+
+## Testing litehtml
+
+You can [download the simple browser](http://www.litehtml.com/download.html) (**litebrowser**) to test the **litehtml** rendering engine.
+
+The litebrowser source codes are available on GitHub:
+  * [For Windows](https://github.com/litehtml/litebrowser)
+  * [For Linux](https://github.com/litehtml/litebrowser-linux)
+  * [For Haiku](https://github.com/adamfowleruk/litebrowser-haiku)
+
+## License
+
+**litehtml** is distributed under [New BSD License](https://opensource.org/licenses/BSD-3-Clause).
+The **gumbo-parser** is disributed under [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
+
+## Support litehtml project
+
+If you like the work **litehtml** is doing please consider a small donation:
+
+[ ![PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif) ](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=UHBQG6EAFCRBA) [ ![Patreon](https://img.shields.io/badge/patreon-Become%20a%20Patron!-red.png?style=for-the-badge&logo=patreon) ](https://www.patreon.com/tordex)
+
+Bitcoin: **1CS1174GVSLbP33TBp8RFwqPS6KmQK6kLY**
+
+![BitCoin](https://www.tordex.com/assets/images/litehtml-bitcoin.png)
diff --git a/src/plugins/litehtml_viewer/litehtml/borders.h b/src/plugins/litehtml_viewer/litehtml/borders.h
index 859b85249..9956a2a35 100644
--- a/src/plugins/litehtml_viewer/litehtml/borders.h
+++ b/src/plugins/litehtml_viewer/litehtml/borders.h
@@ -148,6 +148,7 @@ namespace litehtml
 			if (top_left_x < 0)	top_left_x = 0;
 			if (top_left_y < 0)	top_left_y = 0;
 			if (top_right_x < 0) top_right_x = 0;
+			if (top_right_y < 0) top_right_y = 0;
 			if (bottom_right_x < 0) bottom_right_x = 0;
 			if (bottom_right_y < 0) bottom_right_y = 0;
 			if (bottom_left_x < 0) bottom_left_x = 0;
diff --git a/src/plugins/litehtml_viewer/litehtml/css_selector.cpp b/src/plugins/litehtml_viewer/litehtml/css_selector.cpp
index dc400884e..e0a7ed445 100644
--- a/src/plugins/litehtml_viewer/litehtml/css_selector.cpp
+++ b/src/plugins/litehtml_viewer/litehtml/css_selector.cpp
@@ -7,6 +7,7 @@ void litehtml::css_element_selector::parse( const tstring& txt )
 	tstring::size_type el_end = txt.find_first_of(_t(".#[:"));
 	m_tag = txt.substr(0, el_end);
 	litehtml::lcase(m_tag);
+	m_attrs.clear();
 	while(el_end != tstring::npos)
 	{
 		if(txt[el_end] == _t('.'))
diff --git a/src/plugins/litehtml_viewer/litehtml/document.cpp b/src/plugins/litehtml_viewer/litehtml/document.cpp
index 0be0ea7e7..245411bf4 100644
--- a/src/plugins/litehtml_viewer/litehtml/document.cpp
+++ b/src/plugins/litehtml_viewer/litehtml/document.cpp
@@ -21,6 +21,7 @@
 #include "el_div.h"
 #include "el_font.h"
 #include "el_tr.h"
+#include "el_li.h"
 #include <math.h>
 #include <stdio.h>
 #include <algorithm>
@@ -60,7 +61,7 @@ litehtml::document::ptr litehtml::document::createFromUTF8(const char* str, lite
 
 	// Create litehtml::elements.
 	elements_vector root_elements;
-	doc->create_node(output->root, root_elements);
+	doc->create_node(output->root, root_elements, true);
 	if (!root_elements.empty())
 	{
 		doc->m_root = root_elements.back();
@@ -226,7 +227,7 @@ litehtml::uint_ptr litehtml::document::get_font( const tchar_t* name, int size,
 
 	if(!size)
 	{
-		size = container()->get_default_font_size();
+		size = m_container->get_default_font_size();
 	}
 
 	tchar_t strSize[20];
@@ -346,6 +347,10 @@ int litehtml::document::cvt_units( css_length& val, int fontSize, int size ) con
 	case css_units_vmax:
 		ret = (int)((double)std::max(m_media.height, m_media.width) * (double)val.val() / 100.0);
 		break;
+	case css_units_rem:
+		ret = (int) ((double) m_root->get_font_size() * (double) val.val());
+		val.set_value((float) ret, css_units_px);
+		break;
 	default:
 		ret = (int) val.val();
 		break;
@@ -552,6 +557,9 @@ litehtml::element::ptr litehtml::document::create_element(const tchar_t* tag_nam
 		} else if(!t_strcmp(tag_name, _t("font")))
 		{
 			newTag = std::make_shared<litehtml::el_font>(this_doc);
+		} else if(!t_strcmp(tag_name, _t("li")))
+		{
+			newTag = std::make_shared<litehtml::el_li>(this_doc);
 		} else
 		{
 			newTag = std::make_shared<litehtml::html_tag>(this_doc);
@@ -640,8 +648,9 @@ void litehtml::document::add_media_list( media_query_list::ptr list )
 	}
 }
 
-void litehtml::document::create_node(GumboNode* node, elements_vector& elements)
+void litehtml::document::create_node(void* gnode, elements_vector& elements, bool parseTextNode)
 {
+	GumboNode* node = (GumboNode*)gnode;
 	switch (node->type)
 	{
 	case GUMBO_NODE_ELEMENT:
@@ -671,13 +680,17 @@ void litehtml::document::create_node(GumboNode* node, elements_vector& elements)
 					ret = create_element(litehtml_from_utf8(strA.c_str()), attrs);
 				}
 			}
+			if (!strcmp(tag, "script"))
+			{
+				parseTextNode = false;
+			}
 			if (ret)
 			{
 				elements_vector child;
 				for (unsigned int i = 0; i < node->v.element.children.length; i++)
 				{
 					child.clear();
-					create_node(static_cast<GumboNode*> (node->v.element.children.data[i]), child);
+					create_node(static_cast<GumboNode*> (node->v.element.children.data[i]), child, parseTextNode);
 					std::for_each(child.begin(), child.end(), 
 						[&ret](element::ptr& el)
 						{
@@ -693,6 +706,11 @@ void litehtml::document::create_node(GumboNode* node, elements_vector& elements)
 		{
 			std::wstring str;
 			std::wstring str_in = (const wchar_t*) (utf8_to_wchar(node->v.text.text));
+			if (!parseTextNode)
+			{
+				elements.push_back(std::make_shared<el_text>(litehtml_from_wchar(str_in.c_str()), shared_from_this()));
+				break;
+			}
 			ucode_t c;
 			for (size_t i = 0; i < str_in.length(); i++)
 			{
@@ -775,8 +793,15 @@ void litehtml::document::fix_tables_layout()
 		case display_table_footer_group:
 		case display_table_row_group:
 		case display_table_header_group:
-			fix_table_parent(el_ptr, display_table, _t("table"));
-			fix_table_children(el_ptr, display_table_row, _t("table-row"));
+			{
+				element::ptr parent = el_ptr->parent();
+				if (parent)
+				{
+					if (parent->get_display() != display_inline_table)
+						fix_table_parent(el_ptr, display_table, _t("table"));
+				}
+				fix_table_children(el_ptr, display_table_row, _t("table-row"));
+			}
 			break;
 		case display_table_row:
 			fix_table_parent(el_ptr, display_table_row_group, _t("table-row-group"));
@@ -928,3 +953,54 @@ void litehtml::document::fix_table_parent(element::ptr& el_ptr, style_display di
 		}
 	}
 }
+
+void litehtml::document::append_children_from_string(element& parent, const tchar_t* str)
+{
+	append_children_from_utf8(parent, litehtml_to_utf8(str));
+}
+
+void litehtml::document::append_children_from_utf8(element& parent, const char* str)
+{
+	// parent must belong to this document
+	if (parent.get_document().get() != this)
+	{
+		return;
+	}
+
+	// parse document into GumboOutput
+	GumboOutput* output = gumbo_parse((const char*) str);
+
+	// Create litehtml::elements.
+	elements_vector child_elements;
+	create_node(output->root, child_elements, true);
+
+	// Destroy GumboOutput
+	gumbo_destroy_output(&kGumboDefaultOptions, output);
+
+	// Let's process created elements tree
+	for (litehtml::element::ptr child : child_elements)
+	{
+		// Add the child element to parent
+		parent.appendChild(child);
+
+		// apply master CSS
+		child->apply_stylesheet(m_context->master_css());
+
+		// parse elements attributes
+		child->parse_attributes();
+
+		// Apply parsed styles.
+		child->apply_stylesheet(m_styles);
+
+		// Parse applied styles in the elements
+		child->parse_styles();
+
+		// Now the m_tabular_elements is filled with tabular elements.
+		// We have to check the tabular elements for missing table elements 
+		// and create the anonymous boxes in visual table layout
+		fix_tables_layout();
+
+		// Fanaly initialize elements
+		child->init();
+	}
+}
\ No newline at end of file
diff --git a/src/plugins/litehtml_viewer/litehtml/document.h b/src/plugins/litehtml_viewer/litehtml/document.h
index 4484c927a..a5c152c38 100644
--- a/src/plugins/litehtml_viewer/litehtml/document.h
+++ b/src/plugins/litehtml_viewer/litehtml/document.h
@@ -4,7 +4,6 @@
 #include "style.h"
 #include "types.h"
 #include "context.h"
-#include "gumbo.h"
 
 namespace litehtml
 {
@@ -90,7 +89,6 @@ namespace litehtml
 		bool							on_mouse_leave(position::vector& redraw_boxes);
 		litehtml::element::ptr			create_element(const tchar_t* tag_name, const string_map& attributes);
 		element::ptr					root();
-		const element::ptr					over_element() const;
 		void							get_fixed_boxes(position::vector& fixed_boxes);
 		void							add_fixed_box(const position& pos);
 		void							add_media_list(media_query_list::ptr list);
@@ -98,6 +96,10 @@ namespace litehtml
 		bool							lang_changed();
 		bool                            match_lang(const tstring & lang);
 		void							add_tabular(const element::ptr& el);
+		const element::const_ptr		get_over_element() const { return m_over_element; }
+
+		void                            append_children_from_string(element& parent, const tchar_t* str);
+		void                            append_children_from_utf8(element& parent, const char* str);
 
 		static litehtml::document::ptr createFromString(const tchar_t* str, litehtml::document_container* objPainter, litehtml::context* ctx, litehtml::css* user_styles = 0);
 		static litehtml::document::ptr createFromUTF8(const char* str, litehtml::document_container* objPainter, litehtml::context* ctx, litehtml::css* user_styles = 0);
@@ -105,7 +107,7 @@ namespace litehtml
 	private:
 		litehtml::uint_ptr	add_font(const tchar_t* name, int size, const tchar_t* weight, const tchar_t* style, const tchar_t* decoration, font_metrics* fm);
 
-		void create_node(GumboNode* node, elements_vector& elements);
+		void create_node(void* gnode, elements_vector& elements, bool parseTextNode);
 		bool update_media_lists(const media_features& features);
 		void fix_tables_layout();
 		void fix_table_children(element::ptr& el_ptr, style_display disp, const tchar_t* disp_str);
@@ -116,10 +118,6 @@ namespace litehtml
 	{
 		return m_root;
 	}
-	inline const element::ptr document::over_element() const
-	{
-		return m_over_element;
-	}
 	inline void document::add_tabular(const element::ptr& el)
 	{
 		m_tabular_elements.push_back(el);
diff --git a/src/plugins/litehtml_viewer/litehtml/el_image.cpp b/src/plugins/litehtml_viewer/litehtml/el_image.cpp
index 7de47a189..62b3c4437 100644
--- a/src/plugins/litehtml_viewer/litehtml/el_image.cpp
+++ b/src/plugins/litehtml_viewer/litehtml/el_image.cpp
@@ -17,6 +17,24 @@ void litehtml::el_image::get_content_size( size& sz, int max_width )
 	get_document()->container()->get_image_size(m_src.c_str(), 0, sz);
 }
 
+int litehtml::el_image::calc_max_height(int image_height)
+{
+	document::ptr doc = get_document();
+	int percentSize = 0;
+	if (m_css_max_height.units() == css_units_percentage)
+	{
+		auto el_parent = parent();
+		if (el_parent)
+		{
+			if (!el_parent->get_predefined_height(percentSize))
+			{
+				return image_height;
+			}
+		}
+	}
+	return doc->cvt_units(m_css_max_height, m_font_size, percentSize);
+}
+
 int litehtml::el_image::line_height() const
 {
 	return height();
@@ -48,7 +66,7 @@ int litehtml::el_image::render( int x, int y, int max_width, bool second_pass )
 		m_pos.height	= sz.height;
 		m_pos.width		= sz.width;
 
-		// check for max-height
+		// check for max-width
 		if(!m_css_max_width.is_predefined())
 		{
 			int max_width = doc->cvt_units(m_css_max_width, m_font_size, parent_width);
@@ -68,7 +86,7 @@ int litehtml::el_image::render( int x, int y, int max_width, bool second_pass )
 		// check for max-height
 		if(!m_css_max_height.is_predefined())
 		{
-			int max_height = doc->cvt_units(m_css_max_height, m_font_size);
+			int max_height = calc_max_height(sz.height);
 			if(m_pos.height > max_height)
 			{
 				m_pos.height = max_height;
@@ -91,7 +109,7 @@ int litehtml::el_image::render( int x, int y, int max_width, bool second_pass )
 		// check for max-height
 		if(!m_css_max_height.is_predefined())
 		{
-			int max_height = doc->cvt_units(m_css_max_height, m_font_size);
+			int max_height = calc_max_height(sz.height);
 			if(m_pos.height > max_height)
 			{
 				m_pos.height = max_height;
@@ -138,7 +156,7 @@ int litehtml::el_image::render( int x, int y, int max_width, bool second_pass )
 		// check for max-height
 		if(!m_css_max_height.is_predefined())
 		{
-			int max_height = doc->cvt_units(m_css_max_height, m_font_size);
+			int max_height = calc_max_height(sz.height);
 			if(m_pos.height > max_height)
 			{
 				m_pos.height = max_height;
diff --git a/src/plugins/litehtml_viewer/litehtml/el_image.h b/src/plugins/litehtml_viewer/litehtml/el_image.h
index 377ddf85b..fa13d3c1d 100644
--- a/src/plugins/litehtml_viewer/litehtml/el_image.h
+++ b/src/plugins/litehtml_viewer/litehtml/el_image.h
@@ -20,6 +20,8 @@ namespace litehtml
 		virtual void	parse_styles(bool is_reparse = false) override;
 		virtual void	draw(uint_ptr hdc, int x, int y, const position* clip) override;
 		virtual void	get_content_size(size& sz, int max_width) override;
+	private:
+		int calc_max_height(int image_height);
 	};
 }
 
diff --git a/src/plugins/litehtml_viewer/litehtml/el_li.cpp b/src/plugins/litehtml_viewer/litehtml/el_li.cpp
new file mode 100644
index 000000000..9f2f484fe
--- /dev/null
+++ b/src/plugins/litehtml_viewer/litehtml/el_li.cpp
@@ -0,0 +1,38 @@
+#include "html.h"
+#include "el_li.h"
+#include "document.h"
+
+litehtml::el_li::el_li(const std::shared_ptr<litehtml::document>& doc) : litehtml::html_tag(doc)
+{
+}
+
+litehtml::el_li::~el_li()
+{
+
+}
+
+int litehtml::el_li::render(int x, int y, int max_width, bool second_pass)
+{
+	if (m_list_style_type >= list_style_type_armenian && !m_index_initialized)
+	{
+		if (auto p = parent())
+		{
+			tchar_t val[2] = { 1, 0 };
+			for (int i = 0, n = (int)p->get_children_count(); i < n; ++i)
+			{
+				auto child = p->get_child(i);
+				if (child.get() == this)
+				{
+					set_attr(_t("list_index"), val);
+					break;
+				}
+				else if (!t_strcmp(child->get_tagName(), _t("li")))
+					++val[0];
+			}
+		}
+
+		m_index_initialized = true;
+	}
+
+	return html_tag::render(x, y, max_width, second_pass);
+}
diff --git a/src/plugins/litehtml_viewer/litehtml/el_li.h b/src/plugins/litehtml_viewer/litehtml/el_li.h
new file mode 100644
index 000000000..3451c4f1d
--- /dev/null
+++ b/src/plugins/litehtml_viewer/litehtml/el_li.h
@@ -0,0 +1,21 @@
+#ifndef LH_EL_LI_H
+#define LH_EL_LI_H
+
+#include "html_tag.h"
+
+namespace litehtml
+{
+	class el_li : public html_tag
+	{
+	public:
+		el_li(const std::shared_ptr<litehtml::document>& doc);
+		virtual ~el_li();
+
+		virtual int render(int x, int y, int max_width, bool second_pass = false) override;
+
+	private:
+		bool m_index_initialized = false;
+	};
+}
+
+#endif  // LH_EL_LI_H
diff --git a/src/plugins/litehtml_viewer/litehtml/element.cpp b/src/plugins/litehtml_viewer/litehtml/element.cpp
index 9055cc1f6..67a500236 100644
--- a/src/plugins/litehtml_viewer/litehtml/element.cpp
+++ b/src/plugins/litehtml_viewer/litehtml/element.cpp
@@ -73,6 +73,7 @@ bool litehtml::element::is_inline_box() const
 {
 	style_display d = get_display();
 	if(	d == display_inline || 
+		d == display_inline_table ||
 		d == display_inline_block || 
 		d == display_inline_text)
 	{
@@ -376,7 +377,7 @@ void litehtml::element::on_click()													LITEHTML_EMPTY_FUNC
 void litehtml::element::init_font()													LITEHTML_EMPTY_FUNC
 void litehtml::element::get_inline_boxes( position::vector& boxes )					LITEHTML_EMPTY_FUNC
 void litehtml::element::parse_styles( bool is_reparse /*= false*/ )					LITEHTML_EMPTY_FUNC
-const litehtml::tchar_t* litehtml::element::get_attr( const tchar_t* name, const tchar_t* def /*= 0*/ )	LITEHTML_RETURN_FUNC(def)
+const litehtml::tchar_t* litehtml::element::get_attr( const tchar_t* name, const tchar_t* def /*= 0*/ ) const LITEHTML_RETURN_FUNC(def)
 bool litehtml::element::is_white_space() const										LITEHTML_RETURN_FUNC(false)
 bool litehtml::element::is_body() const												LITEHTML_RETURN_FUNC(false)
 bool litehtml::element::is_break() const											LITEHTML_RETURN_FUNC(false)
diff --git a/src/plugins/litehtml_viewer/litehtml/element.h b/src/plugins/litehtml_viewer/litehtml/element.h
index 37abc3438..5b91e28a3 100644
--- a/src/plugins/litehtml_viewer/litehtml/element.h
+++ b/src/plugins/litehtml_viewer/litehtml/element.h
@@ -17,8 +17,9 @@ namespace litehtml
 		friend class el_table;
 		friend class document;
 	public:
-		typedef std::shared_ptr<litehtml::element>		ptr;
-		typedef std::weak_ptr<litehtml::element>		weak_ptr;
+		typedef std::shared_ptr<litehtml::element>			ptr;
+		typedef std::shared_ptr<const litehtml::element>	const_ptr;
+		typedef std::weak_ptr<litehtml::element>			weak_ptr;
 	protected:
 		std::weak_ptr<element>		m_parent;
 		std::weak_ptr<litehtml::document>	m_doc;
@@ -130,7 +131,7 @@ namespace litehtml
 		virtual css_length			get_css_height() const;
 
 		virtual void				set_attr(const tchar_t* name, const tchar_t* val);
-		virtual const tchar_t*		get_attr(const tchar_t* name, const tchar_t* def = 0);
+		virtual const tchar_t*		get_attr(const tchar_t* name, const tchar_t* def = 0) const;
 		virtual void				apply_stylesheet(const litehtml::css& stylesheet);
 		virtual void				refresh_styles();
 		virtual bool				is_white_space() const;
diff --git a/src/plugins/litehtml_viewer/litehtml/html.cpp b/src/plugins/litehtml_viewer/litehtml/html.cpp
index a27dacac8..d61da5dba 100644
--- a/src/plugins/litehtml_viewer/litehtml/html.cpp
+++ b/src/plugins/litehtml_viewer/litehtml/html.cpp
@@ -7,12 +7,12 @@ void litehtml::trim(tstring &s)
 	tstring::size_type pos = s.find_first_not_of(_t(" \n\r\t"));
 	if(pos != tstring::npos)
 	{
-	    s.erase(s.begin(), s.begin() + pos);
+		s.erase(s.begin(), s.begin() + pos);
 	}
 	pos = s.find_last_not_of(_t(" \n\r\t"));
 	if(pos != tstring::npos)
 	{
-	    s.erase(s.begin() + pos + 1, s.end());
+		s.erase(s.begin() + pos + 1, s.end());
 	}
 }
 
diff --git a/src/plugins/litehtml_viewer/litehtml/html.h b/src/plugins/litehtml_viewer/litehtml/html.h
index 2c5c5561f..4151b1225 100644
--- a/src/plugins/litehtml_viewer/litehtml/html.h
+++ b/src/plugins/litehtml_viewer/litehtml/html.h
@@ -26,6 +26,8 @@ namespace litehtml
 		list_style_type	marker_type;
 		web_color		color;
 		position		pos;
+		int				index;
+		uint_ptr		font;
 	};
 
 	// call back interface to draw text, images and other elements
diff --git a/src/plugins/litehtml_viewer/litehtml/html_tag.cpp b/src/plugins/litehtml_viewer/litehtml/html_tag.cpp
index cb046b85b..f3524dfc9 100644
--- a/src/plugins/litehtml_viewer/litehtml/html_tag.cpp
+++ b/src/plugins/litehtml_viewer/litehtml/html_tag.cpp
@@ -7,6 +7,7 @@
 #include <algorithm>
 #include <locale>
 #include "el_before_after.h"
+#include "num_cvt.h"
 
 litehtml::html_tag::html_tag(const std::shared_ptr<litehtml::document>& doc) : litehtml::element(doc)
 {
@@ -81,10 +82,9 @@ void litehtml::html_tag::set_attr( const tchar_t* name, const tchar_t* val )
 	if(name && val)
 	{
 		tstring s_val = name;
-		std::locale lc = std::locale::global(std::locale(""));
 		for(size_t i = 0; i < s_val.length(); i++)
 		{
-			s_val[i] = std::tolower(s_val[i], lc);
+			s_val[i] = std::tolower(s_val[i], std::locale::classic());
 		}
 		m_attrs[s_val] = val;
 
@@ -96,7 +96,7 @@ void litehtml::html_tag::set_attr( const tchar_t* name, const tchar_t* val )
 	}
 }
 
-const litehtml::tchar_t* litehtml::html_tag::get_attr( const tchar_t* name, const tchar_t* def )
+const litehtml::tchar_t* litehtml::html_tag::get_attr( const tchar_t* name, const tchar_t* def ) const
 {
 	string_map::const_iterator attr = m_attrs.find(name);
 	if(attr != m_attrs.end())
@@ -353,6 +353,7 @@ void litehtml::html_tag::parse_styles(bool is_reparse)
 		}
 	}
 	else if (m_display == display_table ||
+		m_display == display_inline_table ||
 		m_display == display_table_caption ||
 		m_display == display_table_cell ||
 		m_display == display_table_column ||
@@ -1179,12 +1180,18 @@ void litehtml::html_tag::get_line_left_right( int y, int def_right, int& ln_left
 			el_parent->get_line_left_right(y + m_pos.y, def_right + m_pos.x, ln_left, ln_right);
 		}
 		ln_right -= m_pos.x;
-		ln_left -= m_pos.x;
 
 		if(ln_left < 0)
 		{
 			ln_left = 0;
-		}
+		} else if (ln_left > 0)
+		{
+			ln_left -= m_pos.x;
+			if (ln_left < 0)
+			{
+				ln_left = 0;
+			}
+        }
 	}
 }
 
@@ -2017,10 +2024,9 @@ bool litehtml::html_tag::is_break() const
 void litehtml::html_tag::set_tagName( const tchar_t* tag )
 {
 	tstring s_val = tag;
-	std::locale lc = std::locale::global(std::locale(""));
 	for(size_t i = 0; i < s_val.length(); i++)
 	{
-		s_val[i] = std::tolower(s_val[i], lc);
+		s_val[i] = std::tolower(s_val[i], std::locale::classic());
 	}
 	m_tag = s_val;
 }
@@ -2306,6 +2312,7 @@ int litehtml::html_tag::place_element(const element::ptr &el, int max_width)
 			switch(el->get_display())
 			{
 			case display_inline_block:
+			case display_inline_table:
 				ret_width = el->render(line_ctx.left, line_ctx.top, line_ctx.right);
 				break;
 			case display_block:		
@@ -2942,13 +2949,26 @@ void litehtml::html_tag::draw_list_marker( uint_ptr hdc, const position &pos )
 		lm.baseurl = 0;
 	}
 
-
 	int ln_height	= line_height();
 	int sz_font		= get_font_size();
 	lm.pos.x		= pos.x;
-	lm.pos.width	= sz_font	- sz_font * 2 / 3;
-	lm.pos.height	= sz_font	- sz_font * 2 / 3;
-	lm.pos.y		= pos.y		+ ln_height / 2 - lm.pos.height / 2;
+	lm.pos.width = sz_font - sz_font * 2 / 3;
+	lm.color = get_color(_t("color"), true, web_color(0, 0, 0));
+	lm.marker_type = m_list_style_type;
+	lm.font = get_font();
+
+	if (m_list_style_type >= list_style_type_armenian)
+	{
+		lm.pos.y = pos.y;
+		lm.pos.height = pos.height;
+		lm.index = get_attr(_t("list_index"), _t(""))[0];
+	}
+	else
+	{
+		lm.pos.height = sz_font - sz_font * 2 / 3;
+		lm.pos.y = pos.y + ln_height / 2 - lm.pos.height / 2;
+		lm.index = -1;
+	}
 
 	if(img_size.width && img_size.height)
 	{
@@ -2964,14 +2984,88 @@ void litehtml::html_tag::draw_list_marker( uint_ptr hdc, const position &pos )
 		lm.pos.width	= img_size.width;
 		lm.pos.height	= img_size.height;
 	}
-	if(m_list_style_position == list_style_position_outside)
+
+	if (m_list_style_position == list_style_position_outside)
 	{
-		lm.pos.x -= sz_font;
+		if (m_list_style_type >= list_style_type_armenian)
+		{
+			auto tw_space = get_document()->container()->text_width(_t(" "), lm.font);
+			lm.pos.x = pos.x - tw_space * 2;
+			lm.pos.width = tw_space;
+		}
+		else
+		{
+			lm.pos.x -= sz_font;
+		}
 	}
 
-	lm.color = get_color(_t("color"), true, web_color(0, 0, 0));
-	lm.marker_type = m_list_style_type;
-	get_document()->container()->draw_list_marker(hdc, lm);
+	if (m_list_style_type >= list_style_type_armenian)
+	{
+		auto marker_text = get_list_marker_text(lm.index);
+		lm.pos.height = ln_height;
+		if (marker_text.empty())
+		{
+			get_document()->container()->draw_list_marker(hdc, lm);
+		}
+		else
+		{
+			marker_text += _t(".");
+			auto tw = get_document()->container()->text_width(marker_text.c_str(), lm.font);
+			auto text_pos = lm.pos;
+			text_pos.move_to(text_pos.right() - tw, text_pos.y);
+			text_pos.width = tw;
+			get_document()->container()->draw_text(hdc, marker_text.c_str(), lm.font, lm.color, text_pos);
+		}
+	}
+	else
+	{
+		get_document()->container()->draw_list_marker(hdc, lm);
+	}
+}
+
+litehtml::tstring litehtml::html_tag::get_list_marker_text(int index)
+{
+	switch (m_list_style_type)
+	{
+	case litehtml::list_style_type_decimal:
+		return t_to_string(index);
+	case litehtml::list_style_type_decimal_leading_zero:
+		{
+			auto txt = t_to_string(index);
+			if (txt.length() == 1)
+			{
+				txt = _t("0") + txt;
+			}
+			return txt;
+		}
+	case litehtml::list_style_type_lower_latin:
+	case litehtml::list_style_type_lower_alpha:
+		return num_cvt::to_latin_lower(index);
+	case litehtml::list_style_type_lower_greek:
+		return num_cvt::to_greek_lower(index);
+	case litehtml::list_style_type_upper_alpha:
+	case litehtml::list_style_type_upper_latin:
+		return num_cvt::to_latin_upper(index);
+	case litehtml::list_style_type_lower_roman:
+		return num_cvt::to_roman_lower(index);
+	case litehtml::list_style_type_upper_roman:
+		return num_cvt::to_roman_upper(index);
+	case litehtml::list_style_type_armenian:
+		break;
+	case litehtml::list_style_type_georgian:
+		break;
+	case litehtml::list_style_type_hebrew:
+		break;
+	case litehtml::list_style_type_hiragana:
+		break;
+	case litehtml::list_style_type_hiragana_iroha:
+		break;
+	case litehtml::list_style_type_katakana:
+		break;
+	case litehtml::list_style_type_katakana_iroha:
+		break;
+	}
+	return _t("");
 }
 
 void litehtml::html_tag::draw_children( uint_ptr hdc, int x, int y, const position* clip, draw_flag flag, int zindex )
@@ -3920,9 +4014,6 @@ int litehtml::html_tag::render_box(int x, int y, int max_width, bool second_pass
 {
 	int parent_width = max_width;
 
-	if (max_width <= 0)
-		return 0;
-
 	calc_outlines(parent_width);
 
 	m_pos.clear();
@@ -4160,12 +4251,12 @@ int litehtml::html_tag::render_box(int x, int y, int max_width, bool second_pass
 	if (ret_width < max_width && !second_pass && have_parent())
 	{
 		if (m_display == display_inline_block ||
-			m_css_width.is_predefined() &&
+			(m_css_width.is_predefined() &&
 			(m_float != float_none ||
 			m_display == display_table ||
 			m_el_position == element_position_absolute ||
 			m_el_position == element_position_fixed
-			)
+			))
 			)
 		{
 			render(x, y, ret_width, true);
diff --git a/src/plugins/litehtml_viewer/litehtml/html_tag.h b/src/plugins/litehtml_viewer/litehtml/html_tag.h
index 460eb072d..3379a719b 100644
--- a/src/plugins/litehtml_viewer/litehtml/html_tag.h
+++ b/src/plugins/litehtml_viewer/litehtml/html_tag.h
@@ -138,7 +138,7 @@ namespace litehtml
 		virtual overflow			get_overflow() const override;
 
 		virtual void				set_attr(const tchar_t* name, const tchar_t* val) override;
-		virtual const tchar_t*		get_attr(const tchar_t* name, const tchar_t* def = 0) override;
+		virtual const tchar_t*		get_attr(const tchar_t* name, const tchar_t* def = 0) const override;
 		virtual void				apply_stylesheet(const litehtml::css& stylesheet) override;
 		virtual void				refresh_styles() override;
 
@@ -229,6 +229,7 @@ namespace litehtml
 		void						parse_background();
 		void						init_background_paint( position pos, background_paint &bg_paint, const background* bg );
 		void						draw_list_marker( uint_ptr hdc, const position &pos );
+		tstring						get_list_marker_text(int index);
 		void						parse_nth_child_params( tstring param, int &num, int &off );
 		void						remove_before_after();
 		litehtml::element::ptr		get_element_before();
diff --git a/src/plugins/litehtml_viewer/litehtml/litehtml.h b/src/plugins/litehtml_viewer/litehtml/litehtml.h
index 5d1ffd19d..98a24e0da 100644
--- a/src/plugins/litehtml_viewer/litehtml/litehtml.h
+++ b/src/plugins/litehtml_viewer/litehtml/litehtml.h
@@ -1,10 +1,10 @@
 #ifndef LITEHTML_H
 #define LITEHTML_H
 
-#include "litehtml/html.h"
-#include "litehtml/document.h"
-#include "litehtml/html_tag.h"
-#include "litehtml/stylesheet.h"
-#include "litehtml/element.h"
+#include <litehtml/html.h>
+#include <litehtml/document.h>
+#include <litehtml/html_tag.h>
+#include <litehtml/stylesheet.h>
+#include <litehtml/element.h>
 
 #endif  // LITEHTML_H
diff --git a/src/plugins/litehtml_viewer/litehtml/media_query.cpp b/src/plugins/litehtml_viewer/litehtml/media_query.cpp
index 41ff39ede..c2b4275ed 100644
--- a/src/plugins/litehtml_viewer/litehtml/media_query.cpp
+++ b/src/plugins/litehtml_viewer/litehtml/media_query.cpp
@@ -245,7 +245,7 @@ bool litehtml::media_query_expression::check( const media_features& features ) c
 		}
 		break;
 	case media_feature_min_device_height:
-		if(features.device_height <= val)
+		if(features.device_height >= val)
 		{
 			return true;
 		}
diff --git a/src/plugins/litehtml_viewer/litehtml/num_cvt.cpp b/src/plugins/litehtml_viewer/litehtml/num_cvt.cpp
new file mode 100644
index 000000000..16e7af442
--- /dev/null
+++ b/src/plugins/litehtml_viewer/litehtml/num_cvt.cpp
@@ -0,0 +1,109 @@
+#include "num_cvt.h"
+#include "types.h"
+#include "utf8_strings.h"
+#include <vector>
+
+static std::vector<litehtml::tchar_t> latin_lower = { _t('a'), _t('b'), _t('c'), _t('d'), _t('e'), _t('f'), _t('g'), _t('h'), _t('i'), _t('j'), _t('k'), _t('l'), _t('m'), _t('n'), _t('o'), _t('p'), _t('q'), _t('r'), _t('s'), _t('t'), _t('u'), _t('v'), _t('w'), _t('x'), _t('y'), _t('z') };
+static std::vector<litehtml::tchar_t> latin_upper = { _t('A'), _t('B'), _t('C'), _t('D'), _t('E'), _t('F'), _t('G'), _t('H'), _t('I'), _t('J'), _t('K'), _t('L'), _t('M'), _t('N'), _t('O'), _t('P'), _t('Q'), _t('R'), _t('S'), _t('T'), _t('U'), _t('V'), _t('W'), _t('X'), _t('Y'), _t('Z') };
+static std::vector<std::wstring> greek_lower = { L"α", L"β", L"γ", L"δ", L"ε", L"ζ", L"η", L"θ", L"ι", L"κ", L"λ", L"μ", L"ν", L"ξ", L"ο", L"π", L"ρ", L"σ", L"τ", L"υ", L"φ", L"χ", L"ψ", L"ω" };
+
+static litehtml::tstring to_mapped_alpha(int num, const std::vector<litehtml::tchar_t>& map)
+{
+	int dividend = num;
+	litehtml::tstring out;
+	int modulo;
+
+	while (dividend > 0)
+	{
+		modulo = (dividend - 1) % map.size();
+		out = map[modulo] + out;
+		dividend = (int)((dividend - modulo) / map.size());
+	}
+
+	return out;
+}
+
+static litehtml::tstring to_mapped_alpha(int num, const std::vector<std::wstring>& map)
+{
+	int dividend = num;
+	litehtml::tstring out;
+	int modulo;
+
+	while (dividend > 0)
+	{
+		modulo = (dividend - 1) % map.size();
+		out = litehtml_from_wchar(map[modulo]).c_str() + out;
+		dividend = (int)((dividend - modulo) / map.size());
+	}
+
+	return out;
+}
+
+litehtml::tstring litehtml::num_cvt::to_latin_lower(int val)
+{
+	return to_mapped_alpha(val, latin_lower);
+}
+
+litehtml::tstring litehtml::num_cvt::to_latin_upper(int val)
+{
+	return to_mapped_alpha(val, latin_upper);
+}
+
+litehtml::tstring litehtml::num_cvt::to_greek_lower(int val)
+{
+	return to_mapped_alpha(val, greek_lower);
+}
+
+litehtml::tstring litehtml::num_cvt::to_roman_lower(int value)
+{
+	struct romandata_t { int value; const litehtml::tchar_t* numeral; };
+	const struct romandata_t romandata[] =
+	{
+		{ 1000, _t("m") }, { 900, _t("cm" )},
+		{ 500, _t("d") }, { 400, _t("cd") },
+		{ 100, _t("c") }, { 90, _t("xc") },
+		{ 50, _t("l") }, { 40, _t("xl") },
+		{ 10, _t("x") }, { 9, _t("ix") },
+		{ 5, _t("v") }, { 4, _t("iv") },
+		{ 1, _t("i") },
+		{ 0, NULL } // end marker
+	};
+
+	litehtml::tstring result;
+	for (const romandata_t* current = romandata; current->value > 0; ++current)
+	{
+		while (value >= current->value)
+		{
+			result += current->numeral;
+			value -= current->value;
+		}
+	}
+	return result;
+}
+
+litehtml::tstring litehtml::num_cvt::to_roman_upper(int value)
+{
+	struct romandata_t { int value; const litehtml::tchar_t* numeral; };
+	const struct romandata_t romandata[] =
+	{
+		{ 1000, _t("M") }, { 900, _t("CM") },
+		{ 500, _t("D") }, { 400, _t("CD") },
+		{ 100, _t("C") }, { 90, _t("XC") },
+		{ 50, _t("L") }, { 40, _t("XL") },
+		{ 10, _t("X") }, { 9, _t("IX") },
+		{ 5, _t("V") }, { 4, _t("IV") },
+		{ 1, _t("I") },
+		{ 0, NULL } // end marker
+	};
+
+	litehtml::tstring result;
+	for (const romandata_t* current = romandata; current->value > 0; ++current)
+	{
+		while (value >= current->value)
+		{
+			result += current->numeral;
+			value -= current->value;
+		}
+	}
+	return result;
+}
diff --git a/src/plugins/litehtml_viewer/litehtml/num_cvt.h b/src/plugins/litehtml_viewer/litehtml/num_cvt.h
new file mode 100644
index 000000000..515e46d62
--- /dev/null
+++ b/src/plugins/litehtml_viewer/litehtml/num_cvt.h
@@ -0,0 +1,19 @@
+#ifndef NUM_CVT_H
+#define NUM_CVT_H
+
+#include <string>
+#include "os_types.h"
+
+namespace litehtml
+{
+	namespace num_cvt
+	{
+		litehtml::tstring to_latin_lower(int val);
+		litehtml::tstring to_latin_upper(int val);
+		litehtml::tstring to_greek_lower(int val);
+		litehtml::tstring to_roman_lower(int value);
+		litehtml::tstring to_roman_upper(int value);
+	}
+}
+
+#endif	// NUM_CVT_H
\ No newline at end of file
diff --git a/src/plugins/litehtml_viewer/litehtml/os_types.h b/src/plugins/litehtml_viewer/litehtml/os_types.h
index d0aa9f9e9..e3b18e648 100644
--- a/src/plugins/litehtml_viewer/litehtml/os_types.h
+++ b/src/plugins/litehtml_viewer/litehtml/os_types.h
@@ -3,7 +3,7 @@
 
 namespace litehtml
 {
-#if defined( WIN32 ) || defined( WINCE )
+#if defined( WIN32 ) || defined( _WIN32 ) || defined( WINCE )
 
 #ifndef LITEHTML_UTF8
 
@@ -25,6 +25,7 @@ namespace litehtml
 	#define t_strstr			wcsstr
 	#define t_tolower			towlower
 	#define t_isdigit			iswdigit
+	#define t_to_string(val)	std::to_wstring(val)
 
 #else
 
@@ -46,22 +47,22 @@ namespace litehtml
 	#define t_strstr			strstr
 	#define t_tolower			tolower
 	#define t_isdigit			isdigit
+	#define t_to_string(val)	std::to_string(val)
 
 #endif
 
-//	#ifdef _WIN64
-//		typedef unsigned __int64 uint_ptr;
-//	#else
-//		typedef unsigned int	uint_ptr;
-//	#endif
-	typedef void*				uint_ptr;
+	#ifdef _WIN64
+		typedef unsigned __int64 uint_ptr;
+	#else
+		typedef unsigned int	uint_ptr;
+	#endif
 
 #else
 	#define LITEHTML_UTF8
 
 	typedef std::string			tstring;
 	typedef char				tchar_t;
-	typedef void*				uint_ptr;
+	typedef std::uintptr_t			uint_ptr;
 	typedef std::stringstream	tstringstream;
 
 	#define _t(quote)			quote
@@ -80,6 +81,7 @@ namespace litehtml
 	#define t_strstr			strstr
 	#define t_tolower			tolower
 	#define t_isdigit			isdigit
+	#define t_to_string(val)	std::to_string(val)
 
 #endif
 }
diff --git a/src/plugins/litehtml_viewer/litehtml/style.cpp b/src/plugins/litehtml_viewer/litehtml/style.cpp
index be0687073..2a7c8b9de 100644
--- a/src/plugins/litehtml_viewer/litehtml/style.cpp
+++ b/src/plugins/litehtml_viewer/litehtml/style.cpp
@@ -28,7 +28,7 @@ litehtml::style::~style()
 void litehtml::style::parse( const tchar_t* txt, const tchar_t* baseurl )
 {
 	std::vector<tstring> properties;
-	split_string(txt, properties, _t(";"));
+	split_string(txt, properties, _t(";"), _t(""), _t("\"'"));
 
 	for(std::vector<tstring>::const_iterator i = properties.begin(); i != properties.end(); i++)
 	{
@@ -41,14 +41,12 @@ void litehtml::style::parse_property( const tstring& txt, const tchar_t* baseurl
 	tstring::size_type pos = txt.find_first_of(_t(":"));
 	if(pos != tstring::npos)
 	{
-		tstring name	= txt.substr(0, pos);
+		tstring name = txt.substr(0, pos);
 		tstring val	= txt.substr(pos + 1);
 
-		trim(name);
+		trim(name); lcase(name);
 		trim(val);
 
-		lcase(name);
-
 		if(!name.empty() && !val.empty())
 		{
 			string_vector vals;
@@ -60,13 +58,7 @@ void litehtml::style::parse_property( const tstring& txt, const tchar_t* baseurl
 			{
 				trim(vals[0]);
 				lcase(vals[1]);
-				if(vals[1] == _t("important"))
-				{
-					add_property(name.c_str(), vals[0].c_str(), baseurl, true);
-				} else
-				{
-					add_property(name.c_str(), vals[0].c_str(), baseurl, false);
-				}
+				add_property(name.c_str(), vals[0].c_str(), baseurl, vals[1] == _t("important"));
 			}
 		}
 	}
@@ -104,12 +96,12 @@ void litehtml::style::add_property( const tchar_t* name, const tchar_t* val, con
 		split_string(val, tokens, _t(" "));
 		if(tokens.size() == 1)
 		{
-			add_property(_t("-litehtml-border-spacing-x"), tokens[0].c_str(), baseurl, important);
-			add_property(_t("-litehtml-border-spacing-y"), tokens[0].c_str(), baseurl, important);
+			add_parsed_property(_t("-litehtml-border-spacing-x"), tokens[0].c_str(), important);
+			add_parsed_property(_t("-litehtml-border-spacing-y"), tokens[0].c_str(), important);
 		} else if(tokens.size() == 2)
 		{
-			add_property(_t("-litehtml-border-spacing-x"), tokens[0].c_str(), baseurl, important);
-			add_property(_t("-litehtml-border-spacing-y"), tokens[1].c_str(), baseurl, important);
+			add_parsed_property(_t("-litehtml-border-spacing-x"), tokens[0].c_str(), important);
+			add_parsed_property(_t("-litehtml-border-spacing-y"), tokens[1].c_str(), important);
 		}
 	} else
 
@@ -315,7 +307,7 @@ void litehtml::style::add_property( const tchar_t* name, const tchar_t* val, con
 			add_property(_t("border-bottom-left-radius-y"),	tokens[3].c_str(), baseurl, important);
 		}
 	}
-	
+	else
 
 	// Parse list-style shorthand properties 
 	if(!t_strcmp(name, _t("list-style")))
diff --git a/src/plugins/litehtml_viewer/litehtml/types.h b/src/plugins/litehtml_viewer/litehtml/types.h
index 7d3b6dc39..682fd7354 100644
--- a/src/plugins/litehtml_viewer/litehtml/types.h
+++ b/src/plugins/litehtml_viewer/litehtml/types.h
@@ -182,7 +182,7 @@ namespace litehtml
 		draw_positioned,
 	};
 
-#define  style_display_strings		_t("none;block;inline;inline-block;inline-table;list-item;table;table-caption;table-cell;table-column;table-column-group;table-footer-group;table-header-group;table-row;table-row-group")
+#define  style_display_strings		_t("none;block;inline;inline-block;inline-table;list-item;table;table-caption;table-cell;table-column;table-column-group;table-footer-group;table-header-group;table-row;table-row-group;inline-text")
 
 	enum style_display
 	{
@@ -246,7 +246,7 @@ namespace litehtml
 		font_variant_italic
 	};
 
-#define  font_weight_strings	_t("normal;bold;bolder;lighter100;200;300;400;500;600;700")
+#define  font_weight_strings	_t("normal;bold;bolder;lighter;100;200;300;400;500;600;700")
 
 	enum font_weight
 	{
@@ -356,7 +356,7 @@ namespace litehtml
 		clear_both
 	};
 
-#define  css_units_strings	_t("none;%;in;cm;mm;em;ex;pt;pc;px;dpi;dpcm;vw;vh;vmin;vmax")
+#define  css_units_strings	_t("none;%;in;cm;mm;em;ex;pt;pc;px;dpi;dpcm;vw;vh;vmin;vmax;rem")
 
 	enum css_units
 	{
@@ -376,6 +376,7 @@ namespace litehtml
 		css_units_vh,
 		css_units_vmin,
 		css_units_vmax,
+		css_units_rem,
 	};
 
 #define  background_attachment_strings	_t("scroll;fixed")
diff --git a/src/plugins/litehtml_viewer/litehtml/utf8_strings.cpp b/src/plugins/litehtml_viewer/litehtml/utf8_strings.cpp
index cdd58e126..3cebc73dc 100644
--- a/src/plugins/litehtml_viewer/litehtml/utf8_strings.cpp
+++ b/src/plugins/litehtml_viewer/litehtml/utf8_strings.cpp
@@ -61,7 +61,7 @@ litehtml::ucode_t litehtml::utf8_to_wchar::get_char()
 	return '?';
 }
 
-litehtml::wchar_to_utf8::wchar_to_utf8(const wchar_t* val)
+litehtml::wchar_to_utf8::wchar_to_utf8(const std::wstring& val)
 {
 	unsigned int code;
 	for (int i = 0; val[i]; i++)
diff --git a/src/plugins/litehtml_viewer/litehtml/utf8_strings.h b/src/plugins/litehtml_viewer/litehtml/utf8_strings.h
index 012026276..c5b24217b 100644
--- a/src/plugins/litehtml_viewer/litehtml/utf8_strings.h
+++ b/src/plugins/litehtml_viewer/litehtml/utf8_strings.h
@@ -30,21 +30,26 @@ namespace litehtml
 	{
 		std::string m_str;
 	public:
-		wchar_to_utf8(const wchar_t* val);
+		wchar_to_utf8(const std::wstring& val);
 		operator const char*() const
 		{
 			return m_str.c_str();
 		}
+
+		const char* c_str() const
+		{
+			return m_str.c_str();
+		}
 	};
 
 #ifdef LITEHTML_UTF8
 #define litehtml_from_utf8(str)		str
 #define litehtml_to_utf8(str)		str
-#define litehtml_from_wchar(str)	wchar_to_utf8(str)
+#define litehtml_from_wchar(str)	litehtml::wchar_to_utf8(str)
 #else
-#define litehtml_from_utf8(str)		utf8_to_wchar(str)
+#define litehtml_from_utf8(str)		litehtml::utf8_to_wchar(str)
 #define litehtml_from_wchar(str)	str
-#define litehtml_to_utf8(str)		wchar_to_utf8(str)
+#define litehtml_to_utf8(str)		litehtml::wchar_to_utf8(str)
 #endif
 }
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list