diff options
Diffstat (limited to 'openembedded/packages/gtkhtml2/files/fix-infinite-loop.patch')
-rw-r--r-- | openembedded/packages/gtkhtml2/files/fix-infinite-loop.patch | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/openembedded/packages/gtkhtml2/files/fix-infinite-loop.patch b/openembedded/packages/gtkhtml2/files/fix-infinite-loop.patch new file mode 100644 index 0000000000..c2f36daf88 --- /dev/null +++ b/openembedded/packages/gtkhtml2/files/fix-infinite-loop.patch | |||
@@ -0,0 +1,91 @@ | |||
1 | Index: libgtkhtml/layout/htmlbox.c | ||
2 | =================================================================== | ||
3 | --- libgtkhtml/layout/htmlbox.c.orig 2006-02-08 23:43:30.000000000 +0000 | ||
4 | +++ libgtkhtml/layout/htmlbox.c 2006-02-11 04:49:55.000000000 +0000 | ||
5 | @@ -873,26 +873,21 @@ html_box_check_min_max_width_height (Htm | ||
6 | *boxheight = html_length_get_value (&HTML_BOX_GET_STYLE (self)->box->max_height, 0); | ||
7 | } | ||
8 | |||
9 | - /* Maintain aspect ratio if it's an image - bias towards making image smaller */ | ||
10 | + /* Maintain aspect ratio if it's an image */ | ||
11 | if (HTML_IS_BOX_IMAGE (self)) { | ||
12 | if ((*boxwidth > old_width) && (*boxheight >= old_height)) { | ||
13 | *boxheight = *boxheight * (gdouble)(*boxwidth / (gdouble)old_width); | ||
14 | - html_box_check_min_max_width_height (self, boxwidth, boxheight); | ||
15 | return; | ||
16 | } | ||
17 | - | ||
18 | - if ((*boxheight > old_height) && (*boxwidth >= old_width)) { | ||
19 | + else if ((*boxheight > old_height) && (*boxwidth >= old_width)) { | ||
20 | *boxwidth = *boxwidth * (gdouble)(*boxheight / (gdouble)old_height); | ||
21 | - html_box_check_min_max_width_height (self, boxwidth, boxheight); | ||
22 | return; | ||
23 | } | ||
24 | - | ||
25 | - if ((*boxwidth < old_width) && (*boxheight <= old_height)) { | ||
26 | + else if ((*boxwidth < old_width) && (*boxheight <= old_height)) { | ||
27 | *boxheight = *boxheight * (gdouble)(*boxwidth / (gdouble)old_width); | ||
28 | return; | ||
29 | } | ||
30 | - | ||
31 | - if ((*boxheight < old_height) && (*boxwidth <= old_width)) { | ||
32 | + else if ((*boxheight < old_height) && (*boxwidth <= old_width)) { | ||
33 | *boxwidth = *boxwidth * (gdouble)(*boxheight / (gdouble)old_height); | ||
34 | return; | ||
35 | } | ||
36 | Index: libgtkhtml/layout/html/htmlboximage.c | ||
37 | =================================================================== | ||
38 | --- libgtkhtml/layout/html/htmlboximage.c.orig 2006-02-08 23:41:33.000000000 +0000 | ||
39 | +++ libgtkhtml/layout/html/htmlboximage.c 2006-02-11 05:01:36.000000000 +0000 | ||
40 | @@ -176,8 +176,26 @@ html_box_image_relayout (HtmlBox *box, H | ||
41 | |||
42 | html_box_check_min_max_width_height (box, &width, &height); | ||
43 | |||
44 | - if (old_width != width || old_height != height) | ||
45 | + /* Guard against oscillation - When max-width/height alters the | ||
46 | + * size of an image, the aspect ratio is maintained, but this | ||
47 | + * can cause an infinite resizing loop as the size oscillates | ||
48 | + * between two sizes that alternately require and don't | ||
49 | + * require a scrollbar. | ||
50 | + */ | ||
51 | + if ((old_width != width || old_height != height) && (width != image->last_width[1] || height != image->last_height[1])) { | ||
52 | html_box_image_update_scaled_pixbuf (image, width, height); | ||
53 | + image->last_width[1] = image->last_width[0]; | ||
54 | + image->last_height[1] = image->last_height[0]; | ||
55 | + image->last_width[0] = width; | ||
56 | + image->last_height[0] = height; | ||
57 | + } else { | ||
58 | + image->last_width[1] = image->last_width[0]; | ||
59 | + image->last_height[1] = image->last_height[0]; | ||
60 | + image->last_width[0] = width; | ||
61 | + image->last_height[0] = height; | ||
62 | + width = old_width; | ||
63 | + height = old_height; | ||
64 | + } | ||
65 | } | ||
66 | else { | ||
67 | if (style->width.type != HTML_LENGTH_AUTO) | ||
68 | @@ -239,6 +257,10 @@ html_box_image_init (HtmlBoxImage *image | ||
69 | image->content_height = 20; | ||
70 | image->image = NULL; | ||
71 | image->scaled_pixbuf = NULL; | ||
72 | + image->last_width[0] = 0; | ||
73 | + image->last_height[0] = 0; | ||
74 | + image->last_width[1] = 0; | ||
75 | + image->last_height[1] = 0; | ||
76 | } | ||
77 | |||
78 | GType | ||
79 | Index: libgtkhtml/layout/html/htmlboximage.h | ||
80 | =================================================================== | ||
81 | --- libgtkhtml/layout/html/htmlboximage.h.orig 2001-08-05 12:45:30.000000000 +0100 | ||
82 | +++ libgtkhtml/layout/html/htmlboximage.h 2006-02-11 04:40:44.000000000 +0000 | ||
83 | @@ -49,6 +49,8 @@ struct _HtmlBoxImage { | ||
84 | GdkPixbuf *scaled_pixbuf; | ||
85 | gboolean updated; | ||
86 | HtmlView *view; | ||
87 | + | ||
88 | + gint last_width[2], last_height[2]; | ||
89 | }; | ||
90 | |||
91 | struct _HtmlBoxImageClass { | ||