Skip to content

Commit

Permalink
fixup! fix(ui): correct flex item width compute
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-soft committed May 15, 2024
1 parent bf2794e commit f47e67c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/css/include/css/computed.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ LIBCSS_INLINE libcss_bool_t is_css_display_block(const css_computed_style_t *s)
return s->type_bits.display == CSS_DISPLAY_BLOCK;
}

LIBCSS_INLINE libcss_bool_t is_css_display_inline_block(const css_computed_style_t *s)
{
return s->type_bits.display == CSS_DISPLAY_INLINE_BLOCK;
}

LIBCSS_INLINE css_numeric_value_t css_padding_x(const css_computed_style_t *s)
{
return s->padding_left + s->padding_right;
Expand Down
3 changes: 2 additions & 1 deletion lib/css/src/computed.c
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,8 @@ static void compute_absolute_width(const css_computed_style_t *parent,
s->type_bits.width = CSS_WIDTH_FIT_CONTENT;
break;
}
if (is_css_display_block(parent) &&
if ((is_css_display_block(parent) ||
is_css_display_inline_block(parent)) &&
compute_content_box_fixed_width(parent, &parent_value)) {
value = parent_value - s->margin_left - s->margin_right;
if (s->type_bits.box_sizing ==
Expand Down

0 comments on commit f47e67c

Please sign in to comment.