mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-11-30 16:48:21 +01:00
fix(ui): make fit-content width and tooltip reveal deterministic
Initialize the fit-content width during CSS cascade instead of leaving a stack-garbage value, and apply tooltip visibility in the reveal frame so the behavior no longer depends on an extra layout pass.
This commit is contained in:
@@ -23,5 +23,10 @@ static void set_width(css_computed_style_t *computed, uint8_t keyword,
|
||||
int css_cascade_width(const css_style_array_value_t input,
|
||||
css_computed_style_t *computed)
|
||||
{
|
||||
if (input[0].type == CSS_KEYWORD_VALUE &&
|
||||
input[0].keyword_value == CSS_KEYWORD_FIT_CONTENT) {
|
||||
set_width(computed, CSS_WIDTH_FIT_CONTENT, 0, CSS_UNIT_PX);
|
||||
return 0;
|
||||
}
|
||||
return css_cascade_length_auto(input, computed, set_width);
|
||||
}
|
||||
|
||||
@@ -508,6 +508,8 @@ void ui_widget_update_style(ui_widget_t *w)
|
||||
char *old_background = NULL;
|
||||
bool reuse_background;
|
||||
|
||||
memset(&new_style, 0, sizeof(new_style));
|
||||
|
||||
if (w->computed_style.background_image) {
|
||||
old_background = y_strdup(w->computed_style.background_image);
|
||||
}
|
||||
|
||||
@@ -941,6 +941,8 @@ static void ui_tooltip_on_content_layout(ui_widget_t *w, ui_event_t *e,
|
||||
data->settle_stage = 2;
|
||||
ui_widget_set_style_keyword_value(
|
||||
data->content, css_prop_visibility, CSS_KEYWORD_VISIBLE);
|
||||
data->content->computed_style.type_bits.visibility =
|
||||
CSS_VISIBILITY_VISIBLE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -953,6 +955,8 @@ static void ui_tooltip_show_data(ui_tooltip_t *data)
|
||||
if (data->content) {
|
||||
ui_widget_set_style_keyword_value(
|
||||
data->content, css_prop_visibility, CSS_KEYWORD_HIDDEN);
|
||||
data->content->computed_style.type_bits.visibility =
|
||||
CSS_VISIBILITY_HIDDEN;
|
||||
}
|
||||
data->open = true;
|
||||
data->reveal_pending = true;
|
||||
|
||||
Reference in New Issue
Block a user