NetSurf
Functions | Variables
layout.c File Reference

HTML layout implementation. More...

#include <assert.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <dom/dom.h>
#include "utils/log.h"
#include "utils/talloc.h"
#include "utils/utils.h"
#include "utils/nsoption.h"
#include "utils/corestrings.h"
#include "utils/nsurl.h"
#include "netsurf/inttypes.h"
#include "netsurf/content.h"
#include "netsurf/browser_window.h"
#include "netsurf/layout.h"
#include "content/content.h"
#include "content/content_protected.h"
#include "css/utils.h"
#include "desktop/scrollbar.h"
#include "desktop/textarea.h"
#include "html/html.h"
#include "html/html_save.h"
#include "html/private.h"
#include "html/box.h"
#include "html/box_inspect.h"
#include "html/font.h"
#include "html/form_internal.h"
#include "html/layout.h"
#include "html/layout_internal.h"
#include "html/table.h"
Include dependency graph for layout.c:

Go to the source code of this file.

Functions

static void layout_minmax_block (struct box *block, const struct gui_layout_table *font_func, const html_content *content)
 Calculate minimum and maximum width of a block. More...
 
static void layout_get_object_dimensions (struct box *box, int *width, int *height, int min_width, int max_width, int min_height, int max_height)
 Compute the size of replaced boxes with auto dimensions, according to content. More...
 
static int layout_text_indent (const css_unit_ctx *unit_len_ctx, const css_computed_style *style, int width)
 Calculate the text-indent length. More...
 
static void layout_minmax_table (struct box *table, const struct gui_layout_table *font_func, const html_content *content)
 Calculate minimum and maximum width of a table. More...
 
static bool box_has_percentage_max_width (struct box *b)
 Helper to check if a box has percentage max width. More...
 
static struct boxlayout_minmax_line (struct box *first, int *line_min, int *line_max, bool first_line, bool *line_has_height, const struct gui_layout_table *font_func, const html_content *content)
 Calculate minimum and maximum width of a line. More...
 
static void layout_minmax_inline_container (struct box *inline_container, bool *has_height, const struct gui_layout_table *font_func, const html_content *content)
 Calculate minimum and maximum width of an inline container. More...
 
static struct boxlayout_next_margin_block (const css_unit_ctx *unit_len_ctx, struct box *box, struct box *block, int viewport_height, int *max_pos_margin, int *max_neg_margin)
 Find next block that current margin collapses to. More...
 
static int layout_clear (struct box *fl, enum css_clear_e clear)
 Find y coordinate which clears all floats on left and/or right. More...
 
static void find_sides (struct box *fl, int y0, int y1, int *x0, int *x1, struct box **left, struct box **right)
 Find left and right edges in a vertical range. More...
 
static int layout_solve_width (struct box *box, int available_width, int width, int lm, int rm, int max_width, int min_width)
 Solve the width constraint as given in CSS 2.1 section 10.3.3. More...
 
static void layout_block_find_dimensions (const css_unit_ctx *unit_len_ctx, int available_width, int viewport_height, int lm, int rm, struct box *box)
 Compute dimensions of box, margins, paddings, and borders for a block-level element. More...
 
static void layout_block_add_scrollbar (struct box *box, int which)
 Manipulate a block's [RB]padding/height/width to accommodate scrollbars. More...
 
static void layout_move_children (struct box *box, int x, int y)
 Moves the children of a box by a specified amount. More...
 
bool layout_table (struct box *table, int available_width, html_content *content)
 Layout a table. More...
 
static bool layout_apply_minmax_height (const css_unit_ctx *unit_len_ctx, struct box *box, struct box *container)
 Manimpulate box height according to CSS min-height and max-height properties. More...
 
static bool layout_block_object (struct box *block)
 Layout a block which contains an object. More...
 
static void add_float_to_container (struct box *cont, struct box *b)
 Insert a float into a container. More...
 
static bool layout_text_box_split (html_content *content, plot_font_style_t *fstyle, struct box *split_box, size_t new_length, int new_width)
 Split a text box. More...
 
static void layout_float_find_dimensions (const css_unit_ctx *unit_len_ctx, int available_width, const css_computed_style *style, struct box *box)
 Compute dimensions of box, margins, paddings, and borders for a floating element using shrink-to-fit. More...
 
static bool layout_float (struct box *b, int width, html_content *content)
 Layout the contents of a float or inline block. More...
 
static void place_float_below (struct box *c, int width, int cx, int y, struct box *cont)
 Position a float in the first available space. More...
 
static int line_height (const css_unit_ctx *unit_len_ctx, const css_computed_style *style)
 Calculate line height from a style. More...
 
static bool layout_line (struct box *first, int *width, int *y, int cx, int cy, struct box *cont, bool indent, bool has_text_children, html_content *content, struct box **next_box)
 Position a line of boxes in inline formatting context. More...
 
static bool layout_inline_container (struct box *inline_container, int width, struct box *cont, int cx, int cy, html_content *content)
 Layout lines of text or inline boxes with floats. More...
 
bool layout_block_context (struct box *block, int viewport_height, html_content *content)
 Layout a block formatting context. More...
 
static bool layout__get_element_tag (const dom_node *node, dom_html_element_type *type)
 Get a dom node's element tag type. More...
 
static bool layout__check_element_type (const dom_node *node, dom_html_element_type type)
 Check a node's tag type. More...
 
static bool layout__get_li_value (dom_node *li_node, dom_long *value_out)
 Helper to get attribute value from a LI node. More...
 
static bool layout__get_ol_start (dom_node *ol_node, dom_long *start_out)
 Helper to get start attribute value from a OL node. More...
 
static bool layout__get_ol_reversed (dom_node *ol_node)
 Helper to get reversed attribute value from a OL node. More...
 
static bool layout__get_list_item_count (dom_node *list_owner, dom_long *count_out)
 Get the number of list items for a list owner. More...
 
static void layout__ordered_list_count (struct box *box)
 Handle list item counting, if this is a list owner box. More...
 
static void layout__set_numerical_marker_text (const html_content *content, struct box *box)
 Set up the marker text for a numerical list item. More...
 
