@@ -171,10 +171,38 @@ impl RenderObject {
171
171
"margin" => {
172
172
self . style . margin = match declaration. value {
173
173
// TODO: support string (e.g. "auto")
174
- ComponentValue :: Keyword ( _value) => BoxInfo :: new ( 0 , 0 , 0 , 0 ) ,
174
+ ComponentValue :: Keyword ( _value) => self . style . margin . clone ( ) ,
175
175
ComponentValue :: Number ( value) => BoxInfo :: new ( value, value, value, value) ,
176
176
} ;
177
177
}
178
+ "margin-top" => {
179
+ self . style . margin . top = match declaration. value {
180
+ // TODO: support string (e.g. "auto")
181
+ ComponentValue :: Keyword ( _value) => self . style . margin . top ,
182
+ ComponentValue :: Number ( value) => value,
183
+ } ;
184
+ }
185
+ "margin-right" => {
186
+ self . style . margin . right = match declaration. value {
187
+ // TODO: support string (e.g. "auto")
188
+ ComponentValue :: Keyword ( _value) => self . style . margin . right ,
189
+ ComponentValue :: Number ( value) => value,
190
+ } ;
191
+ }
192
+ "margin-bottom" => {
193
+ self . style . margin . bottom = match declaration. value {
194
+ // TODO: support string (e.g. "auto")
195
+ ComponentValue :: Keyword ( _value) => self . style . margin . bottom ,
196
+ ComponentValue :: Number ( value) => value,
197
+ } ;
198
+ }
199
+ "margin-left" => {
200
+ self . style . margin . left = match declaration. value {
201
+ // TODO: support string (e.g. "auto")
202
+ ComponentValue :: Keyword ( _value) => self . style . margin . left ,
203
+ ComponentValue :: Number ( value) => value,
204
+ } ;
205
+ }
178
206
_ => unimplemented ! ( "css property {} is not supported yet" , declaration. property, ) ,
179
207
}
180
208
}
0 commit comments