diff options
Diffstat (limited to 'openembedded/packages/gtkhtml2')
7 files changed, 1829 insertions, 2 deletions
diff --git a/openembedded/packages/gtkhtml2/files/at-import_box-pos.patch b/openembedded/packages/gtkhtml2/files/at-import_box-pos.patch new file mode 100644 index 0000000000..89e60e5d28 --- /dev/null +++ b/openembedded/packages/gtkhtml2/files/at-import_box-pos.patch | |||
@@ -0,0 +1,767 @@ | |||
1 | Index: libgtkhtml/css/cssmatcher.c | ||
2 | =================================================================== | ||
3 | RCS file: /cvs/gnome/gtkhtml2/libgtkhtml/css/cssmatcher.c,v | ||
4 | retrieving revision 1.53 | ||
5 | diff -u -r1.53 cssmatcher.c | ||
6 | --- libgtkhtml/css/cssmatcher.c 26 Oct 2005 02:04:24 -0000 1.53 | ||
7 | +++ libgtkhtml/css/cssmatcher.c 18 Jan 2006 18:24:09 -0000 | ||
8 | @@ -79,7 +79,7 @@ | ||
9 | element_name = html_atom_list_get_atom (html_atom_list, node->name); | ||
10 | |||
11 | /* Look at the element name */ | ||
12 | - if (!simple->is_star && simple->element_name != element_name) | ||
13 | + if ((!simple->is_star) && (simple->element_name != element_name)) | ||
14 | return FALSE; | ||
15 | |||
16 | str = xmlGetProp (node, "id"); | ||
17 | @@ -2373,7 +2373,7 @@ | ||
18 | CssStylesheet *ss; | ||
19 | |||
20 | if (html_stream_get_written (stream) != 0) { | ||
21 | - ss = css_parser_parse_stylesheet (context->str->str, context->str->len); | ||
22 | + ss = css_parser_parse_stylesheet (context->str->str, context->str->len, NULL); | ||
23 | |||
24 | context->stat->s.import_rule.fetched = TRUE; | ||
25 | |||
26 | @@ -2770,7 +2770,7 @@ | ||
27 | css_matcher_html_to_css (doc, style, node); | ||
28 | |||
29 | if (!default_stylesheet) { | ||
30 | - default_stylesheet = css_parser_parse_stylesheet (html_css, strlen (html_css)); | ||
31 | + default_stylesheet = css_parser_parse_stylesheet (html_css, strlen (html_css), NULL); | ||
32 | } | ||
33 | |||
34 | css_matcher_apply_stylesheet (doc, default_stylesheet, node, &declaration_list, CSS_STYLESHEET_DEFAULT, pseudo); | ||
35 | @@ -2789,7 +2789,7 @@ | ||
36 | prop = xmlGetProp (node, "style"); | ||
37 | |||
38 | if (prop) { | ||
39 | - CssRuleset *rs = css_parser_parse_style_attr (prop, strlen (prop)); | ||
40 | + CssRuleset *rs = css_parser_parse_style_attr (prop, strlen (prop), NULL); | ||
41 | gint i; | ||
42 | |||
43 | if (rs) { | ||
44 | Index: libgtkhtml/css/cssparser.c | ||
45 | =================================================================== | ||
46 | RCS file: /cvs/gnome/gtkhtml2/libgtkhtml/css/cssparser.c,v | ||
47 | retrieving revision 1.23 | ||
48 | diff -u -r1.23 cssparser.c | ||
49 | --- libgtkhtml/css/cssparser.c 25 Sep 2005 02:07:21 -0000 1.23 | ||
50 | +++ libgtkhtml/css/cssparser.c 18 Jan 2006 18:24:09 -0000 | ||
51 | @@ -49,7 +49,7 @@ | ||
52 | |||
53 | const gint css_n_dimensions = sizeof (css_dimensions) / sizeof (css_dimensions[0]); | ||
54 | |||
55 | -static gint css_parser_parse_value (const gchar *buffer, gint start_pos, gint end_pos, CssValue **ret_val); | ||
56 | +static gint css_parser_parse_value (const gchar *buffer, gint start_pos, gint end_pos, CssValue **ret_val, const gchar *base_url); | ||
57 | |||
58 | /* FIXME: Needs more whitespace types */ | ||
59 | static gint | ||
60 | @@ -443,7 +443,7 @@ | ||
61 | } | ||
62 | |||
63 | static gint | ||
64 | -css_parser_parse_term (const gchar *buffer, gint start_pos, gint end_pos, CssValue **ret_val) | ||
65 | +css_parser_parse_term (const gchar *buffer, gint start_pos, gint end_pos, CssValue **ret_val, const gchar *base_url) | ||
66 | { | ||
67 | gint pos; | ||
68 | HtmlAtom atom; | ||
69 | @@ -481,7 +481,7 @@ | ||
70 | return -1; | ||
71 | } | ||
72 | |||
73 | - pos = css_parser_parse_value (buffer, save_pos + 1, func_end, &val); | ||
74 | + pos = css_parser_parse_value (buffer, save_pos + 1, func_end, &val, base_url); | ||
75 | |||
76 | if (pos == -1) { | ||
77 | /* | ||
78 | @@ -495,10 +495,48 @@ | ||
79 | pos = func_end; | ||
80 | } | ||
81 | if (pos != -1) { | ||
82 | - if (ret_val) | ||
83 | + if (ret_val) { | ||
84 | *ret_val = css_value_function_new (atom, val); | ||
85 | - else | ||
86 | + | ||
87 | + if ((*ret_val)->v.function->name == HTML_ATOM_URL && | ||
88 | + (*ret_val)->v.function->args) { | ||
89 | + gchar *str = css_value_to_string ((*ret_val)->v.function->args); | ||
90 | + | ||
91 | + if (base_url && str) { | ||
92 | + regex_t reg; | ||
93 | + | ||
94 | + regcomp (®, "^[a-zA-Z][a-zA-Z0-9.+-]*:", REG_NOSUB); | ||
95 | + if (((*ret_val)->v.function->args->v.s[0] != '/') && (regexec (®, (*ret_val)->v.function->args->v.s, 0, NULL, 0))) { | ||
96 | + gchar *temp_base, *eptr; | ||
97 | + | ||
98 | + temp_base = g_strdup(base_url); | ||
99 | + eptr = strrchr(temp_base, '?'); | ||
100 | + | ||
101 | + if (eptr != NULL) | ||
102 | + *eptr = '\0'; | ||
103 | + | ||
104 | + eptr = strrchr(temp_base, '/'); | ||
105 | + if (eptr != NULL) { | ||
106 | + gchar *temp_arg = g_strdup((*ret_val)->v.function->args->v.s); | ||
107 | + | ||
108 | + *eptr = '\0'; | ||
109 | + | ||
110 | + g_free((*ret_val)->v.function->args->v.s); | ||
111 | + (*ret_val)->v.function->args->v.s = g_strconcat(temp_base, "/", temp_arg, NULL); | ||
112 | + g_free(temp_arg); | ||
113 | + } | ||
114 | + | ||
115 | + g_free(temp_base); | ||
116 | + } | ||
117 | + regfree (®); | ||
118 | + } | ||
119 | + | ||
120 | + g_free (str); | ||
121 | + } | ||
122 | + } | ||
123 | + else { | ||
124 | css_value_unref (val); | ||
125 | + } | ||
126 | } | ||
127 | |||
128 | /* This is due to the ) */ | ||
129 | @@ -566,7 +604,7 @@ | ||
130 | } | ||
131 | |||
132 | static gint | ||
133 | -css_parser_parse_value (const gchar *buffer, gint start_pos, gint end_pos, CssValue **ret_val) | ||
134 | +css_parser_parse_value (const gchar *buffer, gint start_pos, gint end_pos, CssValue **ret_val, const gchar *base_url) | ||
135 | { | ||
136 | gint pos = start_pos; | ||
137 | gint n = 0; | ||
138 | @@ -589,7 +627,7 @@ | ||
139 | css_value_list_append (list, term, list_sep); | ||
140 | } | ||
141 | |||
142 | - pos = css_parser_parse_term (buffer, pos, end_pos, &term); | ||
143 | + pos = css_parser_parse_term (buffer, pos, end_pos, &term, base_url); | ||
144 | |||
145 | if (pos == -1) { | ||
146 | if (list) | ||
147 | @@ -618,7 +656,7 @@ | ||
148 | } | ||
149 | else { | ||
150 | /* Try and parse the term to see if it's valid */ | ||
151 | - if (css_parser_parse_term (buffer, pos, end_pos, NULL) == -1) { | ||
152 | + if (css_parser_parse_term (buffer, pos, end_pos, NULL, base_url) == -1) { | ||
153 | if (term) | ||
154 | css_value_unref (term); | ||
155 | if (list) | ||
156 | @@ -1005,7 +1043,7 @@ | ||
157 | } | ||
158 | |||
159 | static gint | ||
160 | -css_parser_parse_declaration (const gchar *buffer, gint start_pos, gint end_pos, CssDeclaration **ret_val) | ||
161 | +css_parser_parse_declaration (const gchar *buffer, gint start_pos, gint end_pos, CssDeclaration **ret_val, const gchar *base_url) | ||
162 | { | ||
163 | CssValue *value; | ||
164 | CssDeclaration *result; | ||
165 | @@ -1040,7 +1078,7 @@ | ||
166 | |||
167 | pos = css_parser_parse_whitespace (buffer, pos, prio_pos); | ||
168 | |||
169 | - pos = css_parser_parse_value (buffer, pos, prio_pos, &value); | ||
170 | + pos = css_parser_parse_value (buffer, pos, prio_pos, &value, base_url); | ||
171 | |||
172 | if (pos == -1) { | ||
173 | return end_pos; | ||
174 | @@ -1063,7 +1101,7 @@ | ||
175 | } | ||
176 | |||
177 | static CssDeclaration ** | ||
178 | -css_parser_parse_declarations (const gchar *buffer, gint start_pos, gint end_pos, gint *num_decl) | ||
179 | +css_parser_parse_declarations (const gchar *buffer, gint start_pos, gint end_pos, gint *num_decl, const gchar *base_url) | ||
180 | { | ||
181 | gint pos = start_pos; | ||
182 | gint cur_pos = start_pos; | ||
183 | @@ -1079,7 +1117,7 @@ | ||
184 | |||
185 | pos = css_parser_parse_to_char (buffer, ';', pos, end_pos); | ||
186 | |||
187 | - pos = css_parser_parse_declaration (buffer, cur_pos, pos, &declaration); | ||
188 | + pos = css_parser_parse_declaration (buffer, cur_pos, pos, &declaration, base_url); | ||
189 | |||
190 | if (declaration) { | ||
191 | if (n_decl == n_decl_max) | ||
192 | @@ -1100,7 +1138,7 @@ | ||
193 | } | ||
194 | |||
195 | static gint | ||
196 | -css_parser_parse_ruleset (const gchar *buffer, gint start_pos, gint end_pos, CssRuleset **ret_val) | ||
197 | +css_parser_parse_ruleset (const gchar *buffer, gint start_pos, gint end_pos, CssRuleset **ret_val, const gchar *base_url) | ||
198 | { | ||
199 | gint cur_pos; | ||
200 | gint pos; | ||
201 | @@ -1143,7 +1181,7 @@ | ||
202 | } | ||
203 | cur_pos = css_parser_parse_whitespace (buffer, cur_pos, end_pos); | ||
204 | |||
205 | - decl = css_parser_parse_declarations (buffer, cur_pos, pos, &n_decl); | ||
206 | + decl = css_parser_parse_declarations (buffer, cur_pos, pos, &n_decl, base_url); | ||
207 | |||
208 | pos++; | ||
209 | |||
210 | @@ -1186,7 +1224,8 @@ | ||
211 | } | ||
212 | else if (str[pos] == '/' && | ||
213 | pos + 1 <= len && | ||
214 | - str[pos + 1] == '/') { | ||
215 | + str[pos + 1] == '/' && | ||
216 | + (pos == 0 || str[pos-1] != ':')) { | ||
217 | while (pos < len && | ||
218 | str[pos] != '\n') | ||
219 | pos++; | ||
220 | @@ -1204,7 +1243,7 @@ | ||
221 | } | ||
222 | |||
223 | static gint | ||
224 | -css_parser_parse_atkeyword (const gchar *buffer, gint start_pos, gint end_pos, CssStatement **ret_val) | ||
225 | +css_parser_parse_atkeyword (const gchar *buffer, gint start_pos, gint end_pos, CssStatement **ret_val, const gchar *base_url) | ||
226 | { | ||
227 | gint pos = start_pos; | ||
228 | gint tmp_pos, cur_pos; | ||
229 | @@ -1257,14 +1296,14 @@ | ||
230 | tmp_pos++; | ||
231 | |||
232 | |||
233 | - rs = g_new (CssRuleset *, n_rs_max); | ||
234 | + rs = g_new0 (CssRuleset *, n_rs_max); | ||
235 | |||
236 | /* g_print ("wheee: \"%s\"\n", g_strndup (buffer + cur_pos, tmp_pos - cur_pos )); */ | ||
237 | pos = cur_pos; | ||
238 | while (pos < tmp_pos) { | ||
239 | CssRuleset *ruleset; | ||
240 | |||
241 | - pos = css_parser_parse_ruleset (buffer, pos, tmp_pos, &ruleset); | ||
242 | + pos = css_parser_parse_ruleset (buffer, pos, tmp_pos, &ruleset, base_url); | ||
243 | |||
244 | if (n_rs == n_rs_max) | ||
245 | rs = g_realloc (rs, sizeof (CssRuleset *) * | ||
246 | @@ -1277,7 +1316,7 @@ | ||
247 | |||
248 | pos = css_parser_parse_whitespace (buffer, tmp_pos + 1, end_pos); | ||
249 | |||
250 | - result = g_new (CssStatement, 1); | ||
251 | + result = g_new0 (CssStatement, 1); | ||
252 | result->type = CSS_MEDIA_RULE; | ||
253 | result->s.media_rule.rs = rs; | ||
254 | result->s.media_rule.n_rs = n_rs; | ||
255 | @@ -1318,11 +1357,11 @@ | ||
256 | |||
257 | pos = css_parser_parse_whitespace (buffer, pos, cur_pos); | ||
258 | |||
259 | - decl = css_parser_parse_declarations (buffer, pos, cur_pos, &n_decl); | ||
260 | + decl = css_parser_parse_declarations (buffer, pos, cur_pos, &n_decl, base_url); | ||
261 | |||
262 | g_print ("N_decl is: %d\n", n_decl); | ||
263 | |||
264 | - result = g_new (CssStatement, 1); | ||
265 | + result = g_new0 (CssStatement, 1); | ||
266 | result->type = CSS_PAGE_RULE; | ||
267 | result->s.page_rule.name = name; | ||
268 | result->s.page_rule.pseudo = pseudo; | ||
269 | @@ -1337,8 +1376,8 @@ | ||
270 | pos = css_parser_parse_whitespace (buffer, pos + 1, end_pos); | ||
271 | cur_pos = css_parser_parse_to_char (buffer, '}', pos, end_pos); | ||
272 | |||
273 | - decl = css_parser_parse_declarations (buffer, pos, cur_pos, &n_decl); | ||
274 | - result = g_new (CssStatement, 1); | ||
275 | + decl = css_parser_parse_declarations (buffer, pos, cur_pos, &n_decl, base_url); | ||
276 | + result = g_new0 (CssStatement, 1); | ||
277 | result->type = CSS_FONT_FACE_RULE; | ||
278 | |||
279 | result->s.font_face_rule.n_decl = n_decl; | ||
280 | @@ -1349,8 +1388,61 @@ | ||
281 | return cur_pos + 1; | ||
282 | |||
283 | break; | ||
284 | + case HTML_ATOM_IMPORT: { | ||
285 | + gchar *import_url; | ||
286 | + const gchar *s_url, *e_url; | ||
287 | + | ||
288 | + cur_pos = css_parser_parse_to_char (buffer, ';', pos, end_pos); | ||
289 | + | ||
290 | + if (strchr (buffer + pos, '(')) { | ||
291 | + s_url = strchr (buffer + pos, '('); | ||
292 | + e_url = strchr (s_url, ')'); | ||
293 | + } else if (strchr (buffer + pos, '\"')) { | ||
294 | + s_url = strchr (buffer + pos, '\"'); | ||
295 | + e_url = strchr (s_url + 1, '\"'); | ||
296 | + } else if (strchr (buffer + pos, '\'')) { | ||
297 | + s_url = strchr (buffer + pos, '\''); | ||
298 | + e_url = strchr (s_url + 1, '\''); | ||
299 | + } | ||
300 | + | ||
301 | + if (!s_url || !e_url || ((e_url - s_url) < 1)) { | ||
302 | + g_warning ("Invalid @import line"); | ||
303 | + *ret_val = NULL; | ||
304 | + return cur_pos + 1; | ||
305 | + } | ||
306 | + | ||
307 | + s_url++; | ||
308 | + e_url--; | ||
309 | + | ||
310 | + if ((*s_url == '\"') && (*e_url == '\"')) { | ||
311 | + s_url++; | ||
312 | + e_url--; | ||
313 | + } else if ((*s_url == '\'') && (*e_url == '\'')) { | ||
314 | + s_url++; | ||
315 | + e_url--; | ||
316 | + } | ||
317 | + | ||
318 | + if (s_url > e_url) { | ||
319 | + g_warning ("Invalid @import line"); | ||
320 | + *ret_val = NULL; | ||
321 | + return cur_pos + 1; | ||
322 | + } | ||
323 | + | ||
324 | + import_url = g_strndup (s_url, strlen (s_url) - strlen (e_url) + 1); | ||
325 | + | ||
326 | + result = g_new0 (CssStatement, 1); | ||
327 | + result->type = CSS_IMPORT_RULE; | ||
328 | |||
329 | + result->s.import_rule.url = css_value_string_new (import_url); | ||
330 | + | ||
331 | + *ret_val = result; | ||
332 | + | ||
333 | + return cur_pos + 1; | ||
334 | + | ||
335 | + break; | ||
336 | + } | ||
337 | default: | ||
338 | + g_warning ("Unhandled keyword %d - %s", keyword, buffer); | ||
339 | /* Unknown keyword detected, skip to next block */ | ||
340 | while (pos < end_pos) { | ||
341 | /* Handle a dangling semi-colon */ | ||
342 | @@ -1373,7 +1465,7 @@ | ||
343 | } | ||
344 | |||
345 | CssRuleset * | ||
346 | -css_parser_parse_style_attr (const gchar *buffer, gint len) | ||
347 | +css_parser_parse_style_attr (const gchar *buffer, gint len, const gchar *base_url) | ||
348 | { | ||
349 | CssRuleset *result; | ||
350 | |||
351 | @@ -1382,7 +1474,7 @@ | ||
352 | |||
353 | /* FIXME: Are comments allowed here? */ | ||
354 | |||
355 | - decl = css_parser_parse_declarations (buffer, 0, len, &n_decl); | ||
356 | + decl = css_parser_parse_declarations (buffer, 0, len, &n_decl, base_url); | ||
357 | |||
358 | if (!decl) | ||
359 | return NULL; | ||
360 | @@ -1397,9 +1489,8 @@ | ||
361 | } | ||
362 | |||
363 | CssStylesheet * | ||
364 | -css_parser_parse_stylesheet (const gchar *str, gint len) | ||
365 | +css_parser_parse_stylesheet (const gchar *str, gint len, const gchar *base_url) | ||
366 | { | ||
367 | - CssStatement *statement; | ||
368 | CssStylesheet *result; | ||
369 | GSList *stat = NULL; | ||
370 | gchar *buffer; | ||
371 | @@ -1413,26 +1504,23 @@ | ||
372 | end_pos = len; | ||
373 | while (pos < len) { | ||
374 | if (buffer[pos] == '@') { | ||
375 | - pos = css_parser_parse_atkeyword (buffer, pos + 1, len, &statement); | ||
376 | -#if 0 | ||
377 | - if (statement) { | ||
378 | - if (n_stat == n_stat_max) | ||
379 | - stat = g_realloc (stat, sizeof (CssStatement) * | ||
380 | - (n_stat_max <<= 1)); | ||
381 | - stat[n_stat++] = statement; | ||
382 | + CssStatement *atstatement = NULL; | ||
383 | + pos = css_parser_parse_atkeyword (buffer, pos + 1, len, &atstatement, base_url); | ||
384 | + if (atstatement) { | ||
385 | + stat = g_slist_append (stat, atstatement); | ||
386 | } | ||
387 | -#endif | ||
388 | } | ||
389 | else { | ||
390 | CssRuleset *ruleset; | ||
391 | - pos = css_parser_parse_ruleset (buffer, pos, end_pos, &ruleset); | ||
392 | + pos = css_parser_parse_ruleset (buffer, pos, end_pos, &ruleset, base_url); | ||
393 | |||
394 | if (ruleset) { | ||
395 | - statement = g_new (CssStatement, 1); | ||
396 | - statement->type = CSS_RULESET; | ||
397 | - statement->s.ruleset = ruleset; | ||
398 | + CssStatement *rulestatement; | ||
399 | + rulestatement = g_new0 (CssStatement, 1); | ||
400 | + rulestatement->type = CSS_RULESET; | ||
401 | + rulestatement->s.ruleset = ruleset; | ||
402 | |||
403 | - stat = g_slist_append (stat, statement); | ||
404 | + stat = g_slist_append (stat, rulestatement); | ||
405 | } | ||
406 | |||
407 | if (pos == -1) | ||
408 | @@ -1444,7 +1532,7 @@ | ||
409 | |||
410 | g_free (buffer); | ||
411 | |||
412 | - result = g_new (CssStylesheet, 1); | ||
413 | + result = g_new0 (CssStylesheet, 1); | ||
414 | result->stat = stat; | ||
415 | |||
416 | return result; | ||
417 | Index: libgtkhtml/css/cssparser.h | ||
418 | =================================================================== | ||
419 | RCS file: /cvs/gnome/gtkhtml2/libgtkhtml/css/cssparser.h,v | ||
420 | retrieving revision 1.7 | ||
421 | diff -u -r1.7 cssparser.h | ||
422 | --- libgtkhtml/css/cssparser.h 6 Dec 2002 17:16:54 -0000 1.7 | ||
423 | +++ libgtkhtml/css/cssparser.h 18 Jan 2006 18:24:09 -0000 | ||
424 | @@ -24,13 +24,14 @@ | ||
425 | #define __CSSPARSER_H__ | ||
426 | |||
427 | #include <glib.h> | ||
428 | +#include <regex.h> | ||
429 | |||
430 | #include "cssstylesheet.h" | ||
431 | |||
432 | G_BEGIN_DECLS | ||
433 | |||
434 | -CssStylesheet *css_parser_parse_stylesheet (const gchar *str, gint len); | ||
435 | -CssRuleset *css_parser_parse_style_attr (const gchar *buffer, gint len); | ||
436 | +CssStylesheet *css_parser_parse_stylesheet (const gchar *str, gint len, const gchar *base_url); | ||
437 | +CssRuleset *css_parser_parse_style_attr (const gchar *buffer, gint len, const gchar *base_url); | ||
438 | |||
439 | G_END_DECLS | ||
440 | |||
441 | Index: libgtkhtml/css/cssstylesheet.h | ||
442 | =================================================================== | ||
443 | RCS file: /cvs/gnome/gtkhtml2/libgtkhtml/css/cssstylesheet.h,v | ||
444 | retrieving revision 1.7 | ||
445 | diff -u -r1.7 cssstylesheet.h | ||
446 | --- libgtkhtml/css/cssstylesheet.h 21 Apr 2004 14:17:00 -0000 1.7 | ||
447 | +++ libgtkhtml/css/cssstylesheet.h 18 Jan 2006 18:24:09 -0000 | ||
448 | @@ -181,6 +181,7 @@ | ||
449 | }; | ||
450 | |||
451 | struct _CssStylesheet { | ||
452 | + gchar *url; | ||
453 | gboolean disabled; | ||
454 | GSList *stat; | ||
455 | }; | ||
456 | Index: libgtkhtml/css/cssvalue.c | ||
457 | =================================================================== | ||
458 | RCS file: /cvs/gnome/gtkhtml2/libgtkhtml/css/cssvalue.c,v | ||
459 | retrieving revision 1.6 | ||
460 | diff -u -r1.6 cssvalue.c | ||
461 | --- libgtkhtml/css/cssvalue.c 21 Apr 2004 14:17:00 -0000 1.6 | ||
462 | +++ libgtkhtml/css/cssvalue.c 18 Jan 2006 18:24:09 -0000 | ||
463 | @@ -64,7 +64,7 @@ | ||
464 | function->name = name; | ||
465 | function->args = args; | ||
466 | |||
467 | - result = g_new (CssValue, 1); | ||
468 | + result = g_new0 (CssValue, 1); | ||
469 | result->ref_count = 1; | ||
470 | result->value_type = CSS_FUNCTION; | ||
471 | result->v.function = function; | ||
472 | Index: libgtkhtml/document/htmldocument.c | ||
473 | =================================================================== | ||
474 | RCS file: /cvs/gnome/gtkhtml2/libgtkhtml/document/htmldocument.c,v | ||
475 | retrieving revision 1.122 | ||
476 | diff -u -r1.122 htmldocument.c | ||
477 | --- libgtkhtml/document/htmldocument.c 21 Feb 2005 17:31:31 -0000 1.122 | ||
478 | +++ libgtkhtml/document/htmldocument.c 18 Jan 2006 18:24:11 -0000 | ||
479 | @@ -139,14 +139,42 @@ | ||
480 | html_document_stylesheet_stream_close (const gchar *buffer, gint len, gpointer data) | ||
481 | { | ||
482 | CssStylesheet *sheet; | ||
483 | - HtmlDocument *document = HTML_DOCUMENT (data); | ||
484 | + HtmlDocumentStreamData *stream_data = (HtmlDocumentStreamData *) data; | ||
485 | + HtmlDocument *document = stream_data->document; | ||
486 | HtmlStyleChange style_change; | ||
487 | - | ||
488 | + GSList *list; | ||
489 | + | ||
490 | if (!buffer) | ||
491 | return; | ||
492 | |||
493 | - sheet = css_parser_parse_stylesheet (buffer, len); | ||
494 | + sheet = css_parser_parse_stylesheet (buffer, len, (gchar *) stream_data->internal_data); | ||
495 | + g_free(stream_data->internal_data); | ||
496 | + stream_data->internal_data = NULL; | ||
497 | + | ||
498 | + for (list = sheet->stat; list; list = list->next) { | ||
499 | + CssStatement *statement = list->data; | ||
500 | + HtmlStream *stream; | ||
501 | + | ||
502 | + switch (statement->type) { | ||
503 | + case CSS_IMPORT_RULE: { | ||
504 | + HtmlDocumentStreamData *stream_data_import; | ||
505 | + gchar *url; | ||
506 | + | ||
507 | + url = css_value_to_string (statement->s.import_rule.url); | ||
508 | + stream_data_import = g_new (HtmlDocumentStreamData, 1); | ||
509 | + stream_data_import->document = stream_data->document; | ||
510 | + stream_data_import->internal_data = g_strdup(url); | ||
511 | + stream = html_stream_buffer_new (html_document_stylesheet_stream_close, stream_data_import); | ||
512 | + g_signal_emit (G_OBJECT (document), document_signals [REQUEST_URL], 0, url, stream); | ||
513 | + g_free (url); | ||
514 | + break; | ||
515 | + } | ||
516 | + default: | ||
517 | + break; | ||
518 | + } | ||
519 | + } | ||
520 | |||
521 | + g_free (stream_data); | ||
522 | document->stylesheets = g_slist_append (document->stylesheets, sheet); | ||
523 | |||
524 | /* Restyle the document */ | ||
525 | @@ -184,9 +212,15 @@ | ||
526 | |||
527 | if (str && (strcasecmp (str, "stylesheet") == 0)) { | ||
528 | gchar *url = xmlGetProp (node->xmlnode, "href"); | ||
529 | - | ||
530 | if (url) { | ||
531 | - HtmlStream *stream = html_stream_buffer_new (html_document_stylesheet_stream_close, document); | ||
532 | + HtmlDocumentStreamData *stream_data; | ||
533 | + HtmlStream *stream; | ||
534 | + | ||
535 | + stream_data = g_new (HtmlDocumentStreamData, 1); | ||
536 | + stream_data->document = document; | ||
537 | + stream_data->internal_data = g_strdup(url); | ||
538 | + | ||
539 | + stream = html_stream_buffer_new (html_document_stylesheet_stream_close, stream_data); | ||
540 | |||
541 | g_signal_emit (G_OBJECT (document), document_signals [REQUEST_URL], 0, url, stream); | ||
542 | } | ||
543 | @@ -247,12 +281,39 @@ | ||
544 | |||
545 | CssStylesheet *ss; | ||
546 | HtmlStyleChange style_change; | ||
547 | - | ||
548 | - ss = css_parser_parse_stylesheet (node->xmlnode->content, strlen (node->xmlnode->content)); | ||
549 | - document->stylesheets = g_slist_append (document->stylesheets, ss); | ||
550 | + GSList *list; | ||
551 | + | ||
552 | + ss = css_parser_parse_stylesheet (node->xmlnode->content, strlen (node->xmlnode->content), NULL); | ||
553 | + | ||
554 | + for (list = ss->stat; list; list = list->next) { | ||
555 | + CssStatement *statement = list->data; | ||
556 | + HtmlStream *stream; | ||
557 | + | ||
558 | + switch (statement->type) { | ||
559 | + case CSS_IMPORT_RULE: { | ||
560 | + gchar *cssurl; | ||
561 | + HtmlDocumentStreamData *stream_data; | ||
562 | + | ||
563 | + cssurl = css_value_to_string (statement->s.import_rule.url); | ||
564 | + | ||
565 | + stream_data = g_new (HtmlDocumentStreamData, 1); | ||
566 | + stream_data->document = document; | ||
567 | + stream_data->internal_data = g_strdup(cssurl); | ||
568 | + | ||
569 | + stream = html_stream_buffer_new (html_document_stylesheet_stream_close, stream_data); | ||
570 | + g_signal_emit (G_OBJECT (document), document_signals [REQUEST_URL], 0, cssurl, stream); | ||
571 | + g_free (cssurl); | ||
572 | + break; | ||
573 | + } | ||
574 | + default: | ||
575 | + break; | ||
576 | + } | ||
577 | + } | ||
578 | + | ||
579 | + document->stylesheets = g_slist_append ( document->stylesheets, ss); | ||
580 | |||
581 | /* Restyle the document */ | ||
582 | - style_change = html_document_restyle_node (document, DOM_NODE (dom_Document__get_documentElement (document->dom_document)), NULL, TRUE); | ||
583 | + style_change = html_document_restyle_node (document, DOM_NODE (dom_Document__get_documentElement ( document->dom_document)), NULL, TRUE); | ||
584 | g_signal_emit (G_OBJECT (document), document_signals [STYLE_UPDATED], 0, DOM_NODE (dom_Document__get_documentElement (document->dom_document)), style_change); | ||
585 | } | ||
586 | else if ((node->xmlnode->type == XML_TEXT_NODE || node->xmlnode->type == XML_COMMENT_NODE) && node->xmlnode->parent && strcasecmp (node->xmlnode->parent->name, "script") == 0) { | ||
587 | Index: libgtkhtml/document/htmldocument.h | ||
588 | =================================================================== | ||
589 | RCS file: /cvs/gnome/gtkhtml2/libgtkhtml/document/htmldocument.h,v | ||
590 | retrieving revision 1.35 | ||
591 | diff -u -r1.35 htmldocument.h | ||
592 | --- libgtkhtml/document/htmldocument.h 13 Feb 2005 15:33:19 -0000 1.35 | ||
593 | +++ libgtkhtml/document/htmldocument.h 18 Jan 2006 18:24:12 -0000 | ||
594 | @@ -25,6 +25,7 @@ | ||
595 | |||
596 | typedef struct _HtmlDocument HtmlDocument; | ||
597 | typedef struct _HtmlDocumentClass HtmlDocumentClass; | ||
598 | +typedef struct _HtmlDocumentStreamData HtmlDocumentStreamData; | ||
599 | |||
600 | #include <gtk/gtk.h> | ||
601 | |||
602 | @@ -93,6 +94,10 @@ | ||
603 | gboolean (*dom_mouse_out) (HtmlDocument *document, DomEvent *event); | ||
604 | }; | ||
605 | |||
606 | +struct _HtmlDocumentStreamData { | ||
607 | + HtmlDocument *document; | ||
608 | + gpointer internal_data; | ||
609 | +}; | ||
610 | |||
611 | GType html_document_get_type (void); | ||
612 | |||
613 | Index: libgtkhtml/layout/htmlboxblock.c | ||
614 | =================================================================== | ||
615 | RCS file: /cvs/gnome/gtkhtml2/libgtkhtml/layout/htmlboxblock.c,v | ||
616 | retrieving revision 1.115 | ||
617 | diff -u -r1.115 htmlboxblock.c | ||
618 | --- libgtkhtml/layout/htmlboxblock.c 6 Jan 2004 10:09:56 -0000 1.115 | ||
619 | +++ libgtkhtml/layout/htmlboxblock.c 18 Jan 2006 18:24:14 -0000 | ||
620 | @@ -100,17 +100,21 @@ | ||
621 | HtmlBoxBlock *block = HTML_BOX_BLOCK (self); | ||
622 | gint full_width; | ||
623 | |||
624 | +#if 0 | ||
625 | if (relayout->get_min_width || relayout->get_max_width) { | ||
626 | +#endif | ||
627 | |||
628 | /* Only expand the width of the block box if the width is of type "auto" */ | ||
629 | if (HTML_BOX_GET_STYLE (self)->box->width.type == HTML_LENGTH_AUTO && line->width > *boxwidth) { | ||
630 | - | ||
631 | + | ||
632 | *boxwidth = line->width; | ||
633 | block->containing_width = line->width; | ||
634 | self->width = *boxwidth + html_box_horizontal_mbp_sum (self); | ||
635 | block->force_relayout = TRUE; | ||
636 | } | ||
637 | +#if 0 | ||
638 | } | ||
639 | +#endif | ||
640 | full_width = MAX (line->width, line->full_width); | ||
641 | |||
642 | if (full_width > block->full_width) | ||
643 | @@ -233,7 +237,7 @@ | ||
644 | HtmlBoxBlock *block = HTML_BOX_BLOCK (self); | ||
645 | HtmlLineBox *line; | ||
646 | |||
647 | - /* If it is a flotbox, just add it */ | ||
648 | + /* If it is a floatbox, just add it */ | ||
649 | if (HTML_BOX_GET_STYLE (box)->Float != HTML_FLOAT_NONE) { | ||
650 | html_box_block_handle_float (self, relayout, box, *y, boxwidth); | ||
651 | return NULL; | ||
652 | Index: libgtkhtml/layout/htmlstyleinherited.c | ||
653 | =================================================================== | ||
654 | RCS file: /cvs/gnome/gtkhtml2/libgtkhtml/layout/htmlstyleinherited.c,v | ||
655 | retrieving revision 1.15 | ||
656 | diff -u -r1.15 htmlstyleinherited.c | ||
657 | --- libgtkhtml/layout/htmlstyleinherited.c 6 Dec 2002 17:17:15 -0000 1.15 | ||
658 | +++ libgtkhtml/layout/htmlstyleinherited.c 18 Jan 2006 18:24:15 -0000 | ||
659 | @@ -300,6 +300,37 @@ | ||
660 | *size = (gint) (val->v.d * old_size); | ||
661 | return TRUE; | ||
662 | default: | ||
663 | + switch (val->v.atom) { | ||
664 | + /* FIXME: These values are copy/pasted from html.css.h, X_SMALL is guessed */ | ||
665 | + case HTML_ATOM_XX_SMALL: | ||
666 | + *size = (gint) (0.67 * old_size); | ||
667 | + return TRUE; | ||
668 | + case HTML_ATOM_X_SMALL: | ||
669 | + *size = (gint) (0.75 * old_size); | ||
670 | + return TRUE; | ||
671 | + case HTML_ATOM_SMALL: | ||
672 | + *size = (gint) (0.83 * old_size); | ||
673 | + return TRUE; | ||
674 | + case HTML_ATOM_MEDIUM: | ||
675 | + *size = (gint) (1 * old_size); | ||
676 | + return TRUE; | ||
677 | + case HTML_ATOM_LARGE: | ||
678 | + *size = (gint) (1.17 * old_size); | ||
679 | + return TRUE; | ||
680 | + case HTML_ATOM_X_LARGE: | ||
681 | + *size = (gint) (1.5 * old_size); | ||
682 | + return TRUE; | ||
683 | + case HTML_ATOM_XX_LARGE: | ||
684 | + *size = (gint) (2 * old_size); | ||
685 | + return TRUE; | ||
686 | + /* FIXME: These are absolutely guessed. Size should always be one of the above seven. */ | ||
687 | + case HTML_ATOM_LARGER: | ||
688 | + *size = (gint) (0.8 * old_size); | ||
689 | + return TRUE; | ||
690 | + case HTML_ATOM_SMALLER: | ||
691 | + *size = (gint) (1.2 * old_size); | ||
692 | + return TRUE; | ||
693 | + } | ||
694 | return FALSE; | ||
695 | } | ||
696 | } | ||
697 | Index: libgtkhtml/view/htmlevent.c | ||
698 | =================================================================== | ||
699 | RCS file: /cvs/gnome/gtkhtml2/libgtkhtml/view/htmlevent.c,v | ||
700 | retrieving revision 1.41 | ||
701 | diff -u -r1.41 htmlevent.c | ||
702 | --- libgtkhtml/view/htmlevent.c 14 Sep 2004 06:34:27 -0000 1.41 | ||
703 | +++ libgtkhtml/view/htmlevent.c 18 Jan 2006 18:24:17 -0000 | ||
704 | @@ -46,14 +46,48 @@ | ||
705 | static gboolean | ||
706 | html_event_xy_in_box (HtmlBox *box, gint tx, gint ty, gint x, gint y) | ||
707 | { | ||
708 | + gint ox, oy; | ||
709 | + gboolean rv; | ||
710 | + | ||
711 | + ox = box->x; | ||
712 | + oy = box->y; | ||
713 | + | ||
714 | + rv = TRUE; | ||
715 | + | ||
716 | + if ((HTML_BOX_GET_STYLE (box)->position == HTML_POSITION_RELATIVE || | ||
717 | + HTML_BOX_GET_STYLE (box)->position == HTML_POSITION_ABSOLUTE)) { | ||
718 | + gint width = html_box_get_containing_block_width (box); | ||
719 | + gint height = html_box_get_containing_block_height (box); | ||
720 | + | ||
721 | + if (HTML_BOX_GET_STYLE (box)->surround->position.left.type != HTML_LENGTH_AUTO) | ||
722 | + box->x += html_length_get_value (&HTML_BOX_GET_STYLE (box)->surround->position.left, width); | ||
723 | + else if (HTML_BOX_GET_STYLE (box)->surround->position.right.type != HTML_LENGTH_AUTO) { | ||
724 | + if (HTML_BOX_GET_STYLE (box)->display == HTML_DISPLAY_INLINE) | ||
725 | + box->x -= html_length_get_value (&HTML_BOX_GET_STYLE (box)->surround->position.right, width); | ||
726 | + else | ||
727 | + box->x += width - box->width - html_length_get_value (&HTML_BOX_GET_STYLE (box)->surround->position.right, width); | ||
728 | + } | ||
729 | + if (HTML_BOX_GET_STYLE (box)->surround->position.top.type != HTML_LENGTH_AUTO) | ||
730 | + box->y += html_length_get_value (&HTML_BOX_GET_STYLE (box)->surround->position.top, height); | ||
731 | + | ||
732 | + else if (HTML_BOX_GET_STYLE (box)->surround->position.bottom.type != HTML_LENGTH_AUTO) { | ||
733 | + if (HTML_BOX_GET_STYLE (box)->display == HTML_DISPLAY_INLINE) | ||
734 | + box->y -= html_length_get_value (&HTML_BOX_GET_STYLE (box)->surround->position.bottom, height); | ||
735 | + else | ||
736 | + box->y += height - box->height - html_length_get_value (&HTML_BOX_GET_STYLE (box)->surround->position.bottom, height); | ||
737 | + } | ||
738 | + } | ||
739 | |||
740 | if (x < box->x + tx || | ||
741 | x > box->x + tx + box->width || | ||
742 | y < box->y + ty || | ||
743 | y > box->y + ty + box->height) | ||
744 | - return FALSE; | ||
745 | + rv = FALSE; | ||
746 | + | ||
747 | + box->x = ox; | ||
748 | + box->y = oy; | ||
749 | |||
750 | - return TRUE; | ||
751 | + return rv; | ||
752 | } | ||
753 | |||
754 | static void | ||
755 | @@ -64,12 +98,6 @@ | ||
756 | box = self->children; | ||
757 | |||
758 | while (box) { | ||
759 | - | ||
760 | - /* Ignore positioned boxes, because their ->x and->y positions is not their correct positions */ | ||
761 | - if (HTML_BOX_GET_STYLE (box)->position != HTML_POSITION_STATIC) { | ||
762 | - box = box->next; | ||
763 | - continue; | ||
764 | - } | ||
765 | /* These boxes always has x = 0, y = 0, w = 0 and h = 0 so we have to do | ||
766 | * a special case for these */ | ||
767 | if (HTML_IS_BOX_INLINE (box) || HTML_IS_BOX_TABLE_ROW_GROUP (box) || HTML_IS_BOX_FORM (box)) { | ||
diff --git a/openembedded/packages/gtkhtml2/files/css-media.patch b/openembedded/packages/gtkhtml2/files/css-media.patch new file mode 100644 index 0000000000..999ce196dc --- /dev/null +++ b/openembedded/packages/gtkhtml2/files/css-media.patch | |||
@@ -0,0 +1,487 @@ | |||
1 | Index: gtkhtml2/libgtkhtml/css/cssmatcher.c | ||
2 | =================================================================== | ||
3 | --- gtkhtml2.orig/libgtkhtml/css/cssmatcher.c 2006-01-25 02:07:44.000000000 +0000 | ||
4 | +++ gtkhtml2/libgtkhtml/css/cssmatcher.c 2006-02-01 02:19:13.000000000 +0000 | ||
5 | @@ -2411,7 +2411,8 @@ | ||
6 | CssStatement *stat = list->data; | ||
7 | gint j; | ||
8 | |||
9 | - if (stat->type == CSS_IMPORT_RULE) { | ||
10 | + switch (stat->type) { | ||
11 | + case CSS_IMPORT_RULE: { | ||
12 | if (stat->s.import_rule.fetched) { | ||
13 | if (stat->s.import_rule.sheet) { | ||
14 | css_matcher_apply_stylesheet (doc, stat->s.import_rule.sheet, node, declaration_list, type, pseudo); | ||
15 | @@ -2440,31 +2441,65 @@ | ||
16 | g_free (str); | ||
17 | #endif | ||
18 | } | ||
19 | + break; | ||
20 | } | ||
21 | - | ||
22 | - /* FIXME: We need to support more than just rulesets here */ | ||
23 | - if (stat->type != CSS_RULESET) | ||
24 | - continue; | ||
25 | - | ||
26 | - for (j = 0; j < stat->s.ruleset->n_sel; j++) { | ||
27 | - CssSelector *sel = stat->s.ruleset->sel[j]; | ||
28 | + | ||
29 | + case CSS_MEDIA_RULE: | ||
30 | + case CSS_RULESET: { | ||
31 | + CssRuleset **rs; | ||
32 | + gint k, l; | ||
33 | |||
34 | - if (css_matcher_match_selector (sel, node, pseudo)) { | ||
35 | - int i; | ||
36 | + if (stat->type == CSS_MEDIA_RULE) { | ||
37 | + CssValueEntry *entry = stat->s.media_rule.media_list->v.entry; | ||
38 | + const gchar *media = html_document_get_media_type (doc); | ||
39 | + gboolean has_media = FALSE; | ||
40 | |||
41 | - for (i = 0; i < stat->s.ruleset->n_decl; i++) { | ||
42 | - CssDeclaration *decl = stat->s.ruleset->decl[i]; | ||
43 | - CssDeclarationListEntry *entry = g_new (CssDeclarationListEntry, 1); | ||
44 | + if (!media) break; | ||
45 | + | ||
46 | + for (; entry; entry = entry->next) { | ||
47 | + const gchar *value = css_value_to_string (entry->value); | ||
48 | + if (strcasecmp (media, value) == 0) { | ||
49 | + has_media = TRUE; | ||
50 | + break; | ||
51 | + } | ||
52 | + } | ||
53 | + if (!has_media) break; | ||
54 | + | ||
55 | + rs = stat->s.media_rule.rs; | ||
56 | + k = stat->s.media_rule.n_rs; | ||
57 | + } else { | ||
58 | + rs = &stat->s.ruleset; | ||
59 | + k = 1; | ||
60 | + } | ||
61 | + | ||
62 | + for (l = 0; l < k; l++) { | ||
63 | + for (j = 0; rs[l] && (j < rs[l]->n_sel); j++) { | ||
64 | + CssSelector *sel = rs[l]->sel[j]; | ||
65 | |||
66 | - entry->spec = sel->a * 1000000 + sel->b * 1000 + sel->c; | ||
67 | - entry->type = type; | ||
68 | - entry->decl = g_new (CssDeclaration, 1); | ||
69 | - entry->decl->property = decl->property; | ||
70 | - entry->decl->expr = css_value_ref (decl->expr); | ||
71 | - entry->decl->important = decl->important; | ||
72 | - *declaration_list = g_list_insert_sorted (*declaration_list, entry, css_declaration_list_sorter); | ||
73 | + if (css_matcher_match_selector (sel, node, pseudo)) { | ||
74 | + int i; | ||
75 | + | ||
76 | + for (i = 0; i < rs[l]->n_decl; i++) { | ||
77 | + CssDeclaration *decl = rs[l]->decl[i]; | ||
78 | + CssDeclarationListEntry *entry = g_new (CssDeclarationListEntry, 1); | ||
79 | + | ||
80 | + entry->spec = sel->a * 1000000 + sel->b * 1000 + sel->c; | ||
81 | + entry->type = type; | ||
82 | + entry->decl = g_new (CssDeclaration, 1); | ||
83 | + entry->decl->property = decl->property; | ||
84 | + entry->decl->expr = css_value_ref (decl->expr); | ||
85 | + entry->decl->important = decl->important; | ||
86 | + *declaration_list = g_list_insert_sorted (*declaration_list, entry, css_declaration_list_sorter); | ||
87 | + } | ||
88 | + } | ||
89 | } | ||
90 | } | ||
91 | + break; | ||
92 | + } | ||
93 | + | ||
94 | + default: | ||
95 | + g_warning ("Unhandled stylesheet"); | ||
96 | + break; | ||
97 | } | ||
98 | } | ||
99 | } | ||
100 | @@ -2781,7 +2816,7 @@ | ||
101 | css_matcher_html_to_css (doc, style, node); | ||
102 | |||
103 | if (!default_stylesheet) { | ||
104 | - default_stylesheet = css_parser_parse_stylesheet (html_css, strlen (html_css), NULL); | ||
105 | + default_stylesheet = css_parser_parse_stylesheet (html_css, strlen (html_css), NULL, NULL); | ||
106 | } | ||
107 | |||
108 | css_matcher_apply_stylesheet (doc, default_stylesheet, node, &declaration_list, CSS_STYLESHEET_DEFAULT, pseudo); | ||
109 | @@ -2800,25 +2835,31 @@ | ||
110 | prop = xmlGetProp (node, "style"); | ||
111 | |||
112 | if (prop) { | ||
113 | - CssRuleset *rs = css_parser_parse_style_attr (prop, strlen (prop), NULL); | ||
114 | - gint i; | ||
115 | + xmlChar *media_prop = xmlGetProp (node, "media"); | ||
116 | + const gchar *media = html_document_get_media_type (doc); | ||
117 | |||
118 | - if (rs) { | ||
119 | - for (i = 0; i < rs->n_decl; i++) { | ||
120 | - CssDeclarationListEntry *entry = g_new (CssDeclarationListEntry, 1); | ||
121 | - CssDeclaration *decl = rs->decl[i]; | ||
122 | - | ||
123 | - entry->type = CSS_STYLESHEET_STYLEDECL; | ||
124 | - entry->decl = g_new (CssDeclaration, 1); | ||
125 | - entry->decl->property = decl->property; | ||
126 | - entry->decl->expr = css_value_ref (decl->expr); | ||
127 | - entry->decl->important = decl->important; | ||
128 | - entry->spec = 0; | ||
129 | + if (!media_prop || (media && (strcasecmp (media, media_prop) == 0))) { | ||
130 | + CssRuleset *rs = css_parser_parse_style_attr (prop, strlen (prop), NULL); | ||
131 | + gint i; | ||
132 | + | ||
133 | + if (rs) { | ||
134 | + for (i = 0; i < rs->n_decl; i++) { | ||
135 | + CssDeclarationListEntry *entry = g_new (CssDeclarationListEntry, 1); | ||
136 | + CssDeclaration *decl = rs->decl[i]; | ||
137 | |||
138 | - declaration_list = g_list_insert_sorted (declaration_list, entry, css_declaration_list_sorter); | ||
139 | + entry->type = CSS_STYLESHEET_STYLEDECL; | ||
140 | + entry->decl = g_new (CssDeclaration, 1); | ||
141 | + entry->decl->property = decl->property; | ||
142 | + entry->decl->expr = css_value_ref (decl->expr); | ||
143 | + entry->decl->important = decl->important; | ||
144 | + entry->spec = 0; | ||
145 | + | ||
146 | + declaration_list = g_list_insert_sorted (declaration_list, entry, css_declaration_list_sorter); | ||
147 | + } | ||
148 | + css_ruleset_destroy (rs); | ||
149 | } | ||
150 | - css_ruleset_destroy (rs); | ||
151 | } | ||
152 | + if (media_prop) xmlFree (media_prop); | ||
153 | xmlFree (prop); | ||
154 | } | ||
155 | |||
156 | Index: gtkhtml2/libgtkhtml/document/htmldocument.c | ||
157 | =================================================================== | ||
158 | --- gtkhtml2.orig/libgtkhtml/document/htmldocument.c 2006-01-25 02:07:49.000000000 +0000 | ||
159 | +++ gtkhtml2/libgtkhtml/document/htmldocument.c 2006-02-01 02:19:13.000000000 +0000 | ||
160 | @@ -147,9 +147,7 @@ | ||
161 | if (!buffer) | ||
162 | return; | ||
163 | |||
164 | - sheet = css_parser_parse_stylesheet (buffer, len, (gchar *) stream_data->internal_data); | ||
165 | - g_free(stream_data->internal_data); | ||
166 | - stream_data->internal_data = NULL; | ||
167 | + sheet = css_parser_parse_stylesheet (buffer, len, (gchar *) stream_data->internal_data, stream_data->media); | ||
168 | |||
169 | for (list = sheet->stat; list; list = list->next) { | ||
170 | CssStatement *statement = list->data; | ||
171 | @@ -158,15 +156,13 @@ | ||
172 | switch (statement->type) { | ||
173 | case CSS_IMPORT_RULE: { | ||
174 | HtmlDocumentStreamData *stream_data_import; | ||
175 | - gchar *url; | ||
176 | |||
177 | - url = css_value_to_string (statement->s.import_rule.url); | ||
178 | stream_data_import = g_new (HtmlDocumentStreamData, 1); | ||
179 | stream_data_import->document = stream_data->document; | ||
180 | - stream_data_import->internal_data = g_strdup(url); | ||
181 | + stream_data_import->internal_data = css_value_to_string (statement->s.import_rule.url); | ||
182 | + stream_data_import->media = statement->s.import_rule.media ? statement->s.import_rule.media : g_strdup (stream_data->media); | ||
183 | stream = html_stream_buffer_new (html_document_stylesheet_stream_close, stream_data_import); | ||
184 | - g_signal_emit (G_OBJECT (document), document_signals [REQUEST_URL], 0, url, stream); | ||
185 | - g_free (url); | ||
186 | + g_signal_emit (G_OBJECT (document), document_signals [REQUEST_URL], 0, stream_data_import->internal_data, stream); | ||
187 | break; | ||
188 | } | ||
189 | default: | ||
190 | @@ -174,8 +170,11 @@ | ||
191 | } | ||
192 | } | ||
193 | |||
194 | - g_free (stream_data); | ||
195 | document->stylesheets = g_slist_append (document->stylesheets, sheet); | ||
196 | + | ||
197 | + g_free (stream_data->media); | ||
198 | + g_free(stream_data->internal_data); | ||
199 | + g_free (stream_data); | ||
200 | |||
201 | /* Restyle the document */ | ||
202 | style_change = html_document_restyle_node (document, DOM_NODE (dom_Document__get_documentElement (document->dom_document)), NULL, TRUE); | ||
203 | @@ -216,21 +215,22 @@ | ||
204 | HtmlDocumentStreamData *stream_data; | ||
205 | HtmlStream *stream; | ||
206 | |||
207 | - stream_data = g_new (HtmlDocumentStreamData, 1); | ||
208 | + stream_data = g_new0 (HtmlDocumentStreamData, 1); | ||
209 | stream_data->document = document; | ||
210 | stream_data->internal_data = g_strdup(url); | ||
211 | + stream_data->media = xmlGetProp (node->xmlnode, "media"); | ||
212 | |||
213 | stream = html_stream_buffer_new (html_document_stylesheet_stream_close, stream_data); | ||
214 | |||
215 | g_signal_emit (G_OBJECT (document), document_signals [REQUEST_URL], 0, url, stream); | ||
216 | + g_free (url); | ||
217 | } | ||
218 | - g_free (url); | ||
219 | } else if (str && (strcasecmp (str, "icon") == 0)) { | ||
220 | gchar *url = xmlGetProp (node->xmlnode, "href"); | ||
221 | if (url) { | ||
222 | g_signal_emit (G_OBJECT (document), document_signals [REQUEST_ICON], 0, url); | ||
223 | + g_free (url); | ||
224 | } | ||
225 | - g_free (url); | ||
226 | } | ||
227 | g_free (str); | ||
228 | } | ||
229 | @@ -282,8 +282,10 @@ | ||
230 | CssStylesheet *ss; | ||
231 | HtmlStyleChange style_change; | ||
232 | GSList *list; | ||
233 | + xmlChar *media = xmlGetProp (node->xmlnode->parent, "media"); | ||
234 | |||
235 | - ss = css_parser_parse_stylesheet (node->xmlnode->content, strlen (node->xmlnode->content), NULL); | ||
236 | + ss = css_parser_parse_stylesheet (node->xmlnode->content, strlen (node->xmlnode->content), NULL, media); | ||
237 | + if (media) xmlFree (media); | ||
238 | |||
239 | for (list = ss->stat; list; list = list->next) { | ||
240 | CssStatement *statement = list->data; | ||
241 | @@ -296,9 +298,10 @@ | ||
242 | |||
243 | cssurl = css_value_to_string (statement->s.import_rule.url); | ||
244 | |||
245 | - stream_data = g_new (HtmlDocumentStreamData, 1); | ||
246 | + stream_data = g_new0 (HtmlDocumentStreamData, 1); | ||
247 | stream_data->document = document; | ||
248 | stream_data->internal_data = g_strdup(cssurl); | ||
249 | + stream_data->media = statement->s.import_rule.media; | ||
250 | |||
251 | stream = html_stream_buffer_new (html_document_stylesheet_stream_close, stream_data); | ||
252 | g_signal_emit (G_OBJECT (document), document_signals [REQUEST_URL], 0, cssurl, stream); | ||
253 | @@ -546,6 +549,9 @@ | ||
254 | |||
255 | if (document->parser) | ||
256 | g_object_unref (G_OBJECT (document->parser)); | ||
257 | + | ||
258 | + if (document->media_type) | ||
259 | + g_free (document->media_type); | ||
260 | |||
261 | parent_class->finalize (object); | ||
262 | } | ||
263 | @@ -753,6 +759,7 @@ | ||
264 | { | ||
265 | document->stylesheets = NULL; | ||
266 | document->image_factory = html_image_factory_new (); | ||
267 | + document->media_type = NULL; | ||
268 | |||
269 | g_signal_connect (G_OBJECT (document->image_factory), "request_image", | ||
270 | G_CALLBACK (html_document_request_image), document); | ||
271 | @@ -1129,7 +1136,7 @@ | ||
272 | } | ||
273 | |||
274 | CssStylesheet * | ||
275 | -html_document_add_stylesheet (HtmlDocument *document, const gchar *buffer, gint len) | ||
276 | +html_document_add_stylesheet (HtmlDocument *document, const gchar *buffer, gint len, const gchar *media) | ||
277 | { | ||
278 | CssStylesheet *sheet; | ||
279 | HtmlStyleChange style_change; | ||
280 | @@ -1140,7 +1147,7 @@ | ||
281 | * complications it would cause with removal. | ||
282 | */ | ||
283 | |||
284 | - sheet = css_parser_parse_stylesheet (buffer, len, NULL); | ||
285 | + sheet = css_parser_parse_stylesheet (buffer, len, NULL, media); | ||
286 | document->stylesheets = g_slist_append (document->stylesheets, sheet); | ||
287 | |||
288 | style_change = html_document_restyle_node (document, DOM_NODE (dom_Document__get_documentElement (document->dom_document)), NULL, TRUE); | ||
289 | @@ -1159,3 +1166,24 @@ | ||
290 | return TRUE; | ||
291 | } | ||
292 | |||
293 | +void | ||
294 | +html_document_set_media_type (HtmlDocument *document, const gchar *type) | ||
295 | +{ | ||
296 | + HtmlStyleChange style_change; | ||
297 | + | ||
298 | + g_return_if_fail (HTML_IS_DOCUMENT (document)); | ||
299 | + | ||
300 | + if (document->media_type) | ||
301 | + g_free (document->media_type); | ||
302 | + | ||
303 | + document->media_type = g_strdup (type); | ||
304 | + | ||
305 | + style_change = html_document_restyle_node (document, DOM_NODE (dom_Document__get_documentElement (document->dom_document)), NULL, TRUE); | ||
306 | + g_signal_emit (G_OBJECT (document), document_signals [STYLE_UPDATED], 0, DOM_NODE (dom_Document__get_documentElement (document->dom_document)), style_change); | ||
307 | +} | ||
308 | + | ||
309 | +const gchar * | ||
310 | +html_document_get_media_type (HtmlDocument *document) | ||
311 | +{ | ||
312 | + return document->media_type; | ||
313 | +} | ||
314 | Index: gtkhtml2/libgtkhtml/document/htmldocument.h | ||
315 | =================================================================== | ||
316 | --- gtkhtml2.orig/libgtkhtml/document/htmldocument.h 2006-01-25 02:07:49.000000000 +0000 | ||
317 | +++ gtkhtml2/libgtkhtml/document/htmldocument.h 2006-01-25 02:07:50.000000000 +0000 | ||
318 | @@ -64,6 +64,8 @@ | ||
319 | DomNode *hover_node; | ||
320 | DomNode *active_node; | ||
321 | DomElement *focus_element; | ||
322 | + | ||
323 | + gchar *media_type; | ||
324 | }; | ||
325 | |||
326 | struct _HtmlDocumentClass { | ||
327 | @@ -97,6 +99,7 @@ | ||
328 | struct _HtmlDocumentStreamData { | ||
329 | HtmlDocument *document; | ||
330 | gpointer internal_data; | ||
331 | + gchar *media; | ||
332 | }; | ||
333 | |||
334 | GType html_document_get_type (void); | ||
335 | @@ -113,9 +116,12 @@ | ||
336 | void html_document_update_focus_element (HtmlDocument *document, DomElement *element); | ||
337 | DomNode *html_document_find_anchor (HtmlDocument *doc, const gchar *anchor); | ||
338 | |||
339 | -CssStylesheet *html_document_add_stylesheet (HtmlDocument *document, const gchar *buffer, gint len); | ||
340 | +CssStylesheet *html_document_add_stylesheet (HtmlDocument *document, const gchar *buffer, gint len, const gchar *media); | ||
341 | gboolean html_document_remove_stylesheet (HtmlDocument *document, CssStylesheet *stylesheet); | ||
342 | |||
343 | +void html_document_set_media_type (HtmlDocument *document, const gchar *type); | ||
344 | +const gchar *html_document_get_media_type (HtmlDocument *document); | ||
345 | + | ||
346 | G_END_DECLS | ||
347 | |||
348 | #endif /* __HTMLDOCUMENT_H__ */ | ||
349 | Index: gtkhtml2/libgtkhtml/css/cssparser.c | ||
350 | =================================================================== | ||
351 | --- gtkhtml2.orig/libgtkhtml/css/cssparser.c 2006-01-25 02:05:54.000000000 +0000 | ||
352 | +++ gtkhtml2/libgtkhtml/css/cssparser.c 2006-01-25 02:07:50.000000000 +0000 | ||
353 | @@ -688,6 +688,32 @@ | ||
354 | return pos; | ||
355 | } | ||
356 | |||
357 | +static void | ||
358 | +css_parser_parse_media_list (const gchar *buffer, gint start_pos, gint end_pos, CssValue **ret_val) | ||
359 | +{ | ||
360 | + CssValue *list = NULL; | ||
361 | + while (start_pos < end_pos) { | ||
362 | + CssValue *val; | ||
363 | + HtmlAtom name; | ||
364 | + | ||
365 | + if (buffer[start_pos] == ',') | ||
366 | + start_pos++; | ||
367 | + | ||
368 | + start_pos = css_parser_parse_whitespace (buffer, start_pos, end_pos); | ||
369 | + | ||
370 | + if (start_pos >= end_pos) | ||
371 | + break; | ||
372 | + | ||
373 | + start_pos = css_parser_parse_ident (buffer, start_pos, end_pos, &name); | ||
374 | + val = css_value_ident_new (name); | ||
375 | + if (!list) list = css_value_list_new (); | ||
376 | + css_value_list_append (list, val, ','); | ||
377 | + | ||
378 | + start_pos = css_parser_parse_whitespace (buffer, start_pos, end_pos); | ||
379 | + } | ||
380 | + | ||
381 | + *ret_val = list; | ||
382 | +} | ||
383 | |||
384 | static gint | ||
385 | css_parser_parse_attr_selector (const gchar *buffer, gint start_pos, gint end_pos, CssTail *tail) | ||
386 | @@ -1329,7 +1355,7 @@ | ||
387 | |||
388 | /* g_print ("Going to return: %d\n", pos); */ | ||
389 | |||
390 | - return pos + 1; | ||
391 | + return pos; | ||
392 | |||
393 | break; | ||
394 | case HTML_ATOM_PAGE: | ||
395 | @@ -1390,7 +1416,8 @@ | ||
396 | break; | ||
397 | case HTML_ATOM_IMPORT: { | ||
398 | gchar *import_url; | ||
399 | - const gchar *s_url, *e_url; | ||
400 | + const gchar *s_url, *e_url, *e_import, *e_media; | ||
401 | + CssValue *value = NULL; | ||
402 | |||
403 | cur_pos = css_parser_parse_to_char (buffer, ';', pos, end_pos); | ||
404 | |||
405 | @@ -1411,6 +1438,7 @@ | ||
406 | return cur_pos + 1; | ||
407 | } | ||
408 | |||
409 | + e_import = e_url + 1; | ||
410 | s_url++; | ||
411 | e_url--; | ||
412 | |||
413 | @@ -1434,6 +1462,11 @@ | ||
414 | result->type = CSS_IMPORT_RULE; | ||
415 | |||
416 | result->s.import_rule.url = css_value_string_new (import_url); | ||
417 | + | ||
418 | + /* Check for media types */ | ||
419 | + e_media = buffer + cur_pos; | ||
420 | + if ((e_media > e_import) && (css_parser_parse_whitespace(e_import, 0, e_media-e_import) < (e_media-e_import))) | ||
421 | + result->s.import_rule.media = g_strndup (e_import, e_media-e_import); | ||
422 | |||
423 | *ret_val = result; | ||
424 | |||
425 | @@ -1489,7 +1522,7 @@ | ||
426 | } | ||
427 | |||
428 | CssStylesheet * | ||
429 | -css_parser_parse_stylesheet (const gchar *str, gint len, const gchar *base_url) | ||
430 | +css_parser_parse_stylesheet (const gchar *str, gint len, const gchar *base_url, const gchar *media) | ||
431 | { | ||
432 | CssStylesheet *result; | ||
433 | GSList *stat = NULL; | ||
434 | @@ -1515,12 +1548,23 @@ | ||
435 | pos = css_parser_parse_ruleset (buffer, pos, end_pos, &ruleset, base_url); | ||
436 | |||
437 | if (ruleset) { | ||
438 | - CssStatement *rulestatement; | ||
439 | - rulestatement = g_new0 (CssStatement, 1); | ||
440 | - rulestatement->type = CSS_RULESET; | ||
441 | - rulestatement->s.ruleset = ruleset; | ||
442 | + CssStatement *statement; | ||
443 | + | ||
444 | + if (media) { | ||
445 | + statement = g_new0 (CssStatement, 1); | ||
446 | |||
447 | - stat = g_slist_append (stat, rulestatement); | ||
448 | + statement->type = CSS_MEDIA_RULE; | ||
449 | + css_parser_parse_media_list (media, 0, strlen (media), &statement->s.media_rule.media_list); | ||
450 | + g_assert (statement->s.media_rule.media_list); | ||
451 | + statement->s.media_rule.rs = g_new (CssRuleset *, 1); | ||
452 | + statement->s.media_rule.rs[0] = ruleset; | ||
453 | + statement->s.media_rule.n_rs = 1; | ||
454 | + } else { | ||
455 | + statement = g_new0 (CssStatement, 1); | ||
456 | + statement->type = CSS_RULESET; | ||
457 | + statement->s.ruleset = ruleset; | ||
458 | + } | ||
459 | + stat = g_slist_append (stat, statement); | ||
460 | } | ||
461 | |||
462 | if (pos == -1) | ||
463 | Index: gtkhtml2/libgtkhtml/css/cssparser.h | ||
464 | =================================================================== | ||
465 | --- gtkhtml2.orig/libgtkhtml/css/cssparser.h 2006-01-25 02:05:54.000000000 +0000 | ||
466 | +++ gtkhtml2/libgtkhtml/css/cssparser.h 2006-01-25 02:07:50.000000000 +0000 | ||
467 | @@ -30,7 +30,7 @@ | ||
468 | |||
469 | G_BEGIN_DECLS | ||
470 | |||
471 | -CssStylesheet *css_parser_parse_stylesheet (const gchar *str, gint len, const gchar *base_url); | ||
472 | +CssStylesheet *css_parser_parse_stylesheet (const gchar *str, gint len, const gchar *base_url, const gchar *media); | ||
473 | CssRuleset *css_parser_parse_style_attr (const gchar *buffer, gint len, const gchar *base_url); | ||
474 | |||
475 | G_END_DECLS | ||
476 | Index: gtkhtml2/libgtkhtml/css/cssstylesheet.h | ||
477 | =================================================================== | ||
478 | --- gtkhtml2.orig/libgtkhtml/css/cssstylesheet.h 2006-02-01 02:19:56.000000000 +0000 | ||
479 | +++ gtkhtml2/libgtkhtml/css/cssstylesheet.h 2006-02-01 02:20:08.000000000 +0000 | ||
480 | @@ -99,6 +99,7 @@ | ||
481 | CssValue *url; | ||
482 | gboolean fetched; | ||
483 | gboolean fetching; | ||
484 | + gchar *media; | ||
485 | } import_rule; | ||
486 | |||
487 | } s; | ||
diff --git a/openembedded/packages/gtkhtml2/files/css-stylesheet-user.patch b/openembedded/packages/gtkhtml2/files/css-stylesheet-user.patch new file mode 100644 index 0000000000..85fe535126 --- /dev/null +++ b/openembedded/packages/gtkhtml2/files/css-stylesheet-user.patch | |||
@@ -0,0 +1,54 @@ | |||
1 | Index: gtkhtml2/libgtkhtml/document/htmldocument.c | ||
2 | =================================================================== | ||
3 | --- gtkhtml2.orig/libgtkhtml/document/htmldocument.c 2006-01-21 02:24:09.000000000 +0000 | ||
4 | +++ gtkhtml2/libgtkhtml/document/htmldocument.c 2006-01-21 04:21:37.000000000 +0000 | ||
5 | @@ -1127,3 +1127,35 @@ | ||
6 | else | ||
7 | return NULL; | ||
8 | } | ||
9 | + | ||
10 | +CssStylesheet * | ||
11 | +html_document_add_stylesheet (HtmlDocument *document, const gchar *buffer, gint len) | ||
12 | +{ | ||
13 | + CssStylesheet *sheet; | ||
14 | + HtmlStyleChange style_change; | ||
15 | + | ||
16 | + g_return_val_if_fail (buffer && (len > 0) && HTML_IS_DOCUMENT (document), NULL); | ||
17 | + | ||
18 | + /* Note: @import not supported for user stylesheets, due to | ||
19 | + * complications it would cause with removal. | ||
20 | + */ | ||
21 | + | ||
22 | + sheet = css_parser_parse_stylesheet (buffer, len, NULL); | ||
23 | + document->stylesheets = g_slist_append (document->stylesheets, sheet); | ||
24 | + | ||
25 | + style_change = html_document_restyle_node (document, DOM_NODE (dom_Document__get_documentElement (document->dom_document)), NULL, TRUE); | ||
26 | + g_signal_emit (G_OBJECT (document), document_signals [STYLE_UPDATED], 0, DOM_NODE (dom_Document__get_documentElement (document->dom_document)), style_change); | ||
27 | + | ||
28 | + return sheet; | ||
29 | +} | ||
30 | + | ||
31 | +gboolean | ||
32 | +html_document_remove_stylesheet (HtmlDocument *document, CssStylesheet *stylesheet) | ||
33 | +{ | ||
34 | + g_return_val_if_fail (stylesheet && HTML_IS_DOCUMENT (document), FALSE); | ||
35 | + | ||
36 | + document->stylesheets = g_slist_remove (document->stylesheets, stylesheet); | ||
37 | + | ||
38 | + return TRUE; | ||
39 | +} | ||
40 | + | ||
41 | Index: gtkhtml2/libgtkhtml/document/htmldocument.h | ||
42 | =================================================================== | ||
43 | --- gtkhtml2.orig/libgtkhtml/document/htmldocument.h 2006-01-21 02:24:09.000000000 +0000 | ||
44 | +++ gtkhtml2/libgtkhtml/document/htmldocument.h 2006-01-21 03:48:55.000000000 +0000 | ||
45 | @@ -113,6 +113,9 @@ | ||
46 | void html_document_update_focus_element (HtmlDocument *document, DomElement *element); | ||
47 | DomNode *html_document_find_anchor (HtmlDocument *doc, const gchar *anchor); | ||
48 | |||
49 | +CssStylesheet *html_document_add_stylesheet (HtmlDocument *document, const gchar *buffer, gint len); | ||
50 | +gboolean html_document_remove_stylesheet (HtmlDocument *document, CssStylesheet *stylesheet); | ||
51 | + | ||
52 | G_END_DECLS | ||
53 | |||
54 | #endif /* __HTMLDOCUMENT_H__ */ | ||
diff --git a/openembedded/packages/gtkhtml2/files/fix-background-min-max.patch b/openembedded/packages/gtkhtml2/files/fix-background-min-max.patch new file mode 100644 index 0000000000..af557c8fa4 --- /dev/null +++ b/openembedded/packages/gtkhtml2/files/fix-background-min-max.patch | |||
@@ -0,0 +1,66 @@ | |||
1 | Index: gtkhtml2/libgtkhtml/layout/html/htmlboximage.c | ||
2 | =================================================================== | ||
3 | --- gtkhtml2.orig/libgtkhtml/layout/html/htmlboximage.c 2005-12-28 22:07:37.000000000 +0000 | ||
4 | +++ gtkhtml2/libgtkhtml/layout/html/htmlboximage.c 2006-01-22 03:20:36.000000000 +0000 | ||
5 | @@ -167,6 +167,8 @@ | ||
6 | width = (gint)(floor ((gfloat)(height * gdk_pixbuf_get_width (pixbuf))/(gfloat)gdk_pixbuf_get_height (pixbuf)) + 0.5); | ||
7 | } | ||
8 | } | ||
9 | + | ||
10 | + html_box_check_min_max_width_height (box, &width, &height); | ||
11 | |||
12 | if (old_width != width || old_height != height) | ||
13 | html_box_image_update_scaled_pixbuf (image, width, height); | ||
14 | Index: gtkhtml2/libgtkhtml/layout/htmlbox.c | ||
15 | =================================================================== | ||
16 | --- gtkhtml2.orig/libgtkhtml/layout/htmlbox.c 2004-01-08 08:57:29.000000000 +0000 | ||
17 | +++ gtkhtml2/libgtkhtml/layout/htmlbox.c 2006-01-22 03:20:41.000000000 +0000 | ||
18 | @@ -24,6 +24,7 @@ | ||
19 | #include "layout/htmlbox.h" | ||
20 | #include "layout/htmlboxtext.h" | ||
21 | #include "layout/html/htmlboxform.h" | ||
22 | +#include "layout/html/htmlboximage.h" | ||
23 | #include "layout/htmlboxinline.h" | ||
24 | #include "layout/htmlboxtablerow.h" | ||
25 | #include "gtkhtmlcontext.h" | ||
26 | @@ -817,6 +818,8 @@ | ||
27 | html_box_check_min_max_width_height (HtmlBox *self, gint *boxwidth, gint *boxheight) | ||
28 | { | ||
29 | int tmp; | ||
30 | + gint old_width = *boxwidth; | ||
31 | + gint old_height = *boxheight; | ||
32 | |||
33 | if (self->parent) { | ||
34 | if (HTML_BOX_GET_STYLE (self)->box->min_width.type != HTML_LENGTH_AUTO) { | ||
35 | @@ -868,6 +871,31 @@ | ||
36 | if (*boxheight > html_length_get_value (&HTML_BOX_GET_STYLE (self)->box->max_height, 0)) | ||
37 | *boxheight = html_length_get_value (&HTML_BOX_GET_STYLE (self)->box->max_height, 0); | ||
38 | } | ||
39 | + | ||
40 | + /* Maintain aspect ratio if it's an image - bias towards making image smaller */ | ||
41 | + if (HTML_IS_BOX_IMAGE (self)) { | ||
42 | + if ((*boxwidth > old_width) && (*boxheight >= old_height)) { | ||
43 | + *boxheight = *boxheight * (gdouble)(*boxwidth / (gdouble)old_width); | ||
44 | + html_box_check_min_max_width_height (self, boxwidth, boxheight); | ||
45 | + return; | ||
46 | + } | ||
47 | + | ||
48 | + if ((*boxheight > old_height) && (*boxwidth >= old_width)) { | ||
49 | + *boxwidth = *boxwidth * (gdouble)(*boxheight / (gdouble)old_height); | ||
50 | + html_box_check_min_max_width_height (self, boxwidth, boxheight); | ||
51 | + return; | ||
52 | + } | ||
53 | + | ||
54 | + if ((*boxwidth < old_width) && (*boxheight <= old_height)) { | ||
55 | + *boxheight = *boxheight * (gdouble)(*boxwidth / (gdouble)old_width); | ||
56 | + return; | ||
57 | + } | ||
58 | + | ||
59 | + if ((*boxheight < old_height) && (*boxwidth <= old_width)) { | ||
60 | + *boxwidth = *boxwidth * (gdouble)(*boxheight / (gdouble)old_height); | ||
61 | + return; | ||
62 | + } | ||
63 | + } | ||
64 | } | ||
65 | |||
66 | static void | ||
diff --git a/openembedded/packages/gtkhtml2/files/fix-background-none.patch b/openembedded/packages/gtkhtml2/files/fix-background-none.patch new file mode 100644 index 0000000000..076f312009 --- /dev/null +++ b/openembedded/packages/gtkhtml2/files/fix-background-none.patch | |||
@@ -0,0 +1,40 @@ | |||
1 | Index: gtkhtml2/libgtkhtml/css/cssmatcher.c | ||
2 | =================================================================== | ||
3 | --- gtkhtml2.orig/libgtkhtml/css/cssmatcher.c 2006-01-21 01:02:23.000000000 +0000 | ||
4 | +++ gtkhtml2/libgtkhtml/css/cssmatcher.c 2006-01-25 02:07:44.000000000 +0000 | ||
5 | @@ -596,7 +596,13 @@ | ||
6 | g_object_unref (G_OBJECT(image)); | ||
7 | return TRUE; | ||
8 | } | ||
9 | - } | ||
10 | + } else if (val->value_type == CSS_IDENT && | ||
11 | + val->v.atom == HTML_ATOM_NONE) { | ||
12 | + if (style->background->image) { | ||
13 | + g_object_unref (style->background->image); | ||
14 | + style->background->image = NULL; | ||
15 | + } | ||
16 | + } | ||
17 | return FALSE; | ||
18 | } | ||
19 | |||
20 | @@ -1256,7 +1262,10 @@ | ||
21 | } | ||
22 | else if (val->value_type == CSS_FUNCTION) | ||
23 | handle_background_image (document, style, val); | ||
24 | - else if (css_parse_color (val, &color)) | ||
25 | + else if (val->value_type == CSS_IDENT && val->v.atom == HTML_ATOM_NONE) { | ||
26 | + handle_background_image (document, style, val); | ||
27 | + style->background->color.transparent = TRUE; | ||
28 | + } else if (css_parse_color (val, &color)) | ||
29 | html_style_set_background_color (style, &color); | ||
30 | |||
31 | break; | ||
32 | @@ -1273,6 +1282,8 @@ | ||
33 | |||
34 | if (val->v.atom == HTML_ATOM_INHERIT) | ||
35 | html_style_set_background_color (style, &parent_style->background->color); | ||
36 | + else if (val->v.atom == HTML_ATOM_NONE) | ||
37 | + style->background->color.transparent = TRUE; | ||
38 | else if (css_parse_color (val, &color)) | ||
39 | html_style_set_background_color (style, &color); | ||
40 | break; | ||
diff --git a/openembedded/packages/gtkhtml2/files/fix-recreation.patch b/openembedded/packages/gtkhtml2/files/fix-recreation.patch new file mode 100644 index 0000000000..3bc636bae9 --- /dev/null +++ b/openembedded/packages/gtkhtml2/files/fix-recreation.patch | |||
@@ -0,0 +1,407 @@ | |||
1 | Index: gtkhtml2/libgtkhtml/document/htmldocument.c | ||
2 | =================================================================== | ||
3 | --- gtkhtml2.orig/libgtkhtml/document/htmldocument.c 2006-01-25 19:19:23.000000000 +0000 | ||
4 | +++ gtkhtml2/libgtkhtml/document/htmldocument.c 2006-01-25 19:21:10.000000000 +0000 | ||
5 | @@ -110,11 +110,6 @@ | ||
6 | |||
7 | if (style_change != HTML_STYLE_CHANGE_NONE) { | ||
8 | |||
9 | - /* FIXME: Workaround bug #199, we don't support recreation | ||
10 | - * of dom nodes and layout boxes / jonas | ||
11 | - */ | ||
12 | - new_style->display = node->style->display; | ||
13 | - | ||
14 | html_style_ref (new_style); | ||
15 | html_style_unref (node->style); | ||
16 | node->style = new_style; | ||
17 | Index: gtkhtml2/libgtkhtml/layout/htmlboxfactory.c | ||
18 | =================================================================== | ||
19 | --- gtkhtml2.orig/libgtkhtml/layout/htmlboxfactory.c 2006-01-25 19:19:23.000000000 +0000 | ||
20 | +++ gtkhtml2/libgtkhtml/layout/htmlboxfactory.c 2006-01-25 19:21:10.000000000 +0000 | ||
21 | @@ -99,7 +99,7 @@ | ||
22 | |||
23 | |||
24 | HtmlBox * | ||
25 | -html_box_factory_new_box (HtmlView *view, DomNode *node) | ||
26 | +html_box_factory_new_box (HtmlView *view, DomNode *node, gboolean force_new) | ||
27 | { | ||
28 | HtmlBox *box = NULL, *parent_box; | ||
29 | HtmlStyle *style = node->style, *parent_style = NULL; | ||
30 | @@ -117,7 +117,7 @@ | ||
31 | |||
32 | box = parent_box->children; | ||
33 | |||
34 | - while (box) { | ||
35 | + while (box && !force_new) { | ||
36 | if (HTML_IS_BOX_TEXT (box) && box->dom_node == node) { | ||
37 | |||
38 | html_box_text_set_text (HTML_BOX_TEXT (box), node->xmlnode->content); | ||
39 | Index: gtkhtml2/libgtkhtml/layout/htmlboxfactory.h | ||
40 | =================================================================== | ||
41 | --- gtkhtml2.orig/libgtkhtml/layout/htmlboxfactory.h 2006-01-25 19:19:23.000000000 +0000 | ||
42 | +++ gtkhtml2/libgtkhtml/layout/htmlboxfactory.h 2006-01-25 19:21:10.000000000 +0000 | ||
43 | @@ -33,7 +33,7 @@ | ||
44 | |||
45 | HtmlBox * html_box_factory_get_box (HtmlView *view, DomNode *node, HtmlBox *parent_box); | ||
46 | HtmlStyleChange html_box_factory_restyle_box (HtmlView *view, HtmlBox *box, HtmlAtom pseudo); | ||
47 | -HtmlBox * html_box_factory_new_box (HtmlView *view, DomNode *node); | ||
48 | +HtmlBox * html_box_factory_new_box (HtmlView *view, DomNode *node, gboolean force_new); | ||
49 | |||
50 | G_END_DECLS | ||
51 | |||
52 | Index: gtkhtml2/libgtkhtml/layout/htmlstyle.c | ||
53 | =================================================================== | ||
54 | --- gtkhtml2.orig/libgtkhtml/layout/htmlstyle.c 2006-01-25 19:19:23.000000000 +0000 | ||
55 | +++ gtkhtml2/libgtkhtml/layout/htmlstyle.c 2006-01-25 19:21:10.000000000 +0000 | ||
56 | @@ -416,7 +416,7 @@ | ||
57 | html_style_compare (const HtmlStyle *s1, const HtmlStyle *s2) | ||
58 | { | ||
59 | /* RECREATE begin */ | ||
60 | - if (s1->display != s1->display) | ||
61 | + if (s1->display != s2->display) | ||
62 | return HTML_STYLE_CHANGE_RECREATE; | ||
63 | /* RECREATE end */ | ||
64 | |||
65 | Index: gtkhtml2/libgtkhtml/view/htmlview.c | ||
66 | =================================================================== | ||
67 | --- gtkhtml2.orig/libgtkhtml/view/htmlview.c 2006-01-25 19:19:23.000000000 +0000 | ||
68 | +++ gtkhtml2/libgtkhtml/view/htmlview.c 2006-01-25 19:21:10.000000000 +0000 | ||
69 | @@ -1908,7 +1908,7 @@ | ||
70 | |||
71 | g_assert (node->style != NULL); | ||
72 | |||
73 | - new_box = html_box_factory_new_box (view, node); | ||
74 | + new_box = html_box_factory_new_box (view, node, FALSE); | ||
75 | |||
76 | if (new_box) { | ||
77 | |||
78 | @@ -2001,8 +2001,9 @@ | ||
79 | html_view_remove_layout_box (view, box->dom_node); | ||
80 | |||
81 | /* Check if we're trying to remove the root box */ | ||
82 | - if (box == view->root) | ||
83 | + if (box == view->root) { | ||
84 | view->root = NULL; | ||
85 | + } | ||
86 | |||
87 | html_box_remove (box); | ||
88 | g_object_unref (G_OBJECT (box)); | ||
89 | @@ -2131,6 +2132,56 @@ | ||
90 | } | ||
91 | |||
92 | switch (style_change) { | ||
93 | + case HTML_STYLE_CHANGE_RECREATE: { | ||
94 | + HtmlBox *new_box = NULL; | ||
95 | + | ||
96 | + /* Don't replace boxes where display: none has been set */ | ||
97 | + if (style->display == HTML_DISPLAY_NONE) { | ||
98 | + html_view_removed (document, node, view); | ||
99 | + break; | ||
100 | + } | ||
101 | + | ||
102 | + new_box = html_box_factory_new_box (view, node, TRUE); | ||
103 | + g_assert (new_box); | ||
104 | + | ||
105 | + new_box->dom_node = node; | ||
106 | + g_object_add_weak_pointer (G_OBJECT (node), (gpointer *)&(new_box->dom_node)); | ||
107 | + new_box->next = box->next; | ||
108 | + new_box->prev = box->prev; | ||
109 | + new_box->parent = box->parent; | ||
110 | + new_box->children = box->children; | ||
111 | + | ||
112 | + if (box->next) box->next->prev = new_box; | ||
113 | + if (box->prev) box->prev->next = new_box; | ||
114 | + if (box->parent) | ||
115 | + if (box->parent->children == box) | ||
116 | + box->parent->children = new_box; | ||
117 | + if (box->children) { | ||
118 | + HtmlBox *child = box->children; | ||
119 | + while (child) { | ||
120 | + if (child->parent == box) | ||
121 | + child->parent = new_box; | ||
122 | + child = child->prev; | ||
123 | + } | ||
124 | + child = box->children->next; | ||
125 | + while (child) { | ||
126 | + if (child->parent == box) | ||
127 | + child->parent = new_box; | ||
128 | + child = child->next; | ||
129 | + } | ||
130 | + } | ||
131 | + | ||
132 | + if (view->root == box) | ||
133 | + view->root = new_box; | ||
134 | + | ||
135 | + html_view_remove_layout_box (view, node); | ||
136 | + g_object_unref (box); | ||
137 | + | ||
138 | + html_box_handle_html_properties (new_box, node->xmlnode); | ||
139 | + html_view_add_layout_box (view, node, new_box); | ||
140 | + html_view_relayout_callback (document, node, view); | ||
141 | + break; | ||
142 | + } | ||
143 | case HTML_STYLE_CHANGE_REPAINT: | ||
144 | html_view_repaint_callback (document, node, view); | ||
145 | break; | ||
146 | Index: gtkhtml2/libgtkhtml/css/cssmatcher.c | ||
147 | =================================================================== | ||
148 | --- gtkhtml2.orig/libgtkhtml/css/cssmatcher.c 2006-01-25 19:19:23.000000000 +0000 | ||
149 | +++ gtkhtml2/libgtkhtml/css/cssmatcher.c 2006-01-25 19:21:10.000000000 +0000 | ||
150 | @@ -2781,7 +2781,7 @@ | ||
151 | } | ||
152 | } | ||
153 | if (strcasecmp ("table", n->name) == 0) { | ||
154 | - if ((str = xmlGetProp (n, "align"))) { | ||
155 | + if ((style->display != HTML_DISPLAY_BLOCK) && (str = xmlGetProp (n, "align"))) { | ||
156 | if (strcasecmp (str, "left") == 0) | ||
157 | style->Float = HTML_FLOAT_LEFT; | ||
158 | else if (strcasecmp (str, "right") == 0) | ||
159 | Index: gtkhtml2/libgtkhtml/layout/htmlbox.c | ||
160 | =================================================================== | ||
161 | --- gtkhtml2.orig/libgtkhtml/layout/htmlbox.c 2006-01-25 19:21:09.000000000 +0000 | ||
162 | +++ gtkhtml2/libgtkhtml/layout/htmlbox.c 2006-01-25 19:21:10.000000000 +0000 | ||
163 | @@ -308,7 +308,7 @@ | ||
164 | else if (style->surround->margin.left.type != HTML_LENGTH_AUTO && | ||
165 | style->surround->margin.right.type != HTML_LENGTH_AUTO) { | ||
166 | |||
167 | - if (HTML_BOX_GET_STYLE (box->parent)->inherited->direction == HTML_DIRECTION_RTL) { | ||
168 | + if (HTML_BOX_GET_STYLE (html_box_get_containing_block (box))->inherited->direction == HTML_DIRECTION_RTL) { | ||
169 | |||
170 | return width - html_length_get_value (&style->box->width, width) - | ||
171 | html_box_left_padding (box, width) - html_box_right_padding (box, width) - | ||
172 | @@ -348,7 +348,7 @@ | ||
173 | else if (style->surround->margin.left.type != HTML_LENGTH_AUTO && | ||
174 | style->surround->margin.right.type != HTML_LENGTH_AUTO) { | ||
175 | |||
176 | - if (HTML_BOX_GET_STYLE (box->parent)->inherited->direction == HTML_DIRECTION_LTR) { | ||
177 | + if (HTML_BOX_GET_STYLE (html_box_get_containing_block (box))->inherited->direction == HTML_DIRECTION_LTR) { | ||
178 | |||
179 | return width - html_length_get_value (&style->box->width, width) - | ||
180 | html_box_left_padding (box, width) - html_box_right_padding (box, width) - | ||
181 | @@ -820,35 +820,36 @@ | ||
182 | int tmp; | ||
183 | gint old_width = *boxwidth; | ||
184 | gint old_height = *boxheight; | ||
185 | + HtmlBox *parent = html_box_get_containing_block (self); | ||
186 | |||
187 | - if (self->parent) { | ||
188 | + if (parent) { | ||
189 | if (HTML_BOX_GET_STYLE (self)->box->min_width.type != HTML_LENGTH_AUTO) { | ||
190 | - tmp = html_length_get_value (&HTML_BOX_GET_STYLE (self)->box->min_width, self->parent->width - | ||
191 | - html_box_horizontal_mbp_sum (self->parent) - html_box_horizontal_mbp_sum (self)); | ||
192 | + tmp = html_length_get_value (&HTML_BOX_GET_STYLE (self)->box->min_width, parent->width - | ||
193 | + html_box_horizontal_mbp_sum (parent) - html_box_horizontal_mbp_sum (self)); | ||
194 | if (*boxwidth < tmp) | ||
195 | *boxwidth = tmp; | ||
196 | |||
197 | } | ||
198 | |||
199 | if (HTML_BOX_GET_STYLE (self)->box->max_width.type != HTML_LENGTH_AUTO) { | ||
200 | - tmp = html_length_get_value (&HTML_BOX_GET_STYLE (self)->box->max_width, self->parent->width - | ||
201 | - html_box_horizontal_mbp_sum (self->parent) - html_box_horizontal_mbp_sum (self)); | ||
202 | + tmp = html_length_get_value (&HTML_BOX_GET_STYLE (self)->box->max_width, parent->width - | ||
203 | + html_box_horizontal_mbp_sum (parent) - html_box_horizontal_mbp_sum (self)); | ||
204 | if (*boxwidth > tmp) | ||
205 | *boxwidth = tmp; | ||
206 | |||
207 | } | ||
208 | |||
209 | if (HTML_BOX_GET_STYLE (self)->box->min_height.type != HTML_LENGTH_AUTO) { | ||
210 | - tmp = html_length_get_value (&HTML_BOX_GET_STYLE (self)->box->min_height, self->parent->height - | ||
211 | - html_box_horizontal_mbp_sum (self->parent) - html_box_horizontal_mbp_sum (self)); | ||
212 | + tmp = html_length_get_value (&HTML_BOX_GET_STYLE (self)->box->min_height, parent->height - | ||
213 | + html_box_horizontal_mbp_sum (parent) - html_box_horizontal_mbp_sum (self)); | ||
214 | if (*boxheight < tmp) | ||
215 | *boxheight = tmp; | ||
216 | |||
217 | } | ||
218 | |||
219 | if (HTML_BOX_GET_STYLE (self)->box->max_height.type != HTML_LENGTH_AUTO) { | ||
220 | - tmp = html_length_get_value (&HTML_BOX_GET_STYLE (self)->box->max_height, self->parent->height - | ||
221 | - html_box_horizontal_mbp_sum (self->parent) - html_box_horizontal_mbp_sum (self)); | ||
222 | + tmp = html_length_get_value (&HTML_BOX_GET_STYLE (self)->box->max_height, parent->height - | ||
223 | + html_box_horizontal_mbp_sum (parent) - html_box_horizontal_mbp_sum (self)); | ||
224 | if (*boxheight > tmp) | ||
225 | *boxheight = tmp; | ||
226 | |||
227 | Index: gtkhtml2/libgtkhtml/layout/htmlboxblock.c | ||
228 | =================================================================== | ||
229 | --- gtkhtml2.orig/libgtkhtml/layout/htmlboxblock.c 2006-01-25 19:19:23.000000000 +0000 | ||
230 | +++ gtkhtml2/libgtkhtml/layout/htmlboxblock.c 2006-01-25 19:21:10.000000000 +0000 | ||
231 | @@ -358,8 +358,7 @@ | ||
232 | |||
233 | /* Get the prefered width */ | ||
234 | /* If the width wasn't specified by CSS, use the width of the containing box (parent) */ | ||
235 | - | ||
236 | - if (self->parent) { | ||
237 | + if (html_box_get_containing_block (self)) { | ||
238 | |||
239 | if (style->Float != HTML_FLOAT_NONE) | ||
240 | new_width = html_length_get_value (&style->box->width, html_box_get_containing_block_width (self)); | ||
241 | Index: gtkhtml2/libgtkhtml/graphics/htmlimagefactory.c | ||
242 | =================================================================== | ||
243 | --- gtkhtml2.orig/libgtkhtml/graphics/htmlimagefactory.c 2006-01-25 19:19:23.000000000 +0000 | ||
244 | +++ gtkhtml2/libgtkhtml/graphics/htmlimagefactory.c 2006-01-25 19:21:10.000000000 +0000 | ||
245 | @@ -127,7 +127,7 @@ | ||
246 | } | ||
247 | |||
248 | static void | ||
249 | -html_image_shutdown (HtmlImage *image, HtmlImageFactory *image_factory) | ||
250 | +html_image_shutdown (HtmlImageFactory *image_factory, HtmlImage *image) | ||
251 | { | ||
252 | g_hash_table_remove (image_factory->image_hash, image->uri); | ||
253 | } | ||
254 | @@ -146,8 +146,7 @@ | ||
255 | |||
256 | image = HTML_IMAGE (g_object_new (HTML_IMAGE_TYPE, NULL)); | ||
257 | |||
258 | - g_signal_connect (G_OBJECT (image), "last_unref", | ||
259 | - G_CALLBACK (html_image_shutdown), image_factory); | ||
260 | + g_object_weak_ref (G_OBJECT (image), (GWeakNotify)html_image_shutdown, image_factory); | ||
261 | |||
262 | image->loading = TRUE; | ||
263 | |||
264 | Index: gtkhtml2/libgtkhtml/layout/html/htmlboxembeddedimage.c | ||
265 | =================================================================== | ||
266 | --- gtkhtml2.orig/libgtkhtml/layout/html/htmlboxembeddedimage.c 2006-01-25 19:19:23.000000000 +0000 | ||
267 | +++ gtkhtml2/libgtkhtml/layout/html/htmlboxembeddedimage.c 2006-01-25 19:21:10.000000000 +0000 | ||
268 | @@ -64,25 +64,36 @@ | ||
269 | } | ||
270 | |||
271 | static void | ||
272 | -html_box_embedded_image_class_init (HtmlBoxClass *klass) | ||
273 | +html_box_embedded_image_resize_image (HtmlImage *image, HtmlBoxEmbeddedImage *box) | ||
274 | { | ||
275 | - | ||
276 | - klass->paint = html_box_embedded_image_paint; | ||
277 | - klass->relayout = html_box_embedded_image_relayout; | ||
278 | + g_signal_emit_by_name (G_OBJECT (box->view->document), "relayout_node", HTML_BOX (box)->dom_node); | ||
279 | +} | ||
280 | |||
281 | - parent_class = g_type_class_peek_parent (klass); | ||
282 | +static void | ||
283 | +html_box_embedded_image_repaint_image (HtmlImage *image, gint x, gint y, gint width, gint height, HtmlBoxEmbeddedImage *box) | ||
284 | +{ | ||
285 | + g_signal_emit_by_name (G_OBJECT (box->view->document), "repaint_node", HTML_BOX (box)->dom_node); | ||
286 | } | ||
287 | |||
288 | static void | ||
289 | -html_box_embedded_image_resize_image (HtmlImage *image, HtmlBoxEmbeddedImage *box) | ||
290 | +html_box_embedded_image_finalize (GObject *object) | ||
291 | { | ||
292 | - g_signal_emit_by_name (G_OBJECT (box->view->document), "relayout_node", HTML_BOX (box)->dom_node); | ||
293 | + HtmlBoxEmbeddedImage *image = HTML_BOX_EMBEDDED_IMAGE (object); | ||
294 | + | ||
295 | + g_signal_handlers_disconnect_by_func (G_OBJECT (image->image), G_CALLBACK (html_box_embedded_image_resize_image), image); | ||
296 | + g_signal_handlers_disconnect_by_func (G_OBJECT (image->image), G_CALLBACK (html_box_embedded_image_repaint_image), image); | ||
297 | } | ||
298 | |||
299 | static void | ||
300 | -html_box_embedded_image_repaint_image (HtmlImage *image, gint x, gint y, gint width, gint height, HtmlBoxEmbeddedImage *box) | ||
301 | +html_box_embedded_image_class_init (HtmlBoxClass *klass) | ||
302 | { | ||
303 | - g_signal_emit_by_name (G_OBJECT (box->view->document), "repaint_node", HTML_BOX (box)->dom_node); | ||
304 | + GObjectClass *object_class = (GObjectClass *)klass; | ||
305 | + | ||
306 | + klass->paint = html_box_embedded_image_paint; | ||
307 | + klass->relayout = html_box_embedded_image_relayout; | ||
308 | + object_class->finalize = html_box_embedded_image_finalize; | ||
309 | + | ||
310 | + parent_class = g_type_class_peek_parent (klass); | ||
311 | } | ||
312 | |||
313 | void | ||
314 | Index: gtkhtml2/libgtkhtml/layout/htmlboxtext.c | ||
315 | =================================================================== | ||
316 | --- gtkhtml2.orig/libgtkhtml/layout/htmlboxtext.c 2006-01-25 19:19:23.000000000 +0000 | ||
317 | +++ gtkhtml2/libgtkhtml/layout/htmlboxtext.c 2006-01-25 19:21:10.000000000 +0000 | ||
318 | @@ -146,6 +146,7 @@ | ||
319 | |||
320 | master = text->master; | ||
321 | if (master) { | ||
322 | + html_box_text_destroy_slaves (text); | ||
323 | html_box_text_free_master (master); | ||
324 | g_free (master); | ||
325 | text->master = NULL; | ||
326 | Index: gtkhtml2/libgtkhtml/layout/html/htmlboximage.c | ||
327 | =================================================================== | ||
328 | --- gtkhtml2.orig/libgtkhtml/layout/html/htmlboximage.c 2006-01-25 19:21:09.000000000 +0000 | ||
329 | +++ gtkhtml2/libgtkhtml/layout/html/htmlboximage.c 2006-01-25 19:21:33.000000000 +0000 | ||
330 | @@ -195,10 +195,41 @@ | ||
331 | } | ||
332 | |||
333 | static void | ||
334 | +html_box_image_resize_image (HtmlImage *image, HtmlBoxImage *box) | ||
335 | +{ | ||
336 | + g_signal_emit_by_name (G_OBJECT (box->view->document), "relayout_node", HTML_BOX (box)->dom_node); | ||
337 | +} | ||
338 | + | ||
339 | +static void | ||
340 | +html_box_image_repaint_image (HtmlImage *image, gint x, gint y, gint width, gint height, HtmlBoxImage *box) | ||
341 | +{ | ||
342 | + gdouble real_x, real_y; | ||
343 | + gdouble real_width, real_height; | ||
344 | + | ||
345 | + if (box->scaled_pixbuf && image->pixbuf) { | ||
346 | + | ||
347 | + html_box_image_update_scaled_pixbuf (box, gdk_pixbuf_get_width (box->scaled_pixbuf), gdk_pixbuf_get_height (box->scaled_pixbuf)); | ||
348 | + real_y = (y * gdk_pixbuf_get_height (box->scaled_pixbuf)) / (gdouble)gdk_pixbuf_get_height (image->pixbuf); | ||
349 | + real_x = (x * gdk_pixbuf_get_width (box->scaled_pixbuf)) / (gdouble)gdk_pixbuf_get_width (image->pixbuf); | ||
350 | + | ||
351 | + real_height = (height * gdk_pixbuf_get_height (box->scaled_pixbuf)) / (gdouble)gdk_pixbuf_get_height (image->pixbuf); | ||
352 | + real_width = (width * gdk_pixbuf_get_width (box->scaled_pixbuf)) / (gdouble)gdk_pixbuf_get_width (image->pixbuf); | ||
353 | + | ||
354 | + gtk_widget_queue_draw_area (GTK_WIDGET (box->view), | ||
355 | + html_box_get_absolute_x (HTML_BOX (box)), /* + floor (real_x + 0.5),*/ | ||
356 | + html_box_get_absolute_y (HTML_BOX (box)),/* + floor (real_y + 0.5),*/ | ||
357 | + floor (real_width + real_x + 0.5), | ||
358 | + floor (real_height + real_y + 0.5)); | ||
359 | + } | ||
360 | +} | ||
361 | + | ||
362 | +static void | ||
363 | html_box_image_finalize (GObject *object) | ||
364 | { | ||
365 | HtmlBoxImage *image = HTML_BOX_IMAGE (object); | ||
366 | |||
367 | + g_signal_handlers_disconnect_by_func (G_OBJECT (image->image), G_CALLBACK (html_box_image_resize_image), image); | ||
368 | + g_signal_handlers_disconnect_by_func (G_OBJECT (image->image), G_CALLBACK (html_box_image_repaint_image), image); | ||
369 | if (image->scaled_pixbuf) | ||
370 | g_object_unref (image->scaled_pixbuf); | ||
371 | |||
372 | @@ -262,35 +293,6 @@ | ||
373 | return HTML_BOX (box); | ||
374 | } | ||
375 | |||
376 | -static void | ||
377 | -html_box_image_resize_image (HtmlImage *image, HtmlBoxImage *box) | ||
378 | -{ | ||
379 | - g_signal_emit_by_name (G_OBJECT (box->view->document), "relayout_node", HTML_BOX (box)->dom_node); | ||
380 | -} | ||
381 | - | ||
382 | -static void | ||
383 | -html_box_image_repaint_image (HtmlImage *image, gint x, gint y, gint width, gint height, HtmlBoxImage *box) | ||
384 | -{ | ||
385 | - gdouble real_x, real_y; | ||
386 | - gdouble real_width, real_height; | ||
387 | - | ||
388 | - if (box->scaled_pixbuf && image->pixbuf) { | ||
389 | - | ||
390 | - html_box_image_update_scaled_pixbuf (box, gdk_pixbuf_get_width (box->scaled_pixbuf), gdk_pixbuf_get_height (box->scaled_pixbuf)); | ||
391 | - real_y = (y * gdk_pixbuf_get_height (box->scaled_pixbuf)) / (gdouble)gdk_pixbuf_get_height (image->pixbuf); | ||
392 | - real_x = (x * gdk_pixbuf_get_width (box->scaled_pixbuf)) / (gdouble)gdk_pixbuf_get_width (image->pixbuf); | ||
393 | - | ||
394 | - real_height = (height * gdk_pixbuf_get_height (box->scaled_pixbuf)) / (gdouble)gdk_pixbuf_get_height (image->pixbuf); | ||
395 | - real_width = (width * gdk_pixbuf_get_width (box->scaled_pixbuf)) / (gdouble)gdk_pixbuf_get_width (image->pixbuf); | ||
396 | - | ||
397 | - gtk_widget_queue_draw_area (GTK_WIDGET (box->view), | ||
398 | - html_box_get_absolute_x (HTML_BOX (box)), /* + floor (real_x + 0.5),*/ | ||
399 | - html_box_get_absolute_y (HTML_BOX (box)),/* + floor (real_y + 0.5),*/ | ||
400 | - floor (real_width + real_x + 0.5), | ||
401 | - floor (real_height + real_y + 0.5)); | ||
402 | - } | ||
403 | -} | ||
404 | - | ||
405 | void | ||
406 | html_box_image_set_image (HtmlBoxImage *box, HtmlImage *image) | ||
407 | { | ||
diff --git a/openembedded/packages/gtkhtml2/gtkhtml2_cvs.bb b/openembedded/packages/gtkhtml2/gtkhtml2_cvs.bb index 7755cffa26..cdb4206157 100755 --- a/openembedded/packages/gtkhtml2/gtkhtml2_cvs.bb +++ b/openembedded/packages/gtkhtml2/gtkhtml2_cvs.bb | |||
@@ -3,9 +3,15 @@ DEPENDS = "gtk+ glib-2.0 libxml2" | |||
3 | DESCRIPTION = "A GTK+ HTML rendering library." | 3 | DESCRIPTION = "A GTK+ HTML rendering library." |
4 | LICENSE = "GPL" | 4 | LICENSE = "GPL" |
5 | MAINTAINER = "Chris Lord <chris@openedhand.com>" | 5 | MAINTAINER = "Chris Lord <chris@openedhand.com>" |
6 | PV = "0.0cvs${CVSDATE}" | 6 | PV = "2.11.0cvs${CVSDATE}" |
7 | 7 | ||
8 | SRC_URI = "cvs://anonymous@anoncvs.gnome.org/cvs/gnome;module=gtkhtml2" | 8 | SRC_URI = "cvs://anonymous@anoncvs.gnome.org/cvs/gnome;module=gtkhtml2 \ |
9 | file://at-import_box-pos.patch;patch=1;pnum=0 \ | ||
10 | file://fix-background-none.patch;patch=1;pnum=1 \ | ||
11 | file://css-stylesheet-user.patch;patch=1;pnum=1 \ | ||
12 | file://css-media.patch;patch=1;pnum=1 \ | ||
13 | file://fix-background-min-max.patch;patch=1;pnum=1 \ | ||
14 | file://fix-recreation.patch;patch=1;pnum=1" | ||
9 | 15 | ||
10 | S = "${WORKDIR}/${PN}" | 16 | S = "${WORKDIR}/${PN}" |
11 | 17 | ||