static bool layout__list_item_is_numerical (const struct box *b)
 Find out if box's style represents a numerical list style type. More...
 
static void layout_lists (const html_content *content, struct box *box)
 Layout list markers. More...
 
static void layout_compute_offsets (const css_unit_ctx *unit_len_ctx, struct box *box, struct box *containing_block, int *top, int *right, int *bottom, int *left)
 Compute box offsets for a relatively or absolutely positioned box with respect to a box. More...
 
static bool layout_absolute (struct box *box, struct box *containing_block, int cx, int cy, html_content *content)
 Layout and position an absolutely positioned box. More...
 
static bool layout_position_absolute (struct box *box, struct box *containing_block, int cx, int cy, html_content *content)
 Recursively layout and position absolutely positioned boxes. More...
 
static void layout_compute_relative_offset (const css_unit_ctx *unit_len_ctx, struct box *box, int *x, int *y)
 Compute a box's relative offset as per CSS 2.1 9.4.3. More...
 
static void layout_position_relative (const css_unit_ctx *unit_len_ctx, struct box *root, struct box *fp, int fx, int fy)
 Adjust positions of relatively positioned boxes. More...
 
static void layout_get_box_bbox (const css_unit_ctx *unit_len_ctx, struct box *box, int *desc_x0, int *desc_y0, int *desc_x1, int *desc_y1)
 Find a box's bounding box relative to itself, i.e. More...
 
static void layout_update_descendant_bbox (const css_unit_ctx *unit_len_ctx, struct box *box, struct box *child, int off_x, int off_y)
 Apply changes to box descendant_[xy][01] values due to given child. More...
 
static void layout_calculate_descendant_bboxes (const css_unit_ctx *unit_len_ctx, struct box *box)
 Recursively calculate the descendant_[xy][01] values for a laid-out box tree and inform iframe browser windows of their size and position. More...
 
bool layout_document (html_content *content, int width, int height)
 Calculate positions of boxes in a document. More...
 

Variables

const css_len_func margin_funcs [4]
 Array of per-side access functions for computed style margins. More...
 
const css_len_func padding_funcs [4]
 Array of per-side access functions for computed style paddings. More...
 
const css_len_func border_width_funcs [4]
 Array of per-side access functions for computed style border_widths. More...
 
const css_border_style_func border_style_funcs [4]
 Array of per-side access functions for computed style border styles. More...
 
const css_border_color_func border_color_funcs [4]
 Array of per-side access functions for computed style border colors. More...
 

Detailed Description

HTML layout implementation.

Layout is carried out in two stages:

  1. + calculation of minimum / maximum box widths, and
    • determination of whether block level boxes will have >zero height
  2. + layout (position and dimensions)

In most cases the functions for the two stages are a corresponding pair layout_minmax_X() and layout_X().

Definition in file layout.c.

Function Documentation

◆ add_float_to_container()

static void add_float_to_container ( struct box cont,
struct box b 
)
static

Insert a float into a container.

Parameters
contblock formatting context block, used to contain float
bbox to add to float

This sorts floats in order of descending bottom edges.

Definition at line 2305 of file layout.c.

References BOX_FLOAT_LEFT, BOX_FLOAT_RIGHT, box::float_children, box::height, box::next_float, box::prev, box::type, and box::y.

Referenced by layout_line().

Here is the caller graph for this function:

◆ box_has_percentage_max_width()

static bool box_has_percentage_max_width ( struct box b)
inlinestatic

Helper to check if a box has percentage max width.

Parameters
[in]bBox to check.
Returns
true iff box has percnetage max width.

Definition at line 438 of file layout.c.

References box::style, and type.

Referenced by layout_minmax_line().

Here is the caller graph for this function:

◆ find_sides()

static void find_sides ( struct box fl,
int  y0,
int  y1,
int *  x0,
int *  x1,
struct box **  left,
struct box **  right 
)
static

Find left and right edges in a vertical range.

Parameters
flfirst float in float list
y0start of y range to search
y1end of y range to search
x0start left edge, updated to available left edge
x1start right edge, updated to available right edge
leftreturns float on left if present
rightreturns float on right if present

Definition at line 1285 of file layout.c.

References BOX_FLOAT_LEFT, box::height, box::next_float, NSLOG, box::type, box::width, box::x, and box::y.

Referenced by layout_block_context(), layout_line(), and place_float_below().

Here is the caller graph for this function:

◆ layout__check_element_type()

static bool layout__check_element_type ( const dom_node *  node,
dom_html_element_type  type 
)
inlinestatic

Check a node's tag type.

Parameters
[in]nodeNode to check tag type of.
[in]typeTag type to test for.
Returns
true if if node has given type, false otherwise.

Definition at line 4050 of file layout.c.

References layout__get_element_tag(), box::node, and type.

Referenced by layout__get_list_item_count(), and layout__ordered_list_count().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout__get_element_tag()

static bool layout__get_element_tag ( const dom_node *  node,
dom_html_element_type *  type 
)
static

Get a dom node's element tag type.

Parameters
[in]nodeNode to get tag type of.
[in]typeReturns element tag type on success.
Returns
true if on success, false otherwise.

Definition at line 4018 of file layout.c.

References box::node, and type.

Referenced by layout__check_element_type(), layout__get_list_item_count(), and layout__ordered_list_count().

Here is the caller graph for this function:

◆ layout__get_li_value()

static bool layout__get_li_value ( dom_node *  li_node,
dom_long *  value_out 
)
static

Helper to get attribute value from a LI node.

Parameters
[in]li_nodeDOM node for the LI element;
[out]value_outReturns the value on success.
Returns
true if node has value, otherwise false.
Todo:
dom_html_li_element_get_value() is rubbish and we can't tell a lack of value attribute or invalid value from a perfectly valid '-1'.

This helps for the common case of no value. However we should fix libdom to have some kind of sane interface to get numerical attributes.

Definition at line 4072 of file layout.c.

Referenced by layout__ordered_list_count().

Here is the caller graph for this function:

◆ layout__get_list_item_count()

static bool layout__get_list_item_count ( dom_node *  list_owner,
dom_long *  count_out 
)
static

