Skip to content

Commit

Permalink
Fix stylesheet selection bug (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-soft committed Nov 18, 2017
1 parent a491407 commit 3cd702b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 55 deletions.
40 changes: 0 additions & 40 deletions include/LCUI/gui/widget_style.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,43 +47,6 @@ void LCUIWidget_InitStyle( void );
/** 销毁,释放资源 */
void LCUIWidget_FreeStyle( void );

/** 新建一个样式表 */
LCUI_API LCUI_StyleSheet StyleSheet( void );

/** 清空样式表 */
LCUI_API void StyleSheet_Clear( LCUI_StyleSheet ss );

/** 合并两个样式表 */
LCUI_API int StyleSheet_Merge( LCUI_StyleSheet dest, LCUI_StyleSheet src );

/** 覆盖样式表 */
LCUI_API int StyleSheet_Replace( LCUI_StyleSheet dest, LCUI_StyleSheet src );

/** 删除样式表 */
LCUI_API void StyleSheet_Delete( LCUI_StyleSheet ss );

/** 根据字符串内容生成相应的选择器 */
LCUI_API LCUI_Selector Selector( const char *selector );

/** 更新选择器内的数据 */
LCUI_API void Selector_Update( LCUI_Selector s );

/** 删除选择器 */
LCUI_API void Selector_Delete( LCUI_Selector s );

/** 向样式库添加样式表 */
LCUI_API int LCUI_PutStyleSheet( LCUI_Selector selector,
LCUI_StyleSheet in_ss, const char *space );

/** 打印样式表的内容 */
LCUI_API void LCUI_PrintStyleSheet( LCUI_StyleSheet ss );

/** 打印选择器的内容 */
LCUI_API void LCUI_PrintSelector( LCUI_Selector selector );

/** 打印样式库中的内容 */
LCUI_API void LCUI_PrintCSSLibrary(void);

/** 计算部件继承得到的样式表 */
LCUI_API void Widget_GetInheritStyle( LCUI_Widget w, LCUI_StyleSheet out_ss );

Expand All @@ -96,9 +59,6 @@ LCUI_API void Widget_UpdateStyle( LCUI_Widget w, LCUI_BOOL is_update_all );
/** 直接更新当前部件的样式 */
LCUI_API void Widget_ExecUpdateStyle( LCUI_Widget w, LCUI_BOOL is_update_all );

/** 查找作用于当前部件的样式表 */
LCUI_API int Widget_FindStyles( LCUI_Widget w, LinkedList *list );

/** 获取选择器结点 */
LCUI_SelectorNode Widget_GetSelectorNode( LCUI_Widget w );

Expand Down
17 changes: 2 additions & 15 deletions src/gui/css_library.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* ***************************************************************************
* css_library.c -- css library operation module.
*
* Copyright (C) 2015-2016 by Liu Chao <lc-soft@live.cn>
* Copyright (C) 2015-2017 by Liu Chao <lc-soft@live.cn>
*
* This file is part of the LCUI project, and may only be used, modified, and
* distributed under the terms of the GPLv2.
Expand All @@ -22,7 +22,7 @@
/* ****************************************************************************
* css_library.c -- CSS 样式库操作模块
*
* 版权所有 (C) 2015-2016 归属于 刘超 <lc-soft@live.cn>
* 版权所有 (C) 2015-2017 归属于 刘超 <lc-soft@live.cn>
*
* 这个文件是LCUI项目的一部分,并且只可以根据GPLv2许可协议来使用、更改和发布。
*
Expand Down Expand Up @@ -1051,7 +1051,6 @@ static LCUI_StyleSheet LCUI_SelectStyleSheet( LCUI_Selector selector,
StyleLink link;
StyleNode snode;
StyleLinkGroup slg;
LinkedListNode *node;
LCUI_SelectorNode sn;
Dict *group, *parents;
char buf[MAX_SELECTOR_LEN];
Expand Down Expand Up @@ -1101,18 +1100,6 @@ static LCUI_StyleSheet LCUI_SelectStyleSheet( LCUI_Selector selector,
if( !link ) {
return NULL;
}
for( LinkedList_Each( node, &link->styles ) ) {
snode = node->data;
if( snode->space && space ) {
if( strcmp( snode->space, space ) == 0 ) {
return snode->sheet;
}
} else {
if( snode->space == space ) {
return snode->sheet;
}
}
}
snode = NEW( StyleNodeRec, 1 );
if( space ) {
snode->space = NEW( char, strlen(space) + 1 );
Expand Down

0 comments on commit 3cd702b

Please sign in to comment.