You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
netsurf/content/handlers/html/layout/block.h

59 lines
2.1 KiB

/*
* Copyright 2023 Vincent Sanders <vince@netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
* NetSurf is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* NetSurf is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file
* HTML block layout interface.
*/
#ifndef NETSURF_HTML_LAYOUT_BLOCK_H
#define NETSURF_HTML_LAYOUT_BLOCK_H
/**
* Compute dimensions of box, margins, paddings, and borders for a block-level
* element.
*
* \param unit_len_ctx Length conversion context
* \param available_width Max width available in pixels
* \param viewport_height Height of viewport in pixels or -ve if unknown
* \param lm min left margin required to avoid floats in px.
* zero if not applicable
* \param rm min right margin required to avoid floats in px.
* zero if not applicable
* \param box box 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.
*/
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);
/**
* Layout a block formatting context.
*
* \param[in] block BLOCK, INLINE_BLOCK, or TABLE_CELL to layout
* \param[in] viewport_height Height of viewport in pixels or -ve if unknown
* \param[in] content Memory pool for any new boxes.
* \return 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.
*/
bool layout_block_context(struct box *block, int viewport_height, html_content *content);
#endif