Get the number of list items for a list owner.

Parameters
[in]list_ownerDOM node to count list items for.
[in]count_outReturns list item count on success.
Returns
true on success, otherwise false.

Definition at line 4173 of file layout.c.

References count(), layout__check_element_type(), layout__get_element_tag(), and box::list_marker.

Referenced by layout__ordered_list_count().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout__get_ol_reversed()

static bool layout__get_ol_reversed ( dom_node *  ol_node)
static

Helper to get reversed attribute value from a OL node.

Parameters
[in]ol_nodeDOM node for the OL element;
Returns
true if node has reversed, otherwise false.

Definition at line 4149 of file layout.c.

Referenced by layout__ordered_list_count().

Here is the caller graph for this function:

◆ layout__get_ol_start()

static bool layout__get_ol_start ( dom_node *  ol_node,
dom_long *  start_out 
)
static

Helper to get start attribute value from a OL node.

Parameters
[in]ol_nodeDOM node for the OL element;
[out]start_outReturns the value on success.
Returns
true if node has value, otherwise false.
Todo:
see layout__get_li_value().

Definition at line 4114 of file layout.c.

Referenced by layout__ordered_list_count().

Here is the caller graph for this function:

◆ layout__list_item_is_numerical()

static bool layout__list_item_is_numerical ( const struct box b)
static

Find out if box's style represents a numerical list style type.

Parameters
[in]bBox with style to test.
Returns
true if box has numerical list style type, false otherwise.

Definition at line 4375 of file layout.c.

References box::style.

Referenced by layout_lists().

Here is the caller graph for this function:

◆ layout__ordered_list_count()

static void layout__ordered_list_count ( struct box box)
static

Handle list item counting, if this is a list owner box.

Parameters
[in]boxBox to do list item counting for.

Definition at line 4239 of file layout.c.

References layout__check_element_type(), layout__get_element_tag(), layout__get_li_value(), layout__get_list_item_count(), layout__get_ol_reversed(), layout__get_ol_start(), box::list_marker, box::list_value, box::next, and box::node.

Referenced by layout_lists().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout__set_numerical_marker_text()

static void layout__set_numerical_marker_text ( const html_content content,
struct box box 
)
static

Set up the marker text for a numerical list item.

Parameters
[in]contentThe HTML content.
[in]boxThe list item's main box.

initial length of a list marker buffer

enough for 9,999,999,999,999,999,999 in decimal or five characters for 4-byte UTF-8.

Definition at line 4325 of file layout.c.

References box::length, box::list_marker, box::list_value, box::style, talloc_array, talloc_realloc, and box::text.

Referenced by layout_lists().

Here is the caller graph for this function:

◆ layout_absolute()

static bool layout_absolute ( struct box box,
struct box containing_block,
int  cx,
int  cy,
html_content content 
)
static

Layout and position an absolutely positioned box.

Parameters
boxabsolute box to layout and position
containing_blockcontaining block
cxposition of box relative to containing_block
cyposition of box relative to containing_block
contentmemory pool for any new boxes
Returns
true on success, false on memory exhaustion
Todo:
inline ancestors
Todo:
Inline ancestors

Definition at line 4558 of file layout.c.

References AUTO, box::border, BOTTOM, BOX_BLOCK, BOX_FLEX, BOX_INLINE_BLOCK, BOX_INLINE_FLEX, BOX_TABLE, BOX_TABLE_CELL, box::flags, box::float_container, box::height, height, IFRAME, layout_apply_minmax_height(), layout_block_context(), layout_compute_offsets(), layout_find_dimensions(), layout_flex(), layout_solve_width(), layout_table(), LEFT, box::margin, max, box::max_width, min, box::min_width, NSLOG, box::object, box::padding, box::parent, RIGHT, box::style, TOP, box::type, box_border::width, box::width, border::width, width, box::x, and box::y.

Referenced by layout_position_absolute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_apply_minmax_height()

static bool layout_apply_minmax_height ( const css_unit_ctx *  unit_len_ctx,
struct box box,
struct box container 
)
static

Manimpulate box height according to CSS min-height and max-height properties.

Parameters
unit_len_ctxCSS length conversion context for document.
boxblock to modify with any min-height or max-height
containercontaining block for absolutely positioned elements, or NULL for non absolutely positioned elements.
Returns
whether the height has been changed

Definition at line 2158 of file layout.c.

References AUTO, BOX_INLINE_CONTAINER, box::float_container, box::height, height, ns_computed_min_height(), box::parent, box::style, and box::type.

Referenced by layout_absolute(), and layout_block_context().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_block_add_scrollbar()

static void layout_block_add_scrollbar ( struct box box,
int  which 
)
static

Manipulate a block's [RB]padding/height/width to accommodate scrollbars.

Parameters
boxBox to apply scrollbar space too. Must be BOX_BLOCK.
whichWhich scrollbar to make space for. Must be RIGHT or BOTTOM.

Definition at line 1526 of file layout.c.

References AUTO, BOTTOM, BOX_BLOCK, box_hscrollbar_present(), box_vscrollbar_present(), content_get_type(), CONTENT_HTML, box::height, height, box::object, box::padding, RIGHT, SCROLLBAR_WIDTH, box::style, box::type, and box::width.

Referenced by layout_block_context().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_block_context()

bool layout_block_context ( struct box block,
int  viewport_height,
html_content content 
)

Layout a block formatting context.

Parameters
blockBLOCK, INLINE_BLOCK, or TABLE_CELL to layout
viewport_heightHeight of viewport in pixels or -ve if unknown
contentMemory pool for any new boxes
Returns
true on success, false on memory exhaustion

This function carries out layout of a block and its children, as described in CSS 2.1 9.4.1.

< current coordinates

Definition at line 3508 of file layout.c.

