Skip to content

Commit

Permalink
fix(layout): "left: auto" is calculated as "left: 0"
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-soft committed Aug 4, 2018
1 parent b5d9040 commit f4990da
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/gui/widget_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,18 +848,18 @@ void Widget_UpdatePosition(LCUI_Widget w)
switch (position) {
case SV_ABSOLUTE:
w->x = w->y = 0;
if (Widget_CheckStyleValid(w, key_left)) {
if (!Widget_HasAutoStyle(w, key_left)) {
w->x = w->computed_style.left;
} else if (Widget_CheckStyleValid(w, key_right)) {
} else if (!Widget_HasAutoStyle(w, key_right)) {
if (w->parent) {
w->x = w->parent->box.border.width;
w->x -= w->width;
}
w->x -= w->computed_style.right;
}
if (Widget_CheckStyleValid(w, key_top)) {
if (!Widget_HasAutoStyle(w, key_top)) {
w->y = w->computed_style.top;
} else if (Widget_CheckStyleValid(w, key_bottom)) {
} else if (!Widget_HasAutoStyle(w, key_bottom)) {
if (w->parent) {
w->y = w->parent->box.border.height;
w->y -= w->height;
Expand All @@ -868,14 +868,14 @@ void Widget_UpdatePosition(LCUI_Widget w)
}
break;
case SV_RELATIVE:
if (Widget_CheckStyleValid(w, key_left)) {
if (!Widget_HasAutoStyle(w, key_left)) {
w->x += w->computed_style.left;
} else if (Widget_CheckStyleValid(w, key_right)) {
} else if (!Widget_HasAutoStyle(w, key_right)) {
w->x -= w->computed_style.right;
}
if (Widget_CheckStyleValid(w, key_top)) {
if (!Widget_HasAutoStyle(w, key_top)) {
w->y += w->computed_style.top;
} else if (Widget_CheckStyleValid(w, key_bottom)) {
} else if (!Widget_HasAutoStyle(w, key_bottom)) {
w->y -= w->computed_style.bottom;
}
default:
Expand Down

0 comments on commit f4990da

Please sign in to comment.