html: css: Update to new css_computed_width API

This commit is contained in:
Michael Drake 2024-05-27 13:50:52 +01:00
parent 24579fab5d
commit a885818d78
5 changed files with 13 additions and 13 deletions

View File

@ -1785,7 +1785,7 @@ void nscss_dump_computed_style(FILE *stream, const css_computed_style *style)
} }
/* width */ /* width */
val = css_computed_width_static(style, &len1, &unit1); val = css_computed_width(style, &len1, &unit1);
switch (val) { switch (val) {
case CSS_WIDTH_AUTO: case CSS_WIDTH_AUTO:
fprintf(stream, "width: auto "); fprintf(stream, "width: auto ");

View File

@ -1212,7 +1212,7 @@ box_image(dom_node *n,
ok = html_fetch_object(content, url, box, image_types, false); ok = html_fetch_object(content, url, box, image_types, false);
nsurl_unref(url); nsurl_unref(url);
wtype = css_computed_width_static(box->style, &value, &wunit); wtype = css_computed_width(box->style, &value, &wunit);
htype = css_computed_height(box->style, &value, &hunit); htype = css_computed_height(box->style, &value, &hunit);
if (wtype == CSS_WIDTH_SET && if (wtype == CSS_WIDTH_SET &&

View File

@ -400,7 +400,7 @@ static void layout_minmax_table(struct box *table,
} }
/* fixed width takes priority, unless it is too narrow */ /* fixed width takes priority, unless it is too narrow */
if (css_computed_width(table->style, &content->unit_len_ctx, if (css_computed_width_px(table->style, &content->unit_len_ctx,
-1, &width) == CSS_WIDTH_SET) { -1, &width) == CSS_WIDTH_SET) {
if (table_min < width) if (table_min < width)
table_min = width; table_min = width;
@ -666,7 +666,7 @@ layout_minmax_line(struct box *first,
bs = css_computed_box_sizing(block->style); bs = css_computed_box_sizing(block->style);
/* calculate box width */ /* calculate box width */
wtype = css_computed_width(b->style, wtype = css_computed_width_px(b->style,
&content->unit_len_ctx, -1, &width); &content->unit_len_ctx, -1, &width);
if (wtype == CSS_WIDTH_SET) { if (wtype == CSS_WIDTH_SET) {
if (bs == CSS_BOX_SIZING_BORDER_BOX) { if (bs == CSS_BOX_SIZING_BORDER_BOX) {
@ -887,7 +887,7 @@ static void layout_minmax_block(
return; return;
if (block->style != NULL) { if (block->style != NULL) {
wtype = css_computed_width_static(block->style, &width, &wunit); wtype = css_computed_width(block->style, &width, &wunit);
htype = css_computed_height(block->style, &height, &hunit); htype = css_computed_height(block->style, &height, &hunit);
bs = css_computed_box_sizing(block->style); bs = css_computed_box_sizing(block->style);
} }
@ -1038,7 +1038,7 @@ static void layout_minmax_block(
css_fixed value = 0; css_fixed value = 0;
int width; int width;
if (css_computed_width(block->style, &content->unit_len_ctx, if (css_computed_width_px(block->style, &content->unit_len_ctx,
-1, &width) == CSS_WIDTH_SET) { -1, &width) == CSS_WIDTH_SET) {
min = max = width; min = max = width;
using_max_border_box = border_box; using_max_border_box = border_box;
@ -1693,7 +1693,7 @@ bool layout_table(
} }
/* find specified table width, or available width if auto-width */ /* find specified table width, or available width if auto-width */
if (css_computed_width(style, &content->unit_len_ctx, if (css_computed_width_px(style, &content->unit_len_ctx,
available_width, &table_width) == CSS_WIDTH_SET) { available_width, &table_width) == CSS_WIDTH_SET) {
/* specified width includes border */ /* specified width includes border */
table_width -= table->border[LEFT].width + table_width -= table->border[LEFT].width +
@ -3688,7 +3688,7 @@ bool layout_block_context(
css_fixed width = 0; css_fixed width = 0;
css_unit unit = CSS_UNIT_PX; css_unit unit = CSS_UNIT_PX;
wtype = css_computed_width_static(box->style, &width, wtype = css_computed_width(box->style, &width,
&unit); &unit);
if (wtype == CSS_WIDTH_AUTO) { if (wtype == CSS_WIDTH_AUTO) {
@ -3817,7 +3817,7 @@ bool layout_block_context(
css_fixed width = 0; css_fixed width = 0;
css_unit unit = CSS_UNIT_PX; css_unit unit = CSS_UNIT_PX;
wtype = css_computed_width_static(box->style, wtype = css_computed_width(box->style,
&width, &unit); &width, &unit);
x0 = cx; x0 = cx;

View File

@ -280,7 +280,7 @@ static inline bool lh__box_size_cross_is_auto(
return css_computed_height(b->style, return css_computed_height(b->style,
&length, &unit) == CSS_HEIGHT_AUTO; &length, &unit) == CSS_HEIGHT_AUTO;
} else { } else {
return css_computed_width_static(b->style, return css_computed_width(b->style,
&length, &unit) == CSS_WIDTH_AUTO; &length, &unit) == CSS_WIDTH_AUTO;
} }
} }
@ -447,7 +447,7 @@ static inline void layout_find_dimensions(
unsigned int i; unsigned int i;
if (width) { if (width) {
if (css_computed_width(style, unit_len_ctx, if (css_computed_width_px(style, unit_len_ctx,
available_width, width) == CSS_WIDTH_SET) { available_width, width) == CSS_WIDTH_SET) {
layout_handle_box_sizing(unit_len_ctx, box, layout_handle_box_sizing(unit_len_ctx, box,
available_width, true, width); available_width, true, width);

View File

@ -852,7 +852,7 @@ table_calculate_column_types(const css_unit_ctx *unit_len_ctx, struct box *table
col[i].positioned = false; col[i].positioned = false;
} }
type = css_computed_width_static(cell->style, &value, &unit); type = css_computed_width(cell->style, &value, &unit);
/* fixed width takes priority over any other width type */ /* fixed width takes priority over any other width type */
if (col[i].type != COLUMN_WIDTH_FIXED && if (col[i].type != COLUMN_WIDTH_FIXED &&
@ -919,7 +919,7 @@ table_calculate_column_types(const css_unit_ctx *unit_len_ctx, struct box *table
if (!unknown_columns) if (!unknown_columns)
continue; continue;
type = css_computed_width_static(cell->style, &value, &unit); type = css_computed_width(cell->style, &value, &unit);
/* if cell is fixed width, and all spanned columns are fixed /* if cell is fixed width, and all spanned columns are fixed
* or unknown width, split extra width among unknown columns */ * or unknown width, split extra width among unknown columns */