From 60c74c2e3c0190313e039fbb77dcd433921a3f72 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 14 Feb 2011 16:42:23 +0000 Subject: More comments for object dimension calculation. svn path=/trunk/netsurf/; revision=11678 --- render/layout.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/render/layout.c b/render/layout.c index 9f2dc88e0..8757dd8e2 100644 --- a/render/layout.c +++ b/render/layout.c @@ -833,7 +833,7 @@ bool layout_block_object(struct box *block) * \param uppate_width Whether to update the width. * \param update_height Whether to update the height. * - * See CSS 10.3 and 10.6. + * See CSS 2.1 sections 10.3 and 10.6. */ void layout_get_object_dimensions(struct box *box, int *width, int *height, @@ -843,12 +843,15 @@ void layout_get_object_dimensions(struct box *box, int *width, int *height, assert(width != NULL && height != NULL); if (*width == AUTO && *height == AUTO) { + /* No given dimensions; use intrinsic dimensions */ if (update_width) *width = content_get_width(box->object); if (update_height) *height = content_get_height(box->object); } else if (update_width && *width == AUTO) { + /* Have given height; width is calculated from the given height + * and ratio of intrinsic dimensions */ int intrinsic_width = content_get_width(box->object); int intrinsic_height = content_get_height(box->object); @@ -859,6 +862,8 @@ void layout_get_object_dimensions(struct box *box, int *width, int *height, *width = intrinsic_width; } else if (update_height && *height == AUTO) { + /* Have given width; height is calculated from the given width + * and ratio of intrinsic dimensions */ int intrinsic_width = content_get_width(box->object); int intrinsic_height = content_get_height(box->object); -- cgit v1.2.3