References AUTO, plot_font_style::background, box::border, BOTTOM, BOX_BLOCK, BOX_FLEX, BOX_INLINE_BLOCK, BOX_INLINE_CONTAINER, BOX_INLINE_FLEX, box_is_first_child(), BOX_TABLE, BOX_TABLE_CELL, box::cached_place_below_level, box::children, box::clear_level, form_control::data, find_sides(), box::flags, box::float_children, font_plot_style_from_css(), box::gadget, GADGET_CHECKBOX, GADGET_PASSWORD, GADGET_RADIO, GADGET_TEXTAREA, GADGET_TEXTBOX, HAS_HEIGHT, box::height, IFRAME, box::iframe, layout_apply_minmax_height(), layout_block_add_scrollbar(), layout_block_context(), layout_block_find_dimensions(), layout_block_object(), layout_clear(), layout_flex(), layout_get_object_dimensions(), layout_inline_container(), layout_next_margin_block(), layout_solve_width(), layout_table(), LEFT, lh__box_is_object(), MAKE_HEIGHT, box::margin, box::next, box::next_float, NS_TRANSPARENT, NSLOG, box::object, box::padding, box::parent, REPLACE_DIM, RIGHT, box::style, textarea_set_layout(), TOP, box::type, form_control::type, UNKNOWN_WIDTH, box_border::width, box::width, width, box::x, and box::y.

Referenced by layout_absolute(), layout_block_context(), layout_document(), layout_flex_item(), layout_float(), and layout_table().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_block_find_dimensions()

static void layout_block_find_dimensions ( const css_unit_ctx *  unit_len_ctx,
int  available_width,
int  viewport_height,
int  lm,
int  rm,
struct box box 
)
static

Compute dimensions of box, margins, paddings, and borders for a block-level element.

Parameters
unit_len_ctxLength conversion context
available_widthMax width available in pixels
viewport_heightHeight of viewport in pixels or -ve if unknown
lmmin left margin required to avoid floats in px. zero if not applicable
rmmin right margin required to avoid floats in px. zero if not applicable
boxbox to find dimensions of. updated with new width, height, margins, borders and paddings

See CSS 2.1 10.3.3, 10.3.4, 10.6.2, and 10.6.3.

Definition at line 1484 of file layout.c.

References AUTO, box::border, BOTTOM, content_get_type(), CONTENT_HTML, box::flags, box::height, height, layout_find_dimensions(), layout_get_object_dimensions(), layout_solve_width(), box::margin, box::max_width, box::min_width, box::object, box::padding, REPLACE_DIM, box_border::style, box::style, TOP, box::width, and width.

Referenced by layout_block_context(), and layout_document().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_block_object()

static bool layout_block_object ( struct box block)
static

Layout a block which contains an object.

Parameters
blockbox of type BLOCK, INLINE_BLOCK, TABLE, or TABLE_CELL
Returns
true on success, false on memory exhaustion

Definition at line 2271 of file layout.c.

References BOX_BLOCK, BOX_FLEX, BOX_INLINE_BLOCK, BOX_INLINE_FLEX, BOX_TABLE, BOX_TABLE_CELL, content_can_reformat(), content_reformat(), hlcache_handle_get_url(), NSLOG, box::object, box::type, and box::width.

Referenced by layout_block_context().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_calculate_descendant_bboxes()

static void layout_calculate_descendant_bboxes ( const css_unit_ctx *  unit_len_ctx,
struct box box 
)
static

Recursively calculate the descendant_[xy][01] values for a laid-out box tree and inform iframe browser windows of their size and position.

Parameters
unit_len_ctxLength conversion context
boxtree of boxes to update

Definition at line 5303 of file layout.c.

References AUTO, box_coords(), BOX_FLOAT_LEFT, BOX_FLOAT_RIGHT, BOX_INLINE, BOX_INLINE_END, BOX_TEXT, browser_window_reformat(), browser_window_set_dimensions(), browser_window_set_position(), box::children, content_get_height(), content_get_type(), content_get_width(), CONTENT_HTML, box::descendant_x0, box::descendant_x1, box::descendant_y0, box::descendant_y1, box::flags, box::float_children, box::height, box::iframe, box::inline_end, layout_calculate_descendant_bboxes(), layout_get_box_bbox(), layout_update_descendant_bbox(), box::list_marker, box::next, box::next_float, box::object, REPLACE_DIM, box::style, box::type, UNKNOWN_WIDTH, box::width, box::x, and box::y.

Referenced by layout_calculate_descendant_bboxes(), and layout_document().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_clear()

static int layout_clear ( struct box fl,
enum css_clear_e  clear 
)
static

Find y coordinate which clears all floats on left and/or right.

Parameters
flfirst float in float list
cleartype of clear
Returns
y coordinate relative to ancestor box for floats

Definition at line 1256 of file layout.c.

References BOX_FLOAT_LEFT, BOX_FLOAT_RIGHT, box::height, box::next_float, box::type, and box::y.

Referenced by layout_block_context(), and layout_line().

Here is the caller graph for this function:

◆ layout_compute_offsets()

static void layout_compute_offsets ( const css_unit_ctx *  unit_len_ctx,
struct box box,
struct box containing_block,
int *  top,
int *  right,
int *  bottom,
int *  left 
)
static

Compute box offsets for a relatively or absolutely positioned box with respect to a box.

Parameters
unit_len_ctxLength conversion context
boxbox to compute offsets for
containing_blockbox to compute percentages with respect to
topupdated to top offset, or AUTO
rightupdated to right offset, or AUTO
bottomupdated to bottom offset, or AUTO
leftupdated to left offset, or AUTO

See CSS 2.1 9.3.2. containing_block must have width and height.

Definition at line 4469 of file layout.c.

References AUTO, box::height, box::style, type, UNKNOWN_WIDTH, and box::width.

Referenced by layout_absolute(), and layout_compute_relative_offset().

Here is the caller graph for this function:

◆ layout_compute_relative_offset()

static void layout_compute_relative_offset ( const css_unit_ctx *  unit_len_ctx,
struct box box,
int *  x,
int *  y 
)
static

Compute a box's relative offset as per CSS 2.1 9.4.3.

Parameters
unit_len_ctxLength conversion context
boxBox to compute relative offsets for.
xReceives relative offset in x.
yReceives relative offset in y.

Definition at line 5011 of file layout.c.

References AUTO, box::float_container, layout_compute_offsets(), NSLOG, box::parent, box::style, box::x, and box::y.

