use abc_attr_t to save HTML attrs, abc_obj_t only save HTML objects, so can decrease... master
authoryu.dongliang <18588496441@163.com>
Wed, 20 May 2026 16:37:00 +0000 (00:37 +0800)
committeryu.dongliang <18588496441@163.com>
Wed, 20 May 2026 16:37:00 +0000 (00:37 +0800)
33 files changed:
examples/overflow.html
html/abc_css.c
html/abc_css_border.c
html/abc_css_length.c
html/abc_css_position.c
html/abc_html.c
html/abc_html.h
html/abc_obj.c
html/abc_obj.h
ui/__render_bg_image.c
ui/__render_border.c
ui/__render_text.c
ui/abc_layout.c
ui/abc_layout_div.c
ui/abc_layout_form.c
ui/abc_layout_h1.c
ui/abc_layout_input.c
ui/abc_layout_label.c
ui/abc_layout_table.c
ui/abc_layout_td.c
ui/abc_layout_text.c
ui/abc_layout_video.c
ui/abc_render_a_href.c
ui/abc_render_audio.c
ui/abc_render_body.c
ui/abc_render_form.c
ui/abc_render_img.c
ui/abc_render_input.c
ui/abc_render_label.c
ui/abc_render_li.c
ui/abc_render_td.c
ui/abc_render_text.c
ui/main.c

index 55fcd84605772b090d53f4dd5988053a75084e78..54e5b71e1a0c5d457de32a83ece63b932b3912b4 100644 (file)
@@ -9,7 +9,7 @@ div {
        height: 50px;
        border: 1px dotted black;
        padding: 25px;
        height: 50px;
        border: 1px dotted black;
        padding: 25px;
-       overflow: visible;
+       overflow: scroll;
        scrollbar-width: 15px;
        scrollbar-color: orangeRed lightGray;
 }
        scrollbar-width: 15px;
        scrollbar-color: orangeRed lightGray;
 }
index 25aeac1f959a260f573b861cbfc2c99b884838dc..430b35ce41e0668ba6a26b30a4a8b5342cb76547 100644 (file)
@@ -133,7 +133,7 @@ static int __css_parse_str(abc_obj_t* css, scf_string_t* s, int (*end)(int c))
        return tmp;
 }
 
        return tmp;
 }
 
-static int __css_parse_value(abc_obj_t* css, abc_obj_t* attr)
+static int __css_parse_value(abc_obj_t* css, abc_attr_t* attr)
 {
        scf_string_t* value = scf_string_alloc();
        if (!value)
 {
        scf_string_t* value = scf_string_alloc();
        if (!value)
@@ -182,8 +182,8 @@ static int __css_parse_attr2(abc_obj_t* css, abc_obj_t* obj, const html_attr_t*
                        break;
        };
 
                        break;
        };
 
-       scf_list_t* l;
-       abc_obj_t*  attr;
+       scf_list_t*  l;
+       abc_attr_t*  attr;
 
        int i;
        int j;
 
        int i;
        int j;
@@ -218,9 +218,6 @@ found:
        scf_string_free(key);
        key = NULL;
 
        scf_string_free(key);
        key = NULL;
 
-       attr->line = css->text_line;
-       attr->pos  = css->text_pos;
-
        return __css_parse_value(css, attr);
 }
 
        return __css_parse_value(css, attr);
 }
 
@@ -499,7 +496,7 @@ int abc_css_parse(abc_obj_t* css)
        abc_char_t*    c;
        abc_char_t*    c2;
        abc_io_t*      io = NULL;
        abc_char_t*    c;
        abc_char_t*    c2;
        abc_io_t*      io = NULL;
-       abc_obj_t*     href;
+       abc_attr_t*    href;
        char*          path;
        int            n;
 
        char*          path;
        int            n;
 
@@ -607,7 +604,7 @@ int abc_css_parse(abc_obj_t* css)
        return ret;
 }
 
        return ret;
 }
 
-static void __css_background(abc_obj_t* obj, abc_obj_t* attr)
+static void __css_background(abc_obj_t* obj, abc_attr_t* attr)
 {
        char* p0 = NULL;
        char* p1 = attr->value->data;
 {
        char* p0 = NULL;
        char* p1 = attr->value->data;
@@ -702,7 +699,7 @@ static void __css_text_transform(abc_obj_t* obj, int case_flag)
        }
 }
 
        }
 }
 
-static void __css_set_attr(abc_obj_t* obj, abc_obj_t* attr)
+static void __css_set_attr(abc_obj_t* obj, abc_attr_t* attr)
 {
        switch (attr->type)
        {
 {
        switch (attr->type)
        {
@@ -785,8 +782,8 @@ static int __css_set_pse_dynamic(abc_obj_t* obj, abc_obj_t* pse)
 
 static void __css_merge(abc_obj_t* dst, abc_obj_t* src)
 {
 
 static void __css_merge(abc_obj_t* dst, abc_obj_t* src)
 {
-       abc_obj_t*  s;
-       abc_obj_t*  d;
+       abc_attr_t*  s;
+       abc_attr_t*  d;
        int i;
 
        for (i = 0; i < sizeof(src->attrs) / sizeof(src->attrs[0]); i++) {
        int i;
 
        for (i = 0; i < sizeof(src->attrs) / sizeof(src->attrs[0]); i++) {
@@ -887,7 +884,7 @@ int abc_css_merge(abc_html_t* html, abc_obj_t* css)
        return 0;
 }
 
        return 0;
 }
 
-static abc_obj_t* __css_filter_pse(abc_obj_t* current, abc_obj_t* pse)
+static abc_obj_t* __css_filter_pse(abc_obj_t* current, abc_attr_t* pse)
 {
        scf_list_t*  l;
        abc_obj_t*   parent = current->parent;
 {
        scf_list_t*  l;
        abc_obj_t*   parent = current->parent;
@@ -918,7 +915,7 @@ static abc_obj_t* __css_select_by_key(abc_obj_t* css, abc_obj_t* current, scf_ve
 {
        scf_list_t*  l;
        abc_obj_t*   tmp;
 {
        scf_list_t*  l;
        abc_obj_t*   tmp;
-       abc_obj_t*   pse;
+       abc_attr_t*  pse;
        pse_link_t*  pseLink;
 
        assert(next >= 0 && next < vec->size);
        pse_link_t*  pseLink;
 
        assert(next >= 0 && next < vec->size);
@@ -1026,8 +1023,8 @@ static abc_obj_t* __css_select_by_attr(abc_obj_t* css, abc_obj_t* current, scf_v
 {
        scf_list_t*  l;
        abc_obj_t*   tmp;
 {
        scf_list_t*  l;
        abc_obj_t*   tmp;
-       abc_obj_t*   attr;
-       abc_obj_t*   pse;
+       abc_attr_t*  attr;
+       abc_attr_t*  pse;
        pse_link_t*  pseLink;
 
        assert(next >= 0 && next < vec->size);
        pse_link_t*  pseLink;
 
        assert(next >= 0 && next < vec->size);
@@ -1239,41 +1236,44 @@ int abc_css_use(abc_html_t* html, abc_obj_t* obj)
        if (!html || !obj)
                return -EINVAL;
 
        if (!html || !obj)
                return -EINVAL;
 
-       if (!html->css)
-               return 0;
-
        scf_list_t*  l;
        scf_list_t*  l;
+       abc_attr_t*  attr;
        abc_obj_t*   css;
        abc_obj_t*   css;
-       abc_obj_t*   attr;
 
 
-       for (l  = scf_list_head(&html->css->childs); l != scf_list_sentinel(&html->css->childs); l = scf_list_next(l)) {
-               css = scf_list_data(l, abc_obj_t, list);
+       if (html->css) {
+               for (l  = scf_list_head(&html->css->childs); l != scf_list_sentinel(&html->css->childs); l = scf_list_next(l)) {
+                       css = scf_list_data(l, abc_obj_t, list);
 
 
-               switch (css->type)
-               {
-                       case ABC_CSS_ID:
-                       case ABC_CSS_CLASS:
-                       case ABC_CSS_PSE_CLASS:
-                       case ABC_CSS_PSE_ELEMENT:
-                       case ABC_CSS_COMBINATOR:
-                               __css_use_complex(css, obj);
-                               break;
+                       switch (css->type)
+                       {
+                               case ABC_CSS_ID:
+                               case ABC_CSS_CLASS:
+                               case ABC_CSS_PSE_CLASS:
+                               case ABC_CSS_PSE_ELEMENT:
+                               case ABC_CSS_COMBINATOR:
+                                       __css_use_complex(css, obj);
+                                       break;
 
 
-                       default:
-                               if (css->type == obj->type)
-                                       abc_obj_set_css(obj, css);
-                               break;
-               };
+                               default:
+                                       if (css->type == obj->type)
+                                               abc_obj_set_css(obj, css);
+                                       break;
+                       };
+               }
        }
 
        // for inline css below
        }
 
        // for inline css below
-       css = abc_obj_get_attr(obj, ABC_HTML_ATTR_STYLE);
+       attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_STYLE);
 
 
-       if (css && css->value && css->value->len > 0)
+       if (attr && attr->value && attr->value->len > 0)
        {
                html_label_t*  label = __html_find_label2(obj->type);
                abc_io_t*      io    = abc_io_array[ABC_PROTO_STR];
 
        {
                html_label_t*  label = __html_find_label2(obj->type);
                abc_io_t*      io    = abc_io_array[ABC_PROTO_STR];
 
+               css = abc_obj_alloc(obj->file, obj->line, obj->pos, ABC_HTML_STYLE);
+               if (!css)
+                       return -ENOMEM;
+
                css->io.proto = io->proto;
                css->io.priv  = NULL;
                css->io.open  = io->open;
                css->io.proto = io->proto;
                css->io.priv  = NULL;
                css->io.open  = io->open;
@@ -1284,14 +1284,18 @@ int abc_css_use(abc_html_t* html, abc_obj_t* obj)
                css->text_line = 1;
                css->text_pos  = 0;
 
                css->text_line = 1;
                css->text_pos  = 0;
 
-               int ret = io->open(&css->io, css->value->data);
-               if (ret < 0)
+               int ret = io->open(&css->io, attr->value->data);
+               if (ret < 0) {
+                       abc_obj_free(css);
                        return ret;
                        return ret;
+               }
 
                ret = __css_parse_attr(css, css, label->attrs, label->n_attrs);
                io->close(&css->io);
 
                ret = __css_parse_attr(css, css, label->attrs, label->n_attrs);
                io->close(&css->io);
-               if (ret < 0 && EOF != ret)
+               if (ret < 0 && EOF != ret) {
+                       abc_obj_free(css);
                        return ret;
                        return ret;
+               }
 
                int i;
                for (i   = 0; i < sizeof(css->attrs) / sizeof(css->attrs[0]); i++) {
 
                int i;
                for (i   = 0; i < sizeof(css->attrs) / sizeof(css->attrs[0]); i++) {
@@ -1300,10 +1304,9 @@ int abc_css_use(abc_html_t* html, abc_obj_t* obj)
                                continue;
 
                        __css_set_attr(obj, attr);
                                continue;
 
                        __css_set_attr(obj, attr);
-
-                       abc_obj_free(attr);
-                       css->attrs[i] = NULL;
                }
                }
+
+               abc_obj_free(css);
        }
 
        return 0;
        }
 
        return 0;
@@ -1311,7 +1314,7 @@ int abc_css_use(abc_html_t* html, abc_obj_t* obj)
 
 void abc_obj_set_css(abc_obj_t* obj, abc_obj_t* css)
 {
 
 void abc_obj_set_css(abc_obj_t* obj, abc_obj_t* css)
 {
-       abc_obj_t*  attr;
+       abc_attr_t*  attr;
        int i;
 
        for (i   = 0; i < sizeof(css->attrs) / sizeof(css->attrs[0]); i++) {
        int i;
 
        for (i   = 0; i < sizeof(css->attrs) / sizeof(css->attrs[0]); i++) {
index ab68fb420b9d7503e348b854dc70760a81e59608..00f836c1d4dae3696e65e6926389db807c0d3c20 100644 (file)
@@ -141,7 +141,7 @@ int abc_css_margin(abc_obj_t* obj)
        double g = 0.0;
        double b = 0.0;
 
        double g = 0.0;
        double b = 0.0;
 
-       abc_obj_t* attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_MARGIN);
+       abc_attr_t* attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_MARGIN);
        if (attr)
                margin = atoi(attr->value->data);
 
        if (attr)
                margin = atoi(attr->value->data);
 
index 2a4f47949beb4ecfd071a7b6bde350e44ac4288d..26e650d44921655e6f87eb03dae36defe0c42eb6 100644 (file)
@@ -71,7 +71,7 @@ next:
 
 int abc_css_width(abc_obj_t* obj, int width,  int margin)
 {
 
 int abc_css_width(abc_obj_t* obj, int width,  int margin)
 {
-       abc_obj_t* attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_WIDTH);
+       abc_attr_t* attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_WIDTH);
 
        if (attr && attr->value && attr->value->len > 0) {
 
 
        if (attr && attr->value && attr->value->len > 0) {
 
@@ -89,7 +89,7 @@ int abc_css_width(abc_obj_t* obj, int width,  int margin)
 
 int abc_css_height(abc_obj_t* obj, int height, int margin)
 {
 
 int abc_css_height(abc_obj_t* obj, int height, int margin)
 {
-       abc_obj_t* attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_HEIGHT);
+       abc_attr_t* attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_HEIGHT);
 
        if (attr && attr->value && attr->value->len > 0) {
 
 
        if (attr && attr->value && attr->value->len > 0) {
 
index 0c06da7c0b67d403b2b367e02150005c6bc674ff..f3dc5eadbc5f399dbfb6000902db584355c868b5 100644 (file)
@@ -150,6 +150,17 @@ int abc_css_overflow(const uint8_t* str)
        return ABC_OVERFLOW_VISIBLE;
 }
 
        return ABC_OVERFLOW_VISIBLE;
 }
 
+int abc_css_scrollbar_width(const uint8_t* str)
+{
+       if (!__html_strcmp(str, "thin") || !__html_strcmp(str, "auto"))
+               return 15;
+
+       else if (!__html_strcmp(str, "none"))
+               return 0;
+
+       return atoi(str);
+}
+
 void abc_overflow_show(int* x, int* y, int* w, int* h, int mask_x, int mask_y, int mask_w, int mask_h)
 {
 #define CSS_OVERFLOW_SHOW(px, pw, x2, x3) \
 void abc_overflow_show(int* x, int* y, int* w, int* h, int mask_x, int mask_y, int mask_w, int mask_h)
 {
 #define CSS_OVERFLOW_SHOW(px, pw, x2, x3) \
index f10fb090c4d2985c76cedfab461aaf99916a8ead..ca596fe24d12cbda1d8ca81b0316bd2744ae34ae 100644 (file)
@@ -563,23 +563,23 @@ int __html_add_attr(abc_obj_t* obj, int type, char** names, const char* value, i
        if (type < ABC_HTML_ATTR_ID || type >= ABC_HTML_CSS_NB)
                return -EINVAL;
 
        if (type < ABC_HTML_ATTR_ID || type >= ABC_HTML_CSS_NB)
                return -EINVAL;
 
-       abc_obj_t* attr = abc_obj_alloc(NULL, 0, 0, type);
+       abc_attr_t* attr = calloc(1, sizeof(abc_attr_t));
        if (!attr)
                return -ENOMEM;
 
        if (!attr)
                return -ENOMEM;
 
-       attr->keys = names;
-
        attr->value = scf_string_cstr(value);
        if (!attr->value) {
        attr->value = scf_string_cstr(value);
        if (!attr->value) {
-               abc_obj_free(attr);
+               free(attr);
                return -ENOMEM;
        }
 
                return -ENOMEM;
        }
 
+       attr->type  = type;
+       attr->keys  = names;
        attr->flags = flags;
 
        int i = type - ABC_HTML_ATTR_ID;
        if (obj->attrs[i])
        attr->flags = flags;
 
        int i = type - ABC_HTML_ATTR_ID;
        if (obj->attrs[i])
-               abc_obj_free(obj->attrs[i]);
+               abc_attr_free(obj->attrs[i]);
 
        obj->attrs[i] = attr;
        return 0;
 
        obj->attrs[i] = attr;
        return 0;
@@ -618,9 +618,8 @@ static int __html_add_controls(abc_obj_t* obj)
 
 static int __html_load_attrs(abc_obj_t* obj, html_attr_t* attrs, int n_attrs)
 {
 
 static int __html_load_attrs(abc_obj_t* obj, html_attr_t* attrs, int n_attrs)
 {
-       scf_list_t* l;
-       abc_obj_t*  attr;
-
+       scf_list_t*  l;
+       abc_attr_t*  attr;
        int ret;
        int i;
 
        int ret;
        int i;
 
@@ -656,7 +655,7 @@ int abc_html_post(abc_html_t** pp, abc_html_t* form, abc_obj_t* submit)
        scf_string_t* url;
        scf_string_t* content;
        abc_html_t*   html;
        scf_string_t* url;
        scf_string_t* content;
        abc_html_t*   html;
-       abc_obj_t*    action;
+       abc_attr_t*   action;
        abc_io_t*     io;
        int n;
 
        abc_io_t*     io;
        int n;
 
@@ -972,7 +971,7 @@ static int __html_parse_text(abc_html_t* html, abc_obj_t* obj)
        return __html_parse_end(html, obj);
 }
 
        return __html_parse_end(html, obj);
 }
 
-static int __html_parse_value(abc_html_t* html, abc_obj_t* attr)
+static int __html_parse_value(abc_html_t* html, abc_attr_t* attr)
 {
        scf_string_t* value = scf_string_alloc();
        if (!value)
 {
        scf_string_t* value = scf_string_alloc();
        if (!value)
@@ -1082,7 +1081,7 @@ static int __html_parse_attr2(abc_html_t* html, abc_obj_t* obj, const html_attr_
        free(c);
        c = NULL;
 
        free(c);
        c = NULL;
 
-       abc_obj_t*  attr;
+       abc_attr_t*  attr;
        int i;
        int j;
 
        int i;
        int j;
 
@@ -1108,15 +1107,6 @@ found:
        scf_string_free(key);
        key = NULL;
 
        scf_string_free(key);
        key = NULL;
 
-       assert(!attr->file);
-
-       attr->file = scf_string_clone(html->file);
-       if (!attr->file)
-               return -ENOMEM;
-
-       attr->line = html->n_lines;
-       attr->pos  = html->pos;
-
        return __html_parse_value(html, attr);
 }
 
        return __html_parse_value(html, attr);
 }
 
@@ -1289,11 +1279,10 @@ static int __html_run_js(abc_html_t* html, abc_obj_t* obj)
 
 static int __html_parse_obj(abc_html_t* html, abc_char_t* c)
 {
 
 static int __html_parse_obj(abc_html_t* html, abc_char_t* c)
 {
-       html_label_t* label;
-       abc_obj_t*    obj;
-       abc_obj_t*    type;
-
-       scf_string_t* key = scf_string_cstr_len(c->utf8, c->len);
+       html_label_t*  label;
+       abc_obj_t*     obj;
+       abc_attr_t*    type;
+       scf_string_t*  key = scf_string_cstr_len(c->utf8, c->len);
 
        html->pos += c->len;
        free(c);
 
        html->pos += c->len;
        free(c);
index 4180674294efac3a8fa3a5d2027571deb8a4da3d..be8c1ba6b2821f5a6672ddaee4a98945c7e22c58 100644 (file)
@@ -68,6 +68,9 @@ int  abc_css_height(abc_obj_t* obj, int height, int margin);
 int  abc_css_position(const uint8_t* str);
 int  abc_css_overflow(const uint8_t* str);
 
 int  abc_css_position(const uint8_t* str);
 int  abc_css_overflow(const uint8_t* str);
 
+int  abc_css_scrollbar_width(const uint8_t* str);
+int  abc_css_scrollbar_color(double thumb[3], double track[3], const uint8_t* str);
+
 void abc_overflow_show(int* x, int* y, int* w, int* h, int mask_x, int mask_y, int mask_w, int mask_h);
 
 #endif
 void abc_overflow_show(int* x, int* y, int* w, int* h, int mask_x, int mask_y, int mask_w, int mask_h);
 
 #endif
index ea0c89a61c323b110ebaaf98b522b93827e46600..3a27037a44cf63ff797a8d80e4bbe04dfc144b0c 100644 (file)
@@ -55,6 +55,11 @@ void abc_obj_free(abc_obj_t* obj)
                if (obj->av_filter)
                        abc_filter_close(obj->av_filter, 0);
 #endif
                if (obj->av_filter)
                        abc_filter_close(obj->av_filter, 0);
 #endif
+               int i;
+               for (i   = 0; i < sizeof(obj->attrs) / sizeof(obj->attrs[0]); i++) {
+                       if (obj->attrs[i])
+                               abc_attr_free(obj->attrs[i]);
+               }
 
                scf_list_clear(&obj->childs,        abc_obj_t,  list, abc_obj_free);
                scf_list_clear(&obj->css_pse_rules, abc_obj_t,  list, abc_obj_free);
 
                scf_list_clear(&obj->childs,        abc_obj_t,  list, abc_obj_free);
                scf_list_clear(&obj->css_pse_rules, abc_obj_t,  list, abc_obj_free);
@@ -64,6 +69,16 @@ void abc_obj_free(abc_obj_t* obj)
        }
 }
 
        }
 }
 
+void abc_attr_free(abc_attr_t* attr)
+{
+       if (attr) {
+               if (attr->value)
+                       scf_string_free(attr->value);
+
+               free(attr);
+       }
+}
+
 void abc_dfs_update_xy(abc_obj_t* root, int dx, int dy)
 {
        scf_list_t*  l;
 void abc_dfs_update_xy(abc_obj_t* root, int dx, int dy)
 {
        scf_list_t*  l;
@@ -122,6 +137,17 @@ abc_obj_t* abc_obj_find_type(abc_obj_t* root, int type)
        return NULL;
 }
 
        return NULL;
 }
 
+int abc_attr_cmp_keys(abc_attr_t* attr, const char* name, size_t len)
+{
+       int i;
+       for (i = 0; attr->keys[i]; i++) {
+
+               if (!__html_strncmp(attr->keys[i], name, len))
+                       return 0;
+       }
+       return -1;
+}
+
 int abc_obj_cmp_keys(abc_obj_t* obj, const char* name, size_t len)
 {
        int i;
 int abc_obj_cmp_keys(abc_obj_t* obj, const char* name, size_t len)
 {
        int i;
@@ -135,8 +161,8 @@ int abc_obj_cmp_keys(abc_obj_t* obj, const char* name, size_t len)
 
 int abc_obj_copy_attrs(abc_obj_t* dst, abc_obj_t* src)
 {
 
 int abc_obj_copy_attrs(abc_obj_t* dst, abc_obj_t* src)
 {
-       abc_obj_t*  attr;
-       abc_obj_t*  copy;
+       abc_attr_t*  attr;
+       abc_attr_t*  copy;
        int i;
 
        for (i   = 0; i < sizeof(src->attrs) / sizeof(src->attrs[0]); i++) {
        int i;
 
        for (i   = 0; i < sizeof(src->attrs) / sizeof(src->attrs[0]); i++) {
@@ -144,21 +170,22 @@ int abc_obj_copy_attrs(abc_obj_t* dst, abc_obj_t* src)
                if (!attr)
                        continue;
 
                if (!attr)
                        continue;
 
-               copy = abc_obj_alloc(attr->file, attr->line, attr->pos, attr->type);
+               copy = calloc(1, sizeof(abc_attr_t));
                if (!copy)
                        return -ENOMEM;
 
                copy->value = scf_string_clone(attr->value);
                if (!copy->value) {
                if (!copy)
                        return -ENOMEM;
 
                copy->value = scf_string_clone(attr->value);
                if (!copy->value) {
-                       abc_obj_free(copy);
+                       abc_attr_free(copy);
                        return -ENOMEM;
                }
 
                        return -ENOMEM;
                }
 
+               copy->type  = attr->type;
                copy->keys  = attr->keys;
                copy->flags = attr->flags;
 
                if (dst->attrs[i])
                copy->keys  = attr->keys;
                copy->flags = attr->flags;
 
                if (dst->attrs[i])
-                       abc_obj_free(dst->attrs[i]);
+                       abc_attr_free(dst->attrs[i]);
 
                dst->attrs[i] = copy;
        }
 
                dst->attrs[i] = copy;
        }
@@ -169,7 +196,7 @@ int abc_obj_copy_attrs(abc_obj_t* dst, abc_obj_t* src)
 int abc_obj_set_attr(abc_obj_t* obj, int key, const char* value, size_t len)
 {
        scf_string_t* s;
 int abc_obj_set_attr(abc_obj_t* obj, int key, const char* value, size_t len)
 {
        scf_string_t* s;
-       abc_obj_t*    attr;
+       abc_attr_t*   attr;
 
        if (key < ABC_HTML_ATTR_ID || key >= ABC_HTML_CSS_NB)
                return -EINVAL;
 
        if (key < ABC_HTML_ATTR_ID || key >= ABC_HTML_CSS_NB)
                return -EINVAL;
@@ -187,27 +214,23 @@ int abc_obj_set_attr(abc_obj_t* obj, int key, const char* value, size_t len)
        return 0;
 }
 
        return 0;
 }
 
-abc_obj_t* abc_obj_get_attr2(abc_obj_t* obj, const char* key, int len)
+abc_attr_t* abc_obj_get_attr2(abc_obj_t* obj, const char* key, int len)
 {
 {
-       abc_obj_t*  attr;
        int i;
        int i;
-
        for (i   = 0; i < sizeof(obj->attrs) / sizeof(obj->attrs[0]); i++) {
        for (i   = 0; i < sizeof(obj->attrs) / sizeof(obj->attrs[0]); i++) {
-               attr = obj->attrs[i];
+               abc_attr_t* attr =   obj->attrs[i];
 
 
-               if (attr && !abc_obj_cmp_keys(attr, key, len))
+               if (attr && !abc_attr_cmp_keys(attr, key, len))
                        return attr;
        }
 
        return NULL;
 }
 
                        return attr;
        }
 
        return NULL;
 }
 
-abc_obj_t* abc_obj_find_attr(abc_obj_t* obj, int key)
+abc_attr_t* abc_obj_find_attr(abc_obj_t* obj, int key)
 {
 {
-       abc_obj_t* attr;
-
        while (obj) {
        while (obj) {
-               attr = abc_obj_get_attr(obj, key);
+               abc_attr_t* attr = abc_obj_get_attr(obj, key);
 
                if (attr && attr->value && attr->value->len > 0)
                        return attr;
 
                if (attr && attr->value && attr->value->len > 0)
                        return attr;
@@ -231,8 +254,8 @@ void abc_css_print(abc_obj_t* obj)
        else if (obj->keys)
                printf("%s ", obj->keys[0]);
 
        else if (obj->keys)
                printf("%s ", obj->keys[0]);
 
-       pse_link_t* pseLink;
-       abc_obj_t*  attr;
+       pse_link_t*  pseLink;
+       abc_attr_t*  attr;
        int i;
 
        printf("{\n");
        int i;
 
        printf("{\n");
@@ -259,11 +282,22 @@ void abc_css_print(abc_obj_t* obj)
        printf("}\n");
 }
 
        printf("}\n");
 }
 
+void abc_attr_print(abc_attr_t* attr)
+{
+       if (attr && attr->value && attr->value->len > 0)
+       {
+               if (!(ABC_HTML_FLAG_SHOW & attr->flags))
+                       return;
+
+               printf(" %s=\"%s\"", attr->keys[0], attr->value->data);
+       }
+}
+
 void abc_obj_print(abc_obj_t* obj)
 {
 void abc_obj_print(abc_obj_t* obj)
 {
-       scf_list_t*   l;
-       abc_obj_t*    attr;
-       abc_obj_t*    child;
+       scf_list_t*  l;
+       abc_attr_t*  attr;
+       abc_obj_t*   child;
 
        if (!obj)
                return;
 
        if (!obj)
                return;
@@ -271,10 +305,7 @@ void abc_obj_print(abc_obj_t* obj)
        if (!(ABC_HTML_FLAG_SHOW & obj->flags))
                return;
 
        if (!(ABC_HTML_FLAG_SHOW & obj->flags))
                return;
 
-       if (obj->value) {
-               if (obj->value->len > 0)
-                       printf(" %s=\"%s\"", obj->keys[0], obj->value->data);
-       } else if (obj->keys)
+       if (obj->keys)
                printf("<%s", obj->keys[0]);
 
        int i;
                printf("<%s", obj->keys[0]);
 
        int i;
@@ -284,15 +315,13 @@ void abc_obj_print(abc_obj_t* obj)
                        continue;
 
                if (ABC_HTML_FLAG_SHOW & attr->flags)
                        continue;
 
                if (ABC_HTML_FLAG_SHOW & attr->flags)
-                       abc_obj_print(attr);
+                       abc_attr_print(attr);
        }
 
        }
 
-       if (!obj->value) {
-               if (obj->flags & ABC_HTML_FLAG_SINGLE)
-                       printf(" />\n");
-               else if (obj->keys)
-                       printf(">\n");
-       }
+       if (obj->flags & ABC_HTML_FLAG_SINGLE)
+               printf(" />\n");
+       else if (obj->keys)
+               printf(">\n");
 
        if (obj->text)
                printf("%s\n", obj->text->data);
 
        if (obj->text)
                printf("%s\n", obj->text->data);
@@ -329,42 +358,47 @@ void abc_obj_print(abc_obj_t* obj)
        }
 }
 
        }
 }
 
-static int __abc_obj_to_string(abc_obj_t* obj, scf_string_t* s)
+static int __abc_attr_to_string(abc_attr_t* attr, scf_string_t* s)
 {
 {
-       scf_list_t*   l;
-       abc_obj_t*    attr;
-       abc_obj_t*    child;
-
-       int ret;
-
-       if (!obj)
+       if (!attr || !attr->value)
                return 0;
 
                return 0;
 
-       if (!(ABC_HTML_FLAG_SHOW & obj->flags))
+       if (!(ABC_HTML_FLAG_SHOW & attr->flags))
                return 0;
 
                return 0;
 
-       if (obj->value) {
-               ret = scf_string_cat_cstr(s, " ");
-               if (ret < 0)
-                       return ret;
+       int ret = scf_string_cat_cstr(s, " ");
+       if (ret < 0)
+               return ret;
 
 
-               ret = scf_string_cat_cstr(s, obj->keys[0]);
-               if (ret < 0)
-                       return ret;
+       ret = scf_string_cat_cstr(s, attr->keys[0]);
+       if (ret < 0)
+               return ret;
 
 
-               ret = scf_string_cat_cstr(s, "=\"");
-               if (ret < 0)
-                       return ret;
+       ret = scf_string_cat_cstr(s, "=\"");
+       if (ret < 0)
+               return ret;
 
 
-               ret = scf_string_cat(s, obj->value);
-               if (ret < 0)
-                       return ret;
+       ret = scf_string_cat(s, attr->value);
+       if (ret < 0)
+               return ret;
 
 
-               ret = scf_string_cat_cstr(s, "\"");
-               if (ret < 0)
-                       return ret;
+       return scf_string_cat_cstr(s, "\"");
+}
 
 
-       } else if (obj->keys) {
+static int __abc_obj_to_string(abc_obj_t* obj, scf_string_t* s)
+{
+       scf_list_t*  l;
+       abc_attr_t*  attr;
+       abc_obj_t*   child;
+       int ret;
+
+       if (!obj)
+               return 0;
+
+       if (!(ABC_HTML_FLAG_SHOW & obj->flags))
+               return 0;
+
+       if (obj->keys) {
                ret = scf_string_cat_cstr(s, "<");
                if (ret < 0)
                        return ret;
                ret = scf_string_cat_cstr(s, "<");
                if (ret < 0)
                        return ret;
@@ -381,24 +415,22 @@ static int __abc_obj_to_string(abc_obj_t* obj, scf_string_t* s)
                        continue;
 
                if (ABC_HTML_FLAG_SHOW & attr->flags) {
                        continue;
 
                if (ABC_HTML_FLAG_SHOW & attr->flags) {
-                       ret = __abc_obj_to_string(attr, s);
+                       ret = __abc_attr_to_string(attr, s);
                        if (ret < 0)
                                return ret;
                }
        }
 
                        if (ret < 0)
                                return ret;
                }
        }
 
-       if (!obj->value) {
-               if (obj->flags & ABC_HTML_FLAG_SINGLE) {
+       if (obj->flags & ABC_HTML_FLAG_SINGLE) {
 
 
-                       ret = scf_string_cat_cstr(s, " />\n");
-                       if (ret < 0)
-                               return ret;
+               ret = scf_string_cat_cstr(s, " />\n");
+               if (ret < 0)
+                       return ret;
 
 
-               } else if (obj->keys) {
-                       ret = scf_string_cat_cstr(s, ">\n");
-                       if (ret < 0)
-                               return ret;
-               }
+       } else if (obj->keys) {
+               ret = scf_string_cat_cstr(s, ">\n");
+               if (ret < 0)
+                       return ret;
        }
 
        if (obj->text) {
        }
 
        if (obj->text) {
@@ -542,7 +574,7 @@ static const char* roman[] = {"m","cm", "d","cd", "c","xc", "l","xl","x","ix","v
 
 scf_string_t* abc_ol_list_style(abc_obj_t* obj, int num)
 {
 
 scf_string_t* abc_ol_list_style(abc_obj_t* obj, int num)
 {
-       abc_obj_t* attr = abc_obj_find_attr(obj, ABC_CSS_LIST_STYLE_TYPE);
+       abc_attr_t* attr = abc_obj_find_attr(obj, ABC_CSS_LIST_STYLE_TYPE);
        if (attr) {
                const char* p = attr->value->data;
 
        if (attr) {
                const char* p = attr->value->data;
 
@@ -561,3 +593,41 @@ scf_string_t* abc_ol_list_style(abc_obj_t* obj, int num)
 
        return __li_style_number(num, 10, '0');
 }
 
        return __li_style_number(num, 10, '0');
 }
+
+static int __obj_scroll_xy(int* position, int move, int thumb, int track, int content_out)
+{
+       int range = track - thumb;
+       int min   = thumb / 2;
+       int max   = track - min;
+
+       if (*position < min)
+               *position = min;
+       if (*position > max)
+               *position = max;
+
+       if (move < min - *position)
+               move = min - *position;
+       if (move > max - *position)
+               move = max - *position;
+
+       assert(move >= -range && move <= range);
+
+       *position += move;
+
+       int diff = -(*position - min) * content_out / range;
+       return diff;
+}
+
+int abc_obj_scroll_y(abc_obj_t* obj, int thumb, int track, int move)
+{
+       int content_out = obj->content_h - obj->h;
+
+       return __obj_scroll_xy(&obj->scroll_y, move, thumb, track, content_out);
+}
+
+int abc_obj_scroll_x(abc_obj_t* obj, int thumb, int track, int move)
+{
+       int content_out = obj->content_w - obj->w;
+
+       return __obj_scroll_xy(&obj->scroll_x, move, thumb, track, content_out);
+}
index f2d57150036e861d5be5d948bb954cc9bdea4a5a..591bf932a6420069a1afcd2b68a996d5aab3a3ef 100644 (file)
@@ -7,6 +7,7 @@
 #include"abc_io.h"
 
 typedef struct abc_obj_s    abc_obj_t;
 #include"abc_io.h"
 
 typedef struct abc_obj_s    abc_obj_t;
+typedef struct abc_attr_s   abc_attr_t;
 typedef struct abc_text_s   abc_text_t;
 typedef struct pse_link_s   pse_link_t;
 
 typedef struct abc_text_s   abc_text_t;
 typedef struct pse_link_s   pse_link_t;
 
@@ -223,6 +224,17 @@ struct pse_link_s
 #define ABC_HTML_FLAG_SINGLE 2
 #define ABC_HTML_FLAG_SHOW   4
 
 #define ABC_HTML_FLAG_SINGLE 2
 #define ABC_HTML_FLAG_SHOW   4
 
+struct abc_attr_s
+{
+       int             type;
+       uint32_t        flags;
+
+       char**          keys;
+       scf_string_t*   value;
+
+       abc_obj_t*      parent;
+};
+
 struct abc_obj_s
 {
        int             type;
 struct abc_obj_s
 {
        int             type;
@@ -238,7 +250,7 @@ struct abc_obj_s
        int             n_childs;
        int             index;
 
        int             n_childs;
        int             index;
 
-       abc_obj_t*      attrs[ABC_HTML_CSS_NB - ABC_HTML_ATTR_ID];
+       abc_attr_t*     attrs[ABC_HTML_CSS_NB - ABC_HTML_ATTR_ID];
 
        void*           gtk_builder;
        abc_filter_t*   av_filter;
 
        void*           gtk_builder;
        abc_filter_t*   av_filter;
@@ -309,6 +321,8 @@ struct abc_obj_s
 
 abc_obj_t*     abc_obj_alloc(scf_string_t* file, int line, int pos, int type);
 void           abc_obj_free (abc_obj_t*    obj);
 
 abc_obj_t*     abc_obj_alloc(scf_string_t* file, int line, int pos, int type);
 void           abc_obj_free (abc_obj_t*    obj);
+void           abc_attr_free(abc_attr_t*   attr);
+
 abc_obj_t*     abc_obj_find (abc_obj_t*    root, int x, int y);
 void           abc_obj_print(abc_obj_t*    obj);
 
 abc_obj_t*     abc_obj_find (abc_obj_t*    root, int x, int y);
 void           abc_obj_print(abc_obj_t*    obj);
 
@@ -318,18 +332,20 @@ int            abc_obj_copy_attrs(abc_obj_t* dst, abc_obj_t*  src);
 void           abc_obj_set_css  (abc_obj_t* obj, abc_obj_t* css);
 int            abc_obj_set_attr (abc_obj_t* obj, int key, const char* value, size_t len);
 
 void           abc_obj_set_css  (abc_obj_t* obj, abc_obj_t* css);
 int            abc_obj_set_attr (abc_obj_t* obj, int key, const char* value, size_t len);
 
-abc_obj_t*     abc_obj_get_attr2(abc_obj_t* obj, const char* key, int len);
-abc_obj_t*     abc_obj_find_attr(abc_obj_t* obj, int key);
+abc_attr_t*    abc_obj_get_attr2(abc_obj_t* obj, const char* key, int len);
+abc_attr_t*    abc_obj_find_attr(abc_obj_t* obj, int key);
 
 abc_obj_t*     abc_obj_find_type(abc_obj_t* root, int type);
 
 
 abc_obj_t*     abc_obj_find_type(abc_obj_t* root, int type);
 
-void           abc_dfs_update_xy(abc_obj_t* root, int dx, int dy);
+void           abc_dfs_update_xy(abc_obj_t* root, int dx,    int dy);
+int            abc_obj_scroll_y (abc_obj_t* obj,  int thumb, int track, int move);
+int            abc_obj_scroll_x (abc_obj_t* obj,  int thumb, int track, int move);
 
 scf_string_t*  abc_obj_to_string(abc_obj_t* obj);
 
 scf_string_t*  abc_ol_list_style(abc_obj_t* obj, int num);
 
 
 scf_string_t*  abc_obj_to_string(abc_obj_t* obj);
 
 scf_string_t*  abc_ol_list_style(abc_obj_t* obj, int num);
 
-static inline abc_obj_t* abc_obj_get_attr(abc_obj_t* obj, int key)
+static inline abc_attr_t* abc_obj_get_attr(abc_obj_t* obj, int key)
 {
        if (key < ABC_HTML_ATTR_ID || key >= ABC_HTML_CSS_NB)
                return NULL;
 {
        if (key < ABC_HTML_ATTR_ID || key >= ABC_HTML_CSS_NB)
                return NULL;
index eab0589e7921d0635ecc34215715d3c37fa5bdcb..ba0325b952bfd72748cfa436cc983a86be11c155 100644 (file)
@@ -61,7 +61,7 @@ static int __render_fini_bg_image(abc_render_t* render)
 
 static int __render_draw_bg_image(abc_render_t* render, abc_obj_t* obj, int width, int height)
 {
 
 static int __render_draw_bg_image(abc_render_t* render, abc_obj_t* obj, int width, int height)
 {
-       abc_obj_t* attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_BG_IMAGE);
+       abc_attr_t* attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_BG_IMAGE);
        if (!attr)
                return 0;
        if (!attr->value || attr->value->len <= 0)
        if (!attr)
                return 0;
        if (!attr->value || attr->value->len <= 0)
index 125d9d852424c4b15a9dfa323f337a7d027cd4e0..25404c3441cfb9e11310160bf3808128e8fd43c2 100644 (file)
@@ -88,6 +88,8 @@ static int __render_fini_border(abc_render_t* render)
 
 static int __render_draw_border(abc_render_t* render, abc_obj_t* obj, int width, int height)
 {
 
 static int __render_draw_border(abc_render_t* render, abc_obj_t* obj, int width, int height)
 {
+       abc_obj_t* parent = obj->parent;
+
        if (0 == program)
                __init_program(&program, vert_shader, frag_shader);
 
        if (0 == program)
                __init_program(&program, vert_shader, frag_shader);
 
@@ -101,9 +103,9 @@ static int __render_draw_border(abc_render_t* render, abc_obj_t* obj, int width,
        double fgColor[3] = {0.0, 0.0, 0.0};
        double bgColor[4] = {0.0, 0.0, 0.0, 0.0};
 
        double fgColor[3] = {0.0, 0.0, 0.0};
        double bgColor[4] = {0.0, 0.0, 0.0, 0.0};
 
-       abc_obj_t* attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_BG_COLOR);
+       abc_attr_t* attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_BG_COLOR);
        if (attr && attr->value->len > 0) {
        if (attr && attr->value->len > 0) {
-               bgColor[4] = 1.0;
+               bgColor[3] = 1.0;
                abc_css_color(bgColor, bgColor + 1, bgColor + 2, attr->value->data, attr->value->len);
        }
 
                abc_css_color(bgColor, bgColor + 1, bgColor + 2, attr->value->data, attr->value->len);
        }
 
@@ -130,35 +132,31 @@ static int __render_draw_border(abc_render_t* render, abc_obj_t* obj, int width,
        obj->view_w = w;
        obj->view_h = h;
 
        obj->view_w = w;
        obj->view_h = h;
 
-       abc_obj_t* parent = obj->parent;
+       attr = abc_obj_find_attr(obj, ABC_CSS_OVERFLOW);
+       if (attr)
+               obj->overflow_type = abc_css_overflow(attr->value->data);
 
 
-       if (parent && (x < parent->view_x
-                               || y < parent->view_y
-                               || x + w > parent->view_x + parent->view_w
-                               || y + h > parent->view_y + parent->view_h)) {
+       int scroll_flag = 0;
+       switch (obj->overflow_type)
+       {
+               case ABC_OVERFLOW_SCROLL:
+               case ABC_OVERFLOW_AUTO:
+                       scroll_flag = 1;
 
 
-               attr = abc_obj_find_attr(obj, ABC_CSS_OVERFLOW);
-               if (attr)
-                       obj->overflow_type = abc_css_overflow(attr->value->data);
+               case ABC_OVERFLOW_HIDDEN:
+                       if (parent && (x < parent->view_x
+                                               || y < parent->view_y
+                                               || x + w > parent->view_x + parent->view_w
+                                               || y + h > parent->view_y + parent->view_h)) {
 
 
-               switch (obj->overflow_type)
-               {
-                       case ABC_OVERFLOW_HIDDEN:
                                abc_overflow_show(&obj->view_x, &obj->view_y, &obj->view_w, &obj->view_h,
                                                parent->view_x,
                                                parent->view_y, parent->view_w, parent->view_h);
                                abc_overflow_show(&obj->view_x, &obj->view_y, &obj->view_w, &obj->view_h,
                                                parent->view_x,
                                                parent->view_y, parent->view_w, parent->view_h);
-
-                               scf_logw("x: %d, y: %d, w: %d, h: %d, obj: x: %d, y: %d, w: %d, h: %d, parent: x: %d, y: %d, w: %d, h: %d\n",
-                                               x, y, w, h,
-                                               obj->view_x,    obj->view_y,    obj->view_w,    obj->view_h,
-                                               parent->view_x, parent->view_y, parent->view_w, parent->view_h);
-                               break;
-                       case ABC_OVERFLOW_SCROLL:
-                               break;
-                       default:
-                               break;
-               };
-       }
+                       }
+                       break;
+               default:
+                       break;
+       };
 
        float mvp[16];
        __compute_mvp(mvp, 0, 0, 0);
 
        float mvp[16];
        __compute_mvp(mvp, 0, 0, 0);
@@ -196,13 +194,6 @@ static int __render_draw_border(abc_render_t* render, abc_obj_t* obj, int width,
        GLfloat x_border = border / (float)w;
        GLfloat y_border = border / (float)h;
 
        GLfloat x_border = border / (float)w;
        GLfloat y_border = border / (float)h;
 
-       if (ABC_OVERFLOW_HIDDEN == obj->overflow_type) {
-               for (int i = 0; i < sizeof(texture_update) / sizeof(texture_update[0]) / 2; i++)
-                       scf_logi("%lg, %lg\n", texture_update[2 * i], texture_update[2 * i + 1]);
-
-               printf(" x_border: %lg, y_border: %lg\n\n", x_border, y_border);
-       }
-
        GLfloat aspect   = w / (float)h;
        GLfloat w_scroll = 0.0;
        GLfloat scroll_y = 0.0;
        GLfloat aspect   = w / (float)h;
        GLfloat w_scroll = 0.0;
        GLfloat scroll_y = 0.0;
@@ -211,25 +202,8 @@ static int __render_draw_border(abc_render_t* render, abc_obj_t* obj, int width,
        double thumbColor[4] = {bgColor[0], bgColor[1], bgColor[2], bgColor[3]};
        double trackColor[4] = {bgColor[0], bgColor[1], bgColor[2], bgColor[3]};
 
        double thumbColor[4] = {bgColor[0], bgColor[1], bgColor[2], bgColor[3]};
        double trackColor[4] = {bgColor[0], bgColor[1], bgColor[2], bgColor[3]};
 
-       if (obj->content_h > obj->h)
+       if (obj->content_h > obj->h && scroll_flag)
        {
        {
-               float percent = h / (float)obj->content_h;
-               int   len     = h * percent;
-               int   range   = h - len;
-               int   min     = len / 2;
-               int   max     = h - min;
-
-               if (obj->scroll_y < min)
-                       obj->scroll_y = min;
-               if (obj->scroll_y > max)
-                       obj->scroll_y = max;
-
-               w_scroll = 25.0;
-
-               attr = abc_obj_get_attr(obj, ABC_CSS_SCROLLBAR_WIDTH);
-               if (attr && attr->value->len > 0)
-                       w_scroll = atof(attr->value->data);
-
                attr = abc_obj_get_attr(obj, ABC_CSS_SCROLLBAR_COLOR);
                if (attr && attr->value->len > 0) {
                        thumbColor[3] = 1.0;
                attr = abc_obj_get_attr(obj, ABC_CSS_SCROLLBAR_COLOR);
                if (attr && attr->value->len > 0) {
                        thumbColor[3] = 1.0;
@@ -242,12 +216,22 @@ static int __render_draw_border(abc_render_t* render, abc_obj_t* obj, int width,
                        thumbColor[3] = 1.0;
                }
 
                        thumbColor[3] = 1.0;
                }
 
-               scf_logi("obj mouse_down_x: %d, mouse_down_y: %d, mouse_move_x: %d, mouse_move_y: %d, x: %d, y: %d, x+w: %d, y+h: %d\n",
-                               obj->mouse_down_x,
-                               obj->mouse_down_x, obj->mouse_move_x, obj->mouse_move_y,
-                               x, y, x + w, y + h);
+               w_scroll = 15.0;
+
+               attr = abc_obj_get_attr(obj, ABC_CSS_SCROLLBAR_WIDTH);
+               if (attr && attr->value->len > 0)
+                       w_scroll = abc_css_scrollbar_width(attr->value->data);
 
 
-               int dy = 0;
+               if (w_scroll > h / 2)
+                       w_scroll = h / 2;
+
+               float percent = h / (float)obj->content_h;
+
+               scroll_h = h * percent;
+               if (scroll_h < w_scroll)
+                       scroll_h = w_scroll;
+
+               int move = 0;
                if (obj->mouse_move_x > x + w - w_scroll
                                && obj->mouse_move_x < x + w
                                && obj->mouse_move_y > y
                if (obj->mouse_move_x > x + w - w_scroll
                                && obj->mouse_move_x < x + w
                                && obj->mouse_move_y > y
@@ -258,28 +242,17 @@ static int __render_draw_border(abc_render_t* render, abc_obj_t* obj, int width,
                                        && obj->mouse_down_y > y
                                        && obj->mouse_down_y < y + h) {
 
                                        && obj->mouse_down_y > y
                                        && obj->mouse_down_y < y + h) {
 
-                               dy = obj->mouse_move_y - obj->mouse_down_y;
-                               if (dy < min - obj->scroll_y)
-                                       dy = min - obj->scroll_y;
-                               if (dy > max - obj->scroll_y)
-                                       dy = max - obj->scroll_y;
-
-                               assert(dy >= -range && dy <= range);
-
-                               obj->scroll_y += dy;
+                               move = obj->mouse_move_y - obj->mouse_down_y;
                        }
                }
 
                        }
                }
 
-               dy = -(obj->scroll_y - min) * (obj->content_h - obj->h) / range;
+               int dy = abc_obj_scroll_y(obj, scroll_h, h, move);
 
                abc_dfs_update_xy(obj, 0, dy);
 
 
                abc_dfs_update_xy(obj, 0, dy);
 
-               scroll_h = percent;
-               scroll_y = obj->scroll_y / (float)h;
-
+               scroll_h /= (float)h;
+               scroll_y  = obj->scroll_y / (float)h;
                w_scroll /= (float)w;
                w_scroll /= (float)w;
-               if (w_scroll > scroll_h / aspect)
-                       w_scroll = scroll_h / aspect;
 
                scf_logi("aspect: %lg, w_scroll: %lg, scroll_y: %lg, scroll_h: %lg\n\n", aspect, w_scroll, scroll_y, scroll_h);
        }
 
                scf_logi("aspect: %lg, w_scroll: %lg, scroll_y: %lg, scroll_h: %lg\n\n", aspect, w_scroll, scroll_y, scroll_h);
        }
index ee2514a8b8eda77970c8375b8c37d351aa237a54..bc8d491605ab27dca2ed16d514a0ef43f0c18d1b 100644 (file)
@@ -79,12 +79,12 @@ void __draw_text(cairo_text_extents_t* extents, cairo_t* cr, const char* text, d
 
 int __init_text(cairo_t* cr, abc_obj_t* obj, int num_flag)
 {
 
 int __init_text(cairo_t* cr, abc_obj_t* obj, int num_flag)
 {
-       abc_obj_t* attr = abc_obj_find_attr(obj, ABC_HTML_ATTR_FONT);
+       abc_attr_t* attr = abc_obj_find_attr(obj, ABC_HTML_ATTR_FONT);
        if (attr) {
                int bold   = CAIRO_FONT_WEIGHT_NORMAL;
                int italic = CAIRO_FONT_SLANT_NORMAL;
 
        if (attr) {
                int bold   = CAIRO_FONT_WEIGHT_NORMAL;
                int italic = CAIRO_FONT_SLANT_NORMAL;
 
-               abc_obj_t* style = abc_obj_find_attr(obj, ABC_HTML_ATTR_FONT_STYLE);
+               abc_attr_t* style = abc_obj_find_attr(obj, ABC_HTML_ATTR_FONT_STYLE);
                if (style) {
                        if (!__html_strcmp(style->value->data, "bold"))
                                bold = CAIRO_FONT_WEIGHT_BOLD;
                if (style) {
                        if (!__html_strcmp(style->value->data, "bold"))
                                bold = CAIRO_FONT_WEIGHT_BOLD;
@@ -192,7 +192,7 @@ static int __render_draw_text(abc_render_t* render, abc_obj_t* obj, int width, i
        if (0 == texture_rgba)
                __init_texture(&texture_rgba, GL_RGBA, w, h, NULL);
 
        if (0 == texture_rgba)
                __init_texture(&texture_rgba, GL_RGBA, w, h, NULL);
 
-       abc_obj_t*        attr;
+       abc_attr_t*       attr;
        cairo_surface_t*  surface;
        cairo_t*          cr;
 
        cairo_surface_t*  surface;
        cairo_t*          cr;
 
@@ -233,6 +233,8 @@ static int __render_draw_text(abc_render_t* render, abc_obj_t* obj, int width, i
        switch (obj->overflow_type)
        {
                case ABC_OVERFLOW_HIDDEN:
        switch (obj->overflow_type)
        {
                case ABC_OVERFLOW_HIDDEN:
+               case ABC_OVERFLOW_SCROLL:
+               case ABC_OVERFLOW_AUTO:
                        abc_overflow_show(&view_x, &view_y, &view_w, &view_h,
                                        obj->view_x,
                                        obj->view_y, obj->view_w, obj->view_h);
                        abc_overflow_show(&view_x, &view_y, &view_w, &view_h,
                                        obj->view_x,
                                        obj->view_y, obj->view_w, obj->view_h);
index de78ad1ddc43f6778724443726bf9f16e455f449..5ca21b143051c3a53f2073e83f00a3ac72b32658 100644 (file)
@@ -114,7 +114,7 @@ int abc_layout_obj(abc_layout_t* layout, abc_obj_t* obj, int width, int height)
        do { \
                abc_obj_t* tmp = parent; \
                while (tmp && ABC_HTML != tmp->type) { \
        do { \
                abc_obj_t* tmp = parent; \
                while (tmp && ABC_HTML != tmp->type) { \
-                       abc_obj_t* attr = abc_obj_get_attr(tmp, ABC_CSS_POSITION); \
+                       abc_attr_t* attr = abc_obj_get_attr(tmp, ABC_CSS_POSITION); \
                        \
                        if (attr && attr->value->len > 0 \
                                        && __html_strcmp(attr->value->data, "static")) \
                        \
                        if (attr && attr->value->len > 0 \
                                        && __html_strcmp(attr->value->data, "static")) \
@@ -131,8 +131,8 @@ int abc_layout_obj(abc_layout_t* layout, abc_obj_t* obj, int width, int height)
 
 int abc_layout_css(abc_obj_t* obj)
 {
 
 int abc_layout_css(abc_obj_t* obj)
 {
-       abc_obj_t*  parent = obj->parent;
-       abc_obj_t*  attr;
+       abc_obj_t*   parent = obj->parent;
+       abc_attr_t*  attr;
 
        if (!parent || parent->w <= 0)
                return 0;
 
        if (!parent || parent->w <= 0)
                return 0;
index 6de919bd9df9883e15348529c92ba098f0e0e657..90097add82283bc99f4cea91861a9d581cccd1f6 100644 (file)
@@ -2,7 +2,7 @@
 
 int abc_layout_div(abc_layout_t* layout, abc_obj_t* obj, int width, int height)
 {
 
 int abc_layout_div(abc_layout_t* layout, abc_obj_t* obj, int width, int height)
 {
-       abc_obj_t*            attr;
+       abc_attr_t*           attr;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
index 6023fdb3b28a9f776598620174b778e61f1100a6..0df5f87e69363fc2a3fefcc0144df60b0ab42f6d 100644 (file)
@@ -2,7 +2,7 @@
 
 int abc_layout_form(abc_layout_t* layout, abc_obj_t* obj, int width, int height)
 {
 
 int abc_layout_form(abc_layout_t* layout, abc_obj_t* obj, int width, int height)
 {
-       abc_obj_t*            attr;
+       abc_attr_t*           attr;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
index bcf6f836e84fb2b6ea569f021c77bb4483f7e001..720ce270b46732aa7a7d5cd30dd76e31ad54617a 100644 (file)
@@ -2,8 +2,8 @@
 
 int abc_layout_h1(abc_layout_t* layout, abc_obj_t* obj, int width, int height)
 {
 
 int abc_layout_h1(abc_layout_t* layout, abc_obj_t* obj, int width, int height)
 {
-       abc_obj_t*            attr;
-       abc_obj_t*            style;
+       abc_attr_t*           attr;
+       abc_attr_t*           style;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
index b4fa92b97dd0a24a543f143f6bede28efabe2537..0cd7b6cb874a228a3d68b81a54f0ee904ee0e918 100644 (file)
@@ -2,7 +2,7 @@
 
 int abc_layout_input(abc_layout_t* layout, abc_obj_t* obj, int width, int height)
 {
 
 int abc_layout_input(abc_layout_t* layout, abc_obj_t* obj, int width, int height)
 {
-       abc_obj_t*            attr;
+       abc_attr_t*           attr;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
index 53a51818f62cb38d510f627f1bff266fbcce3119..ba578cd7d261adc221e8bfbdc8e9a1ff5e6becad 100644 (file)
@@ -2,7 +2,7 @@
 
 int abc_layout_label(abc_layout_t* layout, abc_obj_t* obj, int width, int height)
 {
 
 int abc_layout_label(abc_layout_t* layout, abc_obj_t* obj, int width, int height)
 {
-       abc_obj_t*            attr;
+       abc_attr_t*           attr;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
index 23a727e3586ea00b42237c650b5c193dc82a7081..e806594a2fb04817d666b2484e570ff85bf90e43 100644 (file)
@@ -6,7 +6,7 @@ int abc_layout_table(abc_layout_t* layout, abc_obj_t* obj, int width, int height
        scf_list_t*  l2;
        abc_obj_t*   tr;
        abc_obj_t*   td;
        scf_list_t*  l2;
        abc_obj_t*   tr;
        abc_obj_t*   td;
-       abc_obj_t*   attr;
+       abc_attr_t*  attr;
 
        int collapse = 0;
 
 
        int collapse = 0;
 
index 82327ff9d1b2b68b12cf49f29bee87c5e5f95bef..faa808febaa7fefd65c6f20fd2dec46fb61ceeb5 100644 (file)
@@ -3,7 +3,7 @@
 int abc_layout_td(abc_layout_t* layout, abc_obj_t* obj, int width, int height)
 {
        abc_obj_t*            table;
 int abc_layout_td(abc_layout_t* layout, abc_obj_t* obj, int width, int height)
 {
        abc_obj_t*            table;
-       abc_obj_t*            attr;
+       abc_attr_t*           attr;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
index 6640045febd8d72ac12fd864f21241a7cc5724f4..0513c1bddb9c1295e36944c336ca29ef247a8ce4 100644 (file)
@@ -29,8 +29,8 @@ static int __layout_text_split(cairo_text_extents_t* extents, cairo_t* cr, const
 
 int __layout_text(cairo_t* cr, abc_obj_t* obj, int x, int width, cairo_text_extents_t* extents)
 {
 
 int __layout_text(cairo_t* cr, abc_obj_t* obj, int x, int width, cairo_text_extents_t* extents)
 {
-       abc_obj_t*  attr;
-       abc_obj_t*  style;
+       abc_attr_t*  attr;
+       abc_attr_t*  style;
 
        attr = abc_obj_find_attr(obj, ABC_HTML_ATTR_FONT);
        if (attr) {
 
        attr = abc_obj_find_attr(obj, ABC_HTML_ATTR_FONT);
        if (attr) {
@@ -127,7 +127,7 @@ int __layout_text(cairo_t* cr, abc_obj_t* obj, int x, int width, cairo_text_exte
 int abc_layout_text(abc_layout_t* layout, abc_obj_t* obj, int width, int height)
 {
        abc_obj_t*            parent = obj->parent;
 int abc_layout_text(abc_layout_t* layout, abc_obj_t* obj, int width, int height)
 {
        abc_obj_t*            parent = obj->parent;
-       abc_obj_t*            attr;
+       abc_attr_t*           attr;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
index a0f107abf705e69d2413459bc7456a494c8b28db..f46e7b3fce11bb779e485c6484b4b9c2b2adfe92 100644 (file)
@@ -6,7 +6,7 @@ static int __av_filter_init(abc_obj_t* obj)
        abc_avio_t*  avin = NULL;
        abc_avio_t*  vout = NULL;
        abc_avio_t*  aout = NULL;
        abc_avio_t*  avin = NULL;
        abc_avio_t*  vout = NULL;
        abc_avio_t*  aout = NULL;
-       abc_obj_t*   attr;
+       abc_attr_t*  attr;
        abc_obj_t*   src;
 
        int ret = abc_filter_open(&obj->av_filter);
        abc_obj_t*   src;
 
        int ret = abc_filter_open(&obj->av_filter);
@@ -110,7 +110,7 @@ error:
 
 int abc_layout_video(abc_layout_t* layout, abc_obj_t* obj, int width, int height)
 {
 
 int abc_layout_video(abc_layout_t* layout, abc_obj_t* obj, int width, int height)
 {
-       abc_obj_t* attr;
+       abc_attr_t*  attr;
 
        int w = 0;
        int h = 0;
 
        int w = 0;
        int h = 0;
index a10d92755c008b6a0840232ac3b3ffe2becc5b4a..7dff92c4d2a0a6d161531d5e46dedf605f19d514 100644 (file)
@@ -40,7 +40,7 @@ static int _render_fini_a_href(abc_render_t* render)
 
 static int _render_draw_a_href(abc_render_t* render, abc_obj_t* obj, int width, int height)
 {
 
 static int _render_draw_a_href(abc_render_t* render, abc_obj_t* obj, int width, int height)
 {
-       abc_obj_t* attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_HREF);
+       abc_attr_t* attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_HREF);
 
        if (!attr || !attr->value || attr->value->len <= 0) {
                scf_loge("hyper link '%s' not found a URL\n", obj->text->data);
 
        if (!attr || !attr->value || attr->value->len <= 0) {
                scf_loge("hyper link '%s' not found a URL\n", obj->text->data);
index 7fd0394cbc3a6ad91433371f32bf5891603bd5b3..6ba7dce6a6886dae73dfeece40fe439cd9d1e40f 100644 (file)
@@ -41,7 +41,7 @@ static int _render_fini_audio(abc_render_t* render)
 
 static int _render_draw_audio(abc_render_t* render, abc_obj_t* obj, int width, int height)
 {
 
 static int _render_draw_audio(abc_render_t* render, abc_obj_t* obj, int width, int height)
 {
-       abc_obj_t* attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_SRC);
+       abc_attr_t* attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_SRC);
        if (!attr) {
                scf_loge("src audio of '%s' not found\n", obj->keys[0]);
                return -EINVAL;
        if (!attr) {
                scf_loge("src audio of '%s' not found\n", obj->keys[0]);
                return -EINVAL;
index d5dd75648f17240bbaf81926732b5ec2496d04f2..3e3f3642c527a8a471b8adbfcfe5374be6aea332 100644 (file)
@@ -9,7 +9,7 @@ static int _render_draw_body(abc_render_t* render, abc_obj_t* obj, int width, in
 {
        __render_border.draw(&__render_border, obj, width, height);
 
 {
        __render_border.draw(&__render_border, obj, width, height);
 
-       abc_obj_t* attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_BG_IMAGE);
+       abc_attr_t* attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_BG_IMAGE);
        if (attr && attr->value && attr->value->len > 0)
        {
                __render_bg_image.draw(&__render_bg_image, obj, width, height);
        if (attr && attr->value && attr->value->len > 0)
        {
                __render_bg_image.draw(&__render_bg_image, obj, width, height);
index 34ccda5a3988b6020dfe83e641ee2719c5bf6187..6e86482ee055b8ed93ef69b66425fd1c3b107e6c 100644 (file)
@@ -52,7 +52,7 @@ static int _render_draw_form(abc_render_t* render, abc_obj_t* obj, int width, in
        if (0 == texture_rgba)
                __init_texture(&texture_rgba, GL_RGBA, obj->w, obj->h, NULL);
 
        if (0 == texture_rgba)
                __init_texture(&texture_rgba, GL_RGBA, obj->w, obj->h, NULL);
 
-       abc_obj_t*            attr;
+       abc_attr_t*           attr;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
index 511e14412a548a1bb9ebbcf03596dd6a3db1efb5..4e29a8316feac2c5205e6da9239e558909746d7b 100644 (file)
@@ -41,7 +41,7 @@ static int _render_fini_img(abc_render_t* render)
 
 static int _render_draw_img(abc_render_t* render, abc_obj_t* obj, int width, int height)
 {
 
 static int _render_draw_img(abc_render_t* render, abc_obj_t* obj, int width, int height)
 {
-       abc_obj_t*  attr;
+       abc_attr_t* attr;
        abc_img_t*  img = NULL;
 
        attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_SRC);
        abc_img_t*  img = NULL;
 
        attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_SRC);
index aab897633b0b3334dee9e40087192ab8e7dd6a8a..95db757b616937d136d4d51fdd29c1e99b33e4ff 100644 (file)
@@ -49,8 +49,8 @@ static int _render_draw_input(abc_render_t* render, abc_obj_t* obj, int width, i
        if (0 == texture_rgba)
                __init_texture(&texture_rgba, GL_RGBA, obj->w, obj->h, NULL);
 
        if (0 == texture_rgba)
                __init_texture(&texture_rgba, GL_RGBA, obj->w, obj->h, NULL);
 
-       abc_obj_t*            type;
-       abc_obj_t*            attr;
+       abc_attr_t*           type;
+       abc_attr_t*           attr;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
index c006420a2402cdb6588051051aded409b89d2e10..dcea464324820fa062c82bcbea295e35cb2c5ba9 100644 (file)
@@ -52,7 +52,7 @@ static int _render_draw_label(abc_render_t* render, abc_obj_t* obj, int width, i
        if (0 == texture_rgba)
                __init_texture(&texture_rgba, GL_RGBA, obj->w, obj->h, NULL);
 
        if (0 == texture_rgba)
                __init_texture(&texture_rgba, GL_RGBA, obj->w, obj->h, NULL);
 
-       abc_obj_t*            attr;
+       abc_attr_t*           attr;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
        cairo_text_extents_t  extents;
        cairo_surface_t*      surface;
        cairo_t*              cr;
index ae56b27d45797f219f7e59fa660270547bee209c..b495202fa7cc1dcd4bb2d1da5fb2468ba175d065 100644 (file)
@@ -52,7 +52,7 @@ static int _render_fini_li(abc_render_t* render)
 
 static int _render_draw_li(abc_render_t* render, abc_obj_t* obj, int width, int height)
 {
 
 static int _render_draw_li(abc_render_t* render, abc_obj_t* obj, int width, int height)
 {
-       abc_obj_t*        attr;
+       abc_attr_t*       attr;
        cairo_surface_t*  surface;
        cairo_t*          cr;
 
        cairo_surface_t*  surface;
        cairo_t*          cr;
 
index 07d91369ea8549bfa48723c7e58b69e55087723c..61b449e4d21f179381d98bdc6d0df4569703a77a 100644 (file)
@@ -45,7 +45,7 @@ static int _render_draw_td(abc_render_t* render, abc_obj_t* obj, int width, int
        if (!obj->text)
                return 0;
 
        if (!obj->text)
                return 0;
 
-       abc_obj_t*  attr;
+       abc_attr_t*  attr;
 
        int margin  = 0;
        int border  = 1;
 
        int margin  = 0;
        int border  = 1;
index dae5e774a4cde3c10413cb8d2035e17200630ce0..7bef4e6259aed782cfabbf5dff0777eef671c819 100644 (file)
@@ -60,7 +60,7 @@ static int _draw_text_line(abc_obj_t* obj, const char* text,
        cairo_fill(cr);
        cairo_stroke(cr);
 
        cairo_fill(cr);
        cairo_stroke(cr);
 
-       abc_obj_t* attr = abc_obj_find_attr(obj, ABC_HTML_ATTR_FONT);
+       abc_attr_t* attr = abc_obj_find_attr(obj, ABC_HTML_ATTR_FONT);
        if (attr)
                cairo_select_font_face(cr, attr->value->data, italic, bold);
 
        if (attr)
                cairo_select_font_face(cr, attr->value->data, italic, bold);
 
@@ -142,7 +142,7 @@ static int _render_draw_text(abc_render_t* render, abc_obj_t* obj, int width, in
                __init_texture(&texture_rgba, GL_RGBA, obj->w, obj->h, NULL);
 
        abc_text_t*  t;
                __init_texture(&texture_rgba, GL_RGBA, obj->w, obj->h, NULL);
 
        abc_text_t*  t;
-       abc_obj_t*   attr;
+       abc_attr_t*  attr;
 
        double bcolor[3] = {0.0};
        double fcolor[3] = {0.0};
 
        double bcolor[3] = {0.0};
        double fcolor[3] = {0.0};
index 104eecae2c6d0e6452debda8561747993266d841..db9a1ecf480f4ff8303fa882fac3b2f9b4490a5b 100644 (file)
--- a/ui/main.c
+++ b/ui/main.c
@@ -65,9 +65,9 @@ static int __do_button_move(abc_ctx_t* ctx, int x, int y)
                return 0;
 
        scf_list_t* l;
                return 0;
 
        scf_list_t* l;
+       abc_attr_t* attr;
        abc_obj_t*  prev = ctx->current->current;
        abc_obj_t*  obj  = abc_obj_find(ctx->current->root, x, y);
        abc_obj_t*  prev = ctx->current->current;
        abc_obj_t*  obj  = abc_obj_find(ctx->current->root, x, y);
-       abc_obj_t*  attr;
        abc_obj_t*  css;
 
        int ret = 0;
        abc_obj_t*  css;
 
        int ret = 0;
@@ -176,8 +176,8 @@ static int __do_button_move(abc_ctx_t* ctx, int x, int y)
 
 static int __do_button_release_a(abc_ctx_t* ctx, abc_obj_t* obj, int x, int y)
 {
 
 static int __do_button_release_a(abc_ctx_t* ctx, abc_obj_t* obj, int x, int y)
 {
-       abc_html_t* html = NULL;
-       abc_obj_t*  attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_HREF);
+       abc_html_t*  html = NULL;
+       abc_attr_t*  attr = abc_obj_get_attr(obj, ABC_HTML_ATTR_HREF);
 
        int ret = abc_html_open(&html, attr->value->data);
        if (ret < 0)
 
        int ret = abc_html_open(&html, attr->value->data);
        if (ret < 0)
@@ -211,10 +211,10 @@ static int __do_button_release_a(abc_ctx_t* ctx, abc_obj_t* obj, int x, int y)
 
 static int __do_button_release(abc_ctx_t* ctx, int x, int y)
 {
 
 static int __do_button_release(abc_ctx_t* ctx, int x, int y)
 {
-       abc_html_t* html;
-       abc_obj_t*  obj = abc_obj_find(ctx->current->root, x, y);
-       abc_obj_t*  css;
-       abc_obj_t*  attr;
+       abc_html_t*  html;
+       abc_attr_t*  attr;
+       abc_obj_t*   obj = abc_obj_find(ctx->current->root, x, y);
+       abc_obj_t*   css;
 
        if (!obj)
                return __do_button_move(ctx, x, y);
 
        if (!obj)
                return __do_button_move(ctx, x, y);
@@ -403,8 +403,8 @@ static gboolean button_press_event(GtkWidget* self, GdkEventButton* event, gpoin
 
 static void __utf8_delete(abc_ctx_t* ctx)
 {
 
 static void __utf8_delete(abc_ctx_t* ctx)
 {
-       abc_obj_t* obj;
-       abc_obj_t* attr;
+       abc_attr_t*  attr;
+       abc_obj_t*   obj;
 
        if (!ctx->current || !ctx->current->current)
                return;
 
        if (!ctx->current || !ctx->current->current)
                return;
@@ -428,7 +428,6 @@ static void __utf8_delete(abc_ctx_t* ctx)
 
                        if (c < 0x80)
                                break;
 
                        if (c < 0x80)
                                break;
-
                        if ((c >> 6) != 0x2)
                                break;
                }
                        if ((c >> 6) != 0x2)
                                break;
                }
@@ -536,9 +535,9 @@ static gboolean im_delete_surrounding(GtkIMContext* self, gint offset, gint n_ch
 
 static void im_commit(GtkIMContext* self, gchar* str, gpointer user_data)
 {
 
 static void im_commit(GtkIMContext* self, gchar* str, gpointer user_data)
 {
-       abc_ctx_t* ctx = user_data;
-       abc_obj_t* obj;
-       abc_obj_t* attr;
+       abc_ctx_t*   ctx = user_data;
+       abc_obj_t*   obj;
+       abc_attr_t*  attr;
 
        scf_logw("str: %s\n", str);
 
 
        scf_logw("str: %s\n", str);