[Xfce4-commits] <midori:master> Handle multi-line -moz-document blocks
Christian Dywan
noreply at xfce.org
Fri Nov 5 23:28:01 CET 2010
Updating branch refs/heads/master
to 96a276219aa1bb8209fb256ccebdc4b41e14d2d7 (commit)
from 156374ded77f8d4debf1670efb91dd30401263a9 (commit)
commit 96a276219aa1bb8209fb256ccebdc4b41e14d2d7
Author: Paweł Forysiuk <tuxator at o2.pl>
Date: Fri Nov 5 23:26:34 2010 +0100
Handle multi-line -moz-document blocks
extensions/addons.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/extensions/addons.c b/extensions/addons.c
index 229051f..3ec1048 100644
--- a/extensions/addons.c
+++ b/extensions/addons.c
@@ -794,6 +794,7 @@ css_metadata_from_file (const gchar* filename,
GIOChannel* channel;
gchar* line;
gchar* rest_of_line;
+ gboolean line_has_meta;
if (!g_file_test (filename, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK))
return FALSE;
@@ -802,21 +803,26 @@ css_metadata_from_file (const gchar* filename,
if (!channel)
return FALSE;
+ line_has_meta = FALSE;
while (g_io_channel_read_line (channel, &line, NULL, NULL, NULL)
== G_IO_STATUS_NORMAL)
{
- if (g_str_has_prefix (line, "@-moz-document"))
+ if (g_str_has_prefix (line, "@-moz-document") || line_has_meta)
{ /* FIXME: We merely look for includes. We should honor blocks. */
if (includes)
{
gchar** parts;
guint i;
- rest_of_line = g_strdup (line + strlen ("@-moz-document"));
+ if (g_str_has_prefix (line, "@-moz-document"))
+ rest_of_line = g_strdup (line + strlen ("@-moz-document"));
+ else
+ rest_of_line = g_strdup (line);
+
rest_of_line = g_strstrip (rest_of_line);
parts = g_strsplit (rest_of_line, " ", 0);
i = 0;
- while (parts[i])
+ while (parts[i] && (*parts[i] != '\0' && *parts[i] != '{'))
{
gchar* value = NULL;
if (g_str_has_prefix (parts[i], "url-prefix("))
@@ -830,6 +836,7 @@ css_metadata_from_file (const gchar* filename,
guint begin, end;
gchar* domain;
+ line_has_meta = TRUE;
begin = value[0] == '"' || value[0] == '\'' ? 1 : 0;
end = 1;
while (value[end] != '\0' && value[end] != ')')
@@ -850,6 +857,7 @@ css_metadata_from_file (const gchar* filename,
}
g_strfreev (parts);
}
+ line_has_meta = g_str_has_suffix (rest_of_line, "{") ? FALSE : TRUE;
}
g_free (line);
}
More information about the Xfce4-commits
mailing list