Referenced by layout_position_relative().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_document()

bool layout_document ( struct html_content content,
int  width,
int  height 
)

Calculate positions of boxes in a document.

Parameters
contentcontent of type CONTENT_HTML
widthavailable width
heightavailable height
Returns
true on success, false on memory exhaustion

Definition at line 5396 of file layout.c.

References box::border, BOTTOM, box::children, content_get_url(), box::height, height, layout_block_context(), layout_block_find_dimensions(), layout_calculate_descendant_bboxes(), layout_lists(), layout_minmax_block(), layout_position_absolute(), layout_position_relative(), LEFT, box::margin, NSLOG, nsurl_access(), box::padding, RIGHT, TOP, box_border::width, box::width, width, box::x, and box::y.

Referenced by html_reformat().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_float()

static bool layout_float ( struct box b,
int  width,
html_content content 
)
static

Layout the contents of a float or inline block.

Parameters
bfloat or inline block box
widthavailable width
contentmemory pool for any new boxes
Returns
true on success, false on memory exhaustion

Definition at line 2569 of file layout.c.

References AUTO, BOTTOM, BOX_BLOCK, BOX_FLEX, BOX_INLINE_BLOCK, BOX_INLINE_FLEX, BOX_TABLE, layout_block_context(), layout_flex(), layout_float_find_dimensions(), layout_table(), LEFT, box::margin, RIGHT, box::style, TOP, box::type, and width.

Referenced by layout_line().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_float_find_dimensions()

static void layout_float_find_dimensions ( const css_unit_ctx *  unit_len_ctx,
int  available_width,
const css_computed_style *  style,
struct box box 
)
static

Compute dimensions of box, margins, paddings, and borders for a floating element using shrink-to-fit.

Also used for inline-blocks.

Parameters
unit_len_ctxCSS length conversion context for document.
available_widthMax width available in pixels
styleBox's style
boxBox for which to find dimensions Box margins, borders, paddings, width and height are updated.

Definition at line 2431 of file layout.c.

References AUTO, box::border, BOTTOM, calculate_mbp_width(), content_get_type(), CONTENT_HTML, box::flags, box::gadget, GADGET_FILE, GADGET_PASSWORD, GADGET_TEXTAREA, GADGET_TEXTBOX, box::height, height, layout_find_dimensions(), layout_get_object_dimensions(), LEFT, box::margin, max, box::max_width, min, box::min_width, box::object, box::padding, REPLACE_DIM, RIGHT, SCROLLBAR_WIDTH, box_border::style, box::style, TOP, form_control::type, box_border::width, box::width, and width.

Referenced by layout_float().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_get_box_bbox()

static void layout_get_box_bbox ( const css_unit_ctx *  unit_len_ctx,
struct box box,
int *  desc_x0,
int *  desc_y0,
int *  desc_x1,
int *  desc_y1 
)
static

Find a box's bounding box relative to itself, i.e.

the box's border edge box

Parameters
unit_len_ctxLength conversion context
boxbox find bounding box of
desc_x0updated to left of box's bbox
desc_y0updated to top of box's bbox
desc_x1updated to right of box's bbox
desc_y1updated to bottom of box's bbox

Definition at line 5195 of file layout.c.

References box::border, BOTTOM, BOX_BLOCK, box::height, LEFT, box::object, box::padding, RIGHT, box::style, TOP, box::type, box_border::width, and box::width.

Referenced by layout_calculate_descendant_bboxes(), and layout_update_descendant_bbox().

Here is the caller graph for this function:

◆ layout_get_object_dimensions()

static void layout_get_object_dimensions ( struct box box,
int *  width,
int *  height,
int  min_width,
int  max_width,
int  min_height,
int  max_height 
)
static

Compute the size of replaced boxes with auto dimensions, according to content.

Parameters
boxBox with object
widthWidth value in px or AUTO. If AUTO, updated to value in px.
heightHeight value in px or AUTO. If AUTO, updated to value in px.
min_widthBox's min width, as given by layout_find_dimensions.
max_widthBox's max width, as given by layout_find_dimensions.
min_heightBox's min height, as given by layout_find_dimensions.
max_heightBox's max height, as given by layout_find_dimensions.

See CSS 2.1 sections 10.3 and 10.6.

Definition at line 134 of file layout.c.

References AUTO, content_get_height(), content_get_width(), height, box::object, and width.

Referenced by layout_block_context(), layout_block_find_dimensions(), layout_float_find_dimensions(), layout_line(), and layout_minmax_line().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_inline_container()

static bool layout_inline_container ( struct box inline_container,
int  width,
struct box cont,
int  cx,
int  cy,
html_content content 
)
static

Layout lines of text or inline boxes with floats.

Parameters
boxinline container box
widthhorizontal space available
contancestor box which defines horizontal space, for floats
cxbox position relative to cont
cybox position relative to cont
contentmemory pool for any new boxes
Returns
true on success, false on memory exhaustion
Todo:
fix wrapping so that a box with horizontal scrollbar will shrink back to 'width' if no word is wider than 'width' (Or just set curwidth = width and have the multiword lines wrap to the min width)

Definition at line 3443 of file layout.c.

References BOX_BR, BOX_INLINE_CONTAINER, box::children, box::height, layout_line(), box::length, lh__box_is_object(), max, box::next, NSLOG, box::style, box::text, box::type, box::width, width, and box::y.

Referenced by layout_block_context().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_line()

static bool layout_line ( struct box first,
int *  width,
int *  y,
int  cx,
int  cy,
struct box cont,
bool  indent,
bool  has_text_children,
html_content content,
struct box **  next_box 
)
static

Position a line of boxes in inline formatting context.

Parameters
firstbox at start of line
widthavailable width on input, updated with actual width on output (may be incorrect if the line gets split?)
ycoordinate of top of line, updated on exit to bottom
cxcoordinate of left of line relative to cont
cycoordinate of top of line relative to cont
contancestor box which defines horizontal space, for floats
indentapply any first-line indent
has_text_childrenat least one TEXT in the inline_container
next_boxupdated to first box for next line, or 0 at end
contentmemory pool for any new boxes
Returns
true on success, false on memory exhaustion
Todo:
handle errors
Todo:
handle errors
Todo:
handle errors
Todo:
handle errors
Todo:
handle errors
Todo:
proper vertical alignment handling

Definition at line 2707 of file layout.c.

References add_float_to_container(), AUTO, box::border, BOTTOM, BOX_BR, BOX_FLOAT_LEFT, BOX_INLINE, BOX_INLINE_BLOCK, BOX_INLINE_END, BOX_INLINE_FLEX, BOX_TEXT, box::cached_place_below_level, box::children, box::clear_level, content_can_reformat(), content_get_available_width(), content_get_height(), content_reformat(), find_sides(), box::flags, box::float_children, box::float_container, font_plot_style_from_css(), box::gadget, GADGET_SELECT, box::height, height, IFRAME, box::inline_end, form_control::items, layout_clear(), layout_find_dimensions(), layout_float(), layout_get_object_dimensions(), layout_text_box_split(), layout_text_indent(), LEFT, box::length, lh__box_is_float_box(), lh__box_is_inline_content(), lh__box_is_inline_flow(), lh__box_is_replace(), line_height(), box::margin, box::max_width, MEASURED, NEW_LINE, box::next, form_option::next, NSLOG, nsoption_bool, box::object, box::padding, box::parent, place_float_below(), PRIsizet, REPLACE_DIM, RIGHT, SCROLLBAR_WIDTH, form_control::select, box::space, gui_layout_table::split, box::style, box::text, form_option::text, TOP, box::type, form_control::type, UNKNOWN_WIDTH, form_option::value, box_border::width, box::width, width, gui_layout_table::width, box::x, and box::y.

Referenced by layout_inline_container().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_lists()

static void layout_lists ( const html_content content,
struct box box 
)
static

Layout list markers.

Definition at line 4396 of file layout.c.

References box::children, content_get_height(), content_get_width(), box::flags, font_plot_style_from_css(), box::height, layout__list_item_is_numerical(), layout__ordered_list_count(), layout__set_numerical_marker_text(), layout_lists(), box::length, line_height(), box::list_marker, MEASURED, box::next, box::object, box::style, box::text, UNKNOWN_WIDTH, content::width, box::width, box::x, and box::y.

Referenced by layout_document(), and layout_lists().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_minmax_block()

static void layout_minmax_block ( struct box block,
const struct gui_layout_table font_func,
const html_content content 
)
static

Calculate minimum and maximum width of a block.

Parameters
blockbox of type BLOCK, INLINE_BLOCK, or TABLE_CELL
font_funcfont functions
contentThe HTML content being layed out.
Postcondition
block->min_width and block->max_width filled in, 0 <= block->min_width <= block->max_width
Todo:
do we need to know the min/max width of the iframe's content?

Definition at line 859 of file layout.c.

References BOX_BLOCK, box_dump(), BOX_FLEX, BOX_INLINE_BLOCK, BOX_INLINE_CONTAINER, BOX_INLINE_FLEX, BOX_TABLE, BOX_TABLE_CELL, calculate_mbp_width(), box::children, content_get_type(), content_get_width(), CONTENT_HTML, box::flags, box::gadget, GADGET_CHECKBOX, GADGET_FILE, GADGET_PASSWORD, GADGET_RADIO, GADGET_TEXTAREA, GADGET_TEXTBOX, HAS_HEIGHT, height, html_get_box_tree(), IFRAME, layout_minmax_block(), layout_minmax_inline_container(), layout_minmax_table(), LEFT, lh__box_is_flex_container(), lh__box_is_flex_item(), lh__box_is_float_box(), lh__flex_main_is_horizontal(), MAKE_HEIGHT, max, box::max_width, min, box::min_width, NEED_MIN, box::next, box::object, box::parent, RIGHT, box::style, box::type, form_control::type, UNKNOWN_MAX_WIDTH, and width.

Referenced by layout_document(), layout_minmax_block(), layout_minmax_line(), and layout_minmax_table().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_minmax_inline_container()

static void layout_minmax_inline_container ( struct box inline_container,
bool *  has_height,
const struct gui_layout_table font_func,
const html_content content 
)
static

Calculate minimum and maximum width of an inline container.

Parameters
inline_containerbox of type INLINE_CONTAINER
[out]has_heightset to true if container has height
font_funcFont functions.
Postcondition
inline_container->min_width and inline_container->max_width filled in, 0 <= inline_container->min_width <= inline_container->max_width

Definition at line 811 of file layout.c.

References BOX_INLINE_CONTAINER, box::children, layout_minmax_line(), max, box::max_width, min, box::min_width, box::type, and UNKNOWN_MAX_WIDTH.

Referenced by layout_minmax_block().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_minmax_line()

static struct box * layout_minmax_line ( struct box first,
int *  line_min,
int *  line_max,
bool  first_line,
bool *  line_has_height,
const struct gui_layout_table font_func,
const html_content content 
)
static

Calculate minimum and maximum width of a line.

Parameters
firsta box in an inline container
line_minupdated to minimum width of line starting at first
line_maxupdated to maximum width of line starting at first
first_linetrue iff this is the first line in the inline container
line_has_heightupdated to true or false, depending on line
font_funcFont functions.
Returns
first box in next line, or 0 if no more lines
Postcondition
0 <= *line_min <= *line_max
Todo:
handle errors

Definition at line 463 of file layout.c.

References AUTO, BOX_BR, box_has_percentage_max_width(), BOX_INLINE, BOX_INLINE_BLOCK, BOX_INLINE_END, BOX_INLINE_FLEX, BOX_TABLE, calculate_mbp_width(), box::children, box::flags, font_plot_style_from_css(), box::gadget, GADGET_SELECT, HAS_HEIGHT, height, IFRAME, box::inline_end, form_control::items, layout_get_object_dimensions(), layout_minmax_block(), layout_minmax_table(), layout_text_indent(), LEFT, box::length, lh__box_is_float_box(), lh__box_is_inline_content(), lh__box_is_replace(), max, box::max_width, MEASURED, min, box::min_width, NEED_MIN, box::next, form_option::next, NSLOG, nsoption_bool, box::object, box::parent, REPLACE_DIM, RIGHT, SCROLLBAR_WIDTH, form_control::select, box::space, box::style, box::text, form_option::text, box::type, form_control::type, UNKNOWN_WIDTH, form_option::value, box::width, width, and gui_layout_table::width.

