Skip to content

Commit daff126

Browse files
committed
feat: 生成二进制文件时支持处理 fonts 和 medias
1 parent 5c613ed commit daff126

File tree

4 files changed

+1151
-29
lines changed

4 files changed

+1151
-29
lines changed

flatbuffers/stylesheet.fbs

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,40 @@ table Style {
8080
selector:[Selector];
8181
}
8282

83+
table Font {
84+
font_family: string;
85+
src: string;
86+
}
87+
88+
table PrimitiveCondition {
89+
feature:uint8;
90+
operator:uint8;
91+
value:Value;
92+
}
93+
94+
table CompoundCondition {
95+
conditions:[Condition];
96+
}
97+
98+
union ConditionValue {
99+
PrimitiveCondition,
100+
CompoundCondition
101+
}
102+
103+
table Condition {
104+
type:uint8;
105+
value:ConditionValue;
106+
}
107+
108+
table Media {
109+
id:uint8;
110+
conditions:[Condition];
111+
}
112+
83113
table StyleSheet {
84-
fonts:[string];
114+
fonts:[Font];
85115
keyframes:[string];
86-
medias:[string];
116+
medias:[Media];
87117
styles:[Style];
88118
design_width:uint16;
89119
}

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ mod tests {
117117
assert_eq!(style_sheet.fonts().unwrap().len(), 0);
118118

119119
// 验证 keyframes
120-
assert_eq!(style_sheet.keyframes().unwrap().len(), 0);
120+
// assert_eq!(style_sheet.keyframes().unwrap().len(), 0);
121121

122122
// 验证 medias
123123
assert_eq!(style_sheet.medias().unwrap().len(), 0);

0 commit comments

Comments
 (0)