summaryrefslogtreecommitdiff
path: root/openembedded/packages/gtkhtml2/files/fix-background-min-max.patch
diff options
context:
space:
mode:
Diffstat (limited to 'openembedded/packages/gtkhtml2/files/fix-background-min-max.patch')
-rw-r--r--openembedded/packages/gtkhtml2/files/fix-background-min-max.patch66
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 000000000..af557c8fa
--- /dev/null
+++ b/openembedded/packages/gtkhtml2/files/fix-background-min-max.patch
@@ -0,0 +1,66 @@
+Index: gtkhtml2/libgtkhtml/layout/html/htmlboximage.c
+===================================================================
+--- gtkhtml2.orig/libgtkhtml/layout/html/htmlboximage.c 2005-12-28 22:07:37.000000000 +0000
++++ gtkhtml2/libgtkhtml/layout/html/htmlboximage.c 2006-01-22 03:20:36.000000000 +0000
+@@ -167,6 +167,8 @@
+ width = (gint)(floor ((gfloat)(height * gdk_pixbuf_get_width (pixbuf))/(gfloat)gdk_pixbuf_get_height (pixbuf)) + 0.5);
+ }
+ }
++
++ html_box_check_min_max_width_height (box, &width, &height);
+
+ if (old_width != width || old_height != height)
+ html_box_image_update_scaled_pixbuf (image, width, height);
+Index: gtkhtml2/libgtkhtml/layout/htmlbox.c
+===================================================================
+--- gtkhtml2.orig/libgtkhtml/layout/htmlbox.c 2004-01-08 08:57:29.000000000 +0000
++++ gtkhtml2/libgtkhtml/layout/htmlbox.c 2006-01-22 03:20:41.000000000 +0000
+@@ -24,6 +24,7 @@
+ #include "layout/htmlbox.h"
+ #include "layout/htmlboxtext.h"
+ #include "layout/html/htmlboxform.h"
++#include "layout/html/htmlboximage.h"
+ #include "layout/htmlboxinline.h"
+ #include "layout/htmlboxtablerow.h"
+ #include "gtkhtmlcontext.h"
+@@ -817,6 +818,8 @@
+ html_box_check_min_max_width_height (HtmlBox *self, gint *boxwidth, gint *boxheight)
+ {
+ int tmp;
++ gint old_width = *boxwidth;
++ gint old_height = *boxheight;
+
+ if (self->parent) {
+ if (HTML_BOX_GET_STYLE (self)->box->min_width.type != HTML_LENGTH_AUTO) {
+@@ -868,6 +871,31 @@
+ if (*boxheight > html_length_get_value (&HTML_BOX_GET_STYLE (self)->box->max_height, 0))
+ *boxheight = html_length_get_value (&HTML_BOX_GET_STYLE (self)->box->max_height, 0);
+ }
++
++ /* Maintain aspect ratio if it's an image - bias towards making image smaller */
++ if (HTML_IS_BOX_IMAGE (self)) {
++ if ((*boxwidth > old_width) && (*boxheight >= old_height)) {
++ *boxheight = *boxheight * (gdouble)(*boxwidth / (gdouble)old_width);
++ html_box_check_min_max_width_height (self, boxwidth, boxheight);
++ return;
++ }
++
++ if ((*boxheight > old_height) && (*boxwidth >= old_width)) {
++ *boxwidth = *boxwidth * (gdouble)(*boxheight / (gdouble)old_height);
++ html_box_check_min_max_width_height (self, boxwidth, boxheight);
++ return;
++ }
++
++ if ((*boxwidth < old_width) && (*boxheight <= old_height)) {
++ *boxheight = *boxheight * (gdouble)(*boxwidth / (gdouble)old_width);
++ return;
++ }
++
++ if ((*boxheight < old_height) && (*boxwidth <= old_width)) {
++ *boxwidth = *boxwidth * (gdouble)(*boxheight / (gdouble)old_height);
++ return;
++ }
++ }
+ }
+
+ static void