summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2008-03-09 23:41:08 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2008-03-09 23:41:08 +0000
commit2c7ce0143faab9edfada4e57812f11bb9ecb3d4c (patch)
tree4891477cf58d56b03d6289fabe1fcdfd051e65a6
parent052f8b47ff0194909372d4ffa2ab48e4d70e03c8 (diff)
downloadnetsurf-2c7ce0143faab9edfada4e57812f11bb9ecb3d4c.tar.gz
netsurf-2c7ce0143faab9edfada4e57812f11bb9ecb3d4c.tar.bz2
Adjust y values after seting a min/max-height.
svn path=/trunk/netsurf/; revision=3910
-rw-r--r--render/layout.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/render/layout.c b/render/layout.c
index 7d61e9233..1af12261e 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -61,7 +61,7 @@
static void layout_minmax_block(struct box *block);
static bool layout_block_object(struct box *block);
static void layout_block_find_dimensions(int available_width, struct box *box);
-static void layout_apply_minmax_height(struct box *box);
+static bool layout_apply_minmax_height(struct box *box);
static void layout_block_add_scrollbar(struct box *box, int which);
static int layout_solve_width(int available_width, int width,
int margin[4], int padding[4], int border[4]);
@@ -381,7 +381,17 @@ bool layout_block_context(struct box *block, struct content *content)
break;
if (box->height == AUTO) {
box->height = y - box->padding[TOP];
- layout_apply_minmax_height(box);
+
+ if (layout_apply_minmax_height(box)) {
+ /* Height altered */
+ /* Set current cy */
+ cy += box->height -
+ (y - box->padding[TOP]);
+ /* Update y for any change in
+ * height */
+ y = box->height +
+ box->padding[TOP];
+ }
if (box->type == BOX_BLOCK)
layout_block_add_scrollbar(box,
BOTTOM);
@@ -594,10 +604,12 @@ void layout_block_find_dimensions(int available_width, struct box *box)
* Manimpulate box height according to CSS min-height and max-height properties
*
* \param box block to modify with any min-height or max-height
+ * \return whether the height has been changed
*/
-void layout_apply_minmax_height(struct box *box) {
+bool layout_apply_minmax_height(struct box *box) {
int h;
+ bool updated = false;
if (box->style) {
/* max-height */
@@ -605,8 +617,10 @@ void layout_apply_minmax_height(struct box *box) {
case CSS_MAX_HEIGHT_LENGTH:
h = css_len2px(&box->style->max_height.value.
length, box->style);
- if (h < box->height)
+ if (h < box->height) {
box->height = h;
+ updated = true;
+ }
break;
case CSS_MAX_HEIGHT_PERCENT:
/* percentage heights not yet implemented */
@@ -619,8 +633,10 @@ void layout_apply_minmax_height(struct box *box) {
case CSS_MIN_HEIGHT_LENGTH:
h = css_len2px(&box->style->min_height.value.
length, box->style);
- if (h > box->height)
+ if (h > box->height) {
box->height = h;
+ updated = true;
+ }
break;
case CSS_MIN_HEIGHT_PERCENT:
/* percentage heights not yet implemented */
@@ -628,6 +644,7 @@ void layout_apply_minmax_height(struct box *box) {
break;
}
}
+ return updated;
}
/**