diff options
Diffstat (limited to 'openembedded/packages/gtkhtml2/files/fix-background-min-max.patch')
| -rw-r--r-- | openembedded/packages/gtkhtml2/files/fix-background-min-max.patch | 66 |
1 files changed, 66 insertions, 0 deletions
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 | ||