Referenced by layout_minmax_inline_container().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_minmax_table()

static void layout_minmax_table ( struct box table,
const struct gui_layout_table font_func,
const html_content content 
)
static

Calculate minimum and maximum width of a table.

Parameters
tablebox of type TABLE
font_funcFont functions
contentThe HTML content we are laying out.
Postcondition
table->min_width and table->max_width filled in, 0 <= table->min_width <= table->max_width

TODO: Handle colspan="0" correctly. It's currently converted to 1 in box normaisation

Definition at line 257 of file layout.c.

References box_dump(), BOX_TABLE_CELL, calculate_mbp_width(), box::children, box::col, box::columns, layout_minmax_block(), LEFT, column::max, max, box::max_width, column::min, min, box::min_width, box::next, NSLOG, RIGHT, box::start_column, box::style, table_calculate_column_types(), box::type, type, UNKNOWN_MAX_WIDTH, column::width, and width.

Referenced by layout_minmax_block(), and layout_minmax_line().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_move_children()

static void layout_move_children ( struct box box,
int  x,
int  y 
)
static

Moves the children of a box by a specified amount.

Parameters
boxtop of tree of boxes
xthe amount to move children by horizontally
ythe amount to move children by vertically

Definition at line 1579 of file layout.c.

References box::children, box::next, box::x, and box::y.

Referenced by layout_table().

Here is the caller graph for this function:

◆ layout_next_margin_block()

static struct box * layout_next_margin_block ( const css_unit_ctx *  unit_len_ctx,
struct box box,
struct box block,
int  viewport_height,
int *  max_pos_margin,
int *  max_neg_margin 
)
static

Find next block that current margin collapses to.

Parameters
unit_len_ctxLength conversion context
boxbox to start tree-order search from (top margin is included)
blockbox responsible for current block fromatting context
viewport_heightheight of viewport in px
max_pos_marginupdated to to maximum positive margin encountered
max_neg_marginupdated to to maximum negative margin encountered
Returns
next box that current margin collapses to, or NULL if none.

Definition at line 1139 of file layout.c.

References box::border, BOTTOM, BOX_BLOCK, BOX_INLINE_CONTAINER, box_is_first_child(), box::children, box::flags, layout_find_dimensions(), MAKE_HEIGHT, box::margin, box::next, box::object, box::padding, box::parent, box::style, TOP, box::type, box_border::width, and box::width.

Referenced by layout_block_context().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_position_absolute()

static bool layout_position_absolute ( struct box box,
struct box containing_block,
int  cx,
int  cy,
html_content content 
)
static

Recursively layout and position absolutely positioned boxes.

Parameters
boxtree of boxes to layout
containing_blockcurrent containing block
cxposition of box relative to containing_block
cyposition of box relative to containing_block
contentmemory pool for any new boxes
Returns
true on success, false on memory exhaustion

Definition at line 4944 of file layout.c.

References BOX_BLOCK, BOX_FLEX, BOX_INLINE_BLOCK, BOX_INLINE_FLEX, BOX_TABLE, box::children, box::float_children, layout_absolute(), layout_position_absolute(), box::next, box::parent, box::style, box::type, box::x, and box::y.

Referenced by layout_document(), and layout_position_absolute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_position_relative()

static void layout_position_relative ( const css_unit_ctx *  unit_len_ctx,
struct box root,
struct box fp,
int  fx,
int  fy 
)
static

Adjust positions of relatively positioned boxes.

Parameters
unit_len_ctxLength conversion context
rootbox to adjust the position of
fpbox which forms the block formatting context for children of "root" which are floats
fxx offset due to intervening relatively positioned boxes between current box, "root", and the block formatting context box, "fp", for float children of "root"
fyy offset due to intervening relatively positioned boxes between current box, "root", and the block formatting context box, "fp", for float children of "root"
Todo:
ensure containing box is large enough after moving boxes

Definition at line 5092 of file layout.c.

References BOX_INLINE, BOX_TEXT, box::children, box::float_children, box::inline_end, layout_compute_relative_offset(), layout_position_relative(), box::next, box::next_float, root, box::style, box::type, box::x, and box::y.

Referenced by layout_document(), and layout_position_relative().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_solve_width()

static int layout_solve_width ( struct box box,
int  available_width,
int  width,
int  lm,
int  rm,
int  max_width,
int  min_width 
)
static

Solve the width constraint as given in CSS 2.1 section 10.3.3.

Parameters
boxBox to solve constraint for
available_widthMax width available in pixels
widthCurrent box width
lmMin left margin required to avoid floats in px. zero if not applicable
rmMin right margin required to avoid floats in px. zero if not applicable
max_widthBox max-width ( -ve means no max-width to apply)
min_widthBox min-width ( <=0 means no min-width to apply)
Returns
New box width
Postcondition
box's left/right margins will be updated.

Definition at line 1346 of file layout.c.

References AUTO, box::border, LEFT, box::margin, box::max_width, box::min_width, box::padding, box::parent, RIGHT, box::style, box_border::width, and width.

Referenced by layout_absolute(), layout_block_context(), and layout_block_find_dimensions().

Here is the caller graph for this function:

◆ layout_table()

bool layout_table ( struct box table,
int  available_width,
html_content content 
)

Layout a table.

Parameters
tabletable to layout
available_widthwidth of containing block
contentmemory pool for any new boxes
Returns
true on success, false on memory exhaustion
Todo:
distribute spare height over the row groups / rows / cells

Definition at line 1591 of file layout.c.

References AUTO, box::border, BOTTOM, BOX_INLINE_CONTAINER, BOX_TABLE, box::cached_place_below_level, box::children, box::col, column::COLUMN_WIDTH_FIXED, column::COLUMN_WIDTH_PERCENT, column::COLUMN_WIDTH_RELATIVE, box::columns, count(), box::descendant_y0, box::descendant_y1, box::float_children, box::float_container, box::height, layout_block_context(), layout_find_dimensions(), layout_move_children(), LEFT, box::margin, column::max, max, box::max_width, column::min, min, box::min_width, box::next, NSLOG, box::padding, box::parent, column::positioned, RIGHT, box::rows, SCROLLBAR_WIDTH, box::start_column, box::style, table_used_border_for_cell(), TOP, column::type, box::type, type, box_border::width, column::width, box::width, width, box::x, and box::y.

Referenced by layout_absolute(), layout_block_context(), and layout_float().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ layout_text_box_split()

static bool layout_text_box_split ( html_content content,
plot_font_style_t fstyle,
struct box split_box,
size_t  new_length,
int  new_width 
)
static

Split a text box.

Parameters
contentmemory pool for any new boxes
fstylestyle for text in text box
split_boxbox with text to split
new_lengthnew length for text in split_box, after splitting
new_widthnew width for text in split_box, after splitting
Returns
true on success, false on memory exhaustion

A new box is created and inserted into the box tree after split_box, containing the text after new_length excluding the initial space character.

Definition at line 2349 of file layout.c.

References CLONE, box::flags, box::last, box::length, MEASURED, box::next, NSLOG, box::parent, box::prev, PRIsizet, box::space, talloc_memdup, box::text, UNKNOWN_WIDTH, box::width, and gui_layout_table::width.

Referenced by layout_line().

Here is the caller graph for this function:

◆ layout_text_indent()

static int layout_text_indent ( const css_unit_ctx *  unit_len_ctx,
const css_computed_style *  style,
int  width 
)
static

Calculate the text-indent length.

Parameters
stylestyle of block
widthwidth of containing block
Returns
length of indent

Definition at line 230 of file layout.c.

References width.

Referenced by layout_line(), and layout_minmax_line().

Here is the caller graph for this function:

◆ layout_update_descendant_bbox()

static void layout_update_descendant_bbox ( const css_unit_ctx *  unit_len_ctx,
struct box box,
struct box child,
int  off_x,
int  off_y 
)
static

Apply changes to box descendant_[xy][01] values due to given child.

Parameters
unit_len_ctxLength conversion context
boxbox to update
childa box, which may affect box's descendant bbox
off_xoffset to apply to child->x coord to treat as child of box
off_yoffset to apply to child->y coord to treat as child of box

Definition at line 5237 of file layout.c.

References content_get_type(), CONTENT_HTML, box::descendant_x0, box::descendant_x1, box::descendant_y0, box::descendant_y1, layout_get_box_bbox(), box::object, box::style, box::x, and box::y.

Referenced by layout_calculate_descendant_bboxes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ line_height()

static int line_height ( const css_unit_ctx *  unit_len_ctx,
const css_computed_style *  style 
)
static

Calculate line height from a style.

Definition at line 2654 of file layout.c.

References line_height(), and box::style.

Referenced by form_redraw_select_menu(), form_select_menu_clicked(), layout_line(), layout_lists(), line_height(), ro_gui_wimp_event_process_window_menu_click(), textarea_redraw(), textplain_coords_from_range(), textplain_offset_from_coords(), and textplain_redraw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ place_float_below()

static void place_float_below ( struct box c,
int  width,
int  cx,
int  y,
struct box cont 
)
static

Position a float in the first available space.

Parameters
cfloat box to position
widthavailable width
cxx coordinate relative to cont to place float right of
yy coordinate relative to cont to place float below
contancestor box which defines horizontal space, for floats

Definition at line 2610 of file layout.c.

References BOX_FLOAT_LEFT, box::cached_place_below_level, find_sides(), box::float_children, box::height, NSLOG, box::type, box::width, width, box::x, and box::y.

Referenced by layout_line().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ border_color_funcs

const css_border_color_func border_color_funcs[4]
Initial value:
= {
[TOP] = css_computed_border_top_color,
[RIGHT] = css_computed_border_right_color,
[BOTTOM] = css_computed_border_bottom_color,
[LEFT] = css_computed_border_left_color,
}
@ TOP
Definition: box.h:98
@ BOTTOM
Definition: box.h:98
@ LEFT
Definition: box.h:98
@ RIGHT
Definition: box.h:98

Array of per-side access functions for computed style border colors.

Definition at line 106 of file layout.c.

Referenced by layout_find_dimensions().

◆ border_style_funcs

const css_border_style_func border_style_funcs[4]
Initial value:
= {
[TOP] = css_computed_border_top_style,
[RIGHT] = css_computed_border_right_style,
[BOTTOM] = css_computed_border_bottom_style,
[LEFT] = css_computed_border_left_style,
}

Array of per-side access functions for computed style border styles.

Definition at line 98 of file layout.c.

Referenced by layout_find_dimensions(), and lh__have_border().

◆ border_width_funcs

const css_len_func border_width_funcs[4]
Initial value:
= {
[TOP] = css_computed_border_top_width,
[RIGHT] = css_computed_border_right_width,
[BOTTOM] = css_computed_border_bottom_width,
[LEFT] = css_computed_border_left_width,
}

Array of per-side access functions for computed style border_widths.

Definition at line 90 of file layout.c.

Referenced by calculate_mbp_width(), and layout_find_dimensions().

◆ margin_funcs

const css_len_func margin_funcs[4]
Initial value:
= {
[TOP] = css_computed_margin_top,
[RIGHT] = css_computed_margin_right,
[BOTTOM] = css_computed_margin_bottom,
[LEFT] = css_computed_margin_left,
}

Array of per-side access functions for computed style margins.

Definition at line 74 of file layout.c.

Referenced by calculate_mbp_width(), and layout_find_dimensions().

◆ padding_funcs

const css_len_func padding_funcs[4]
Initial value:
= {
[TOP] = css_computed_padding_top,
[RIGHT] = css_computed_padding_right,
[BOTTOM] = css_computed_padding_bottom,
[LEFT] = css_computed_padding_left,
}

Array of per-side access functions for computed style paddings.

Definition at line 82 of file layout.c.

Referenced by calculate_mbp_width(), and layout_find_dimensions().