From 32b59856e4abce079a8baa4eaf7dd67a1a6c24ce Mon Sep 17 00:00:00 2001 From: Liu Chao Date: Mon, 5 Oct 2015 16:42:11 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=A0=E6=AD=A3=20pandding=20=E7=9A=84?= =?UTF-8?q?=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/LCUI/gui/css_parser.h | 2 ++ src/gui/css_parser.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/LCUI/gui/css_parser.h b/include/LCUI/gui/css_parser.h index a7349a95..38e67115 100644 --- a/include/LCUI/gui/css_parser.h +++ b/include/LCUI/gui/css_parser.h @@ -49,6 +49,8 @@ typedef struct LCUI_StyleParser { int (*parse)(LCUI_StyleSheet, int, const char*); } LCUI_StyleParser; +LCUI_API int ParseStyleOption( const char *str ); + LCUI_API const char *GetStyleName( int key ); /** 初始化 LCUI 的 CSS 代码解析功能 */ diff --git a/src/gui/css_parser.c b/src/gui/css_parser.c index 8a172dfe..d226fe20 100644 --- a/src/gui/css_parser.c +++ b/src/gui/css_parser.c @@ -45,7 +45,7 @@ /** 样式字符串值与标识码 */ typedef struct KeyNameGroup { int key; - const char *name; + char *name; } KeyNameGroup; static struct { @@ -59,7 +59,7 @@ static struct { #define SPLIT_COLOR (1<<1) #define SPLIT_STYLE (1<<2) -static int ParseStyleOption( const char *str ) +int ParseStyleOption( const char *str ) { LCUI_RBTreeNode *node; node = RBTree_CustomSearch( &self.option_tree, str ); @@ -357,9 +357,9 @@ static int OnParsePadding( LCUI_StyleSheet ss, int key, const char *str ) break; case 4: ss->sheet[key_padding_top] = s[0]; - ss->sheet[key_padding_left] = s[1]; - ss->sheet[key_padding_right] = s[2]; - ss->sheet[key_padding_bottom] = s[3]; + ss->sheet[key_padding_right] = s[1]; + ss->sheet[key_padding_bottom] = s[2]; + ss->sheet[key_padding_left] = s[3]; default: break; } return 0; @@ -392,9 +392,9 @@ static int OnParseMargin( LCUI_StyleSheet ss, int key, const char *str ) break; case 4: ss->sheet[key_margin_top] = s[0]; - ss->sheet[key_margin_left] = s[1]; - ss->sheet[key_margin_right] = s[2]; - ss->sheet[key_margin_bottom] = s[3]; + ss->sheet[key_margin_right] = s[1]; + ss->sheet[key_margin_bottom] = s[2]; + ss->sheet[key_margin_left] = s[3]; default: break; } return 0;