@@ -187,30 +187,54 @@ fn convert_net_border_width(width: n::v::CssBorderWidthValue) -> CSSValue<CSSBor
187
187
fn convert_net_margin ( margin : n:: v:: CssMarginValue ) -> CSSValue < CSSMargin > {
188
188
match margin {
189
189
n:: v:: CssMarginInherit => Inherit ,
190
- n:: v:: CssMarginSet ( length) => Specified ( CSSMarginLength ( convert_net_unit_to_length ( length) ) ) ,
190
+ n:: v:: CssMarginSet ( value) => {
191
+ let length = convert_net_unit_to_length_or_percent ( value) ;
192
+ match length {
193
+ Left ( abs) => Specified ( CSSMarginLength ( abs) ) ,
194
+ Right ( percent) => Specified ( CSSMarginPercentage ( percent) )
195
+ }
196
+ }
191
197
n:: v:: CssMarginAuto => Specified ( CSSMarginAuto )
192
198
}
193
199
}
194
200
195
201
fn convert_net_padding ( padding : n:: v:: CssPaddingValue ) -> CSSValue < CSSPadding > {
196
202
match padding {
197
203
n:: v:: CssPaddingInherit => Inherit ,
198
- n:: v:: CssPaddingSet ( length) => Specified ( CSSPaddingLength ( convert_net_unit_to_length ( length) ) )
204
+ n:: v:: CssPaddingSet ( value) => {
205
+ let length = convert_net_unit_to_length_or_percent ( value) ;
206
+ match length {
207
+ Left ( abs) => Specified ( CSSPaddingLength ( abs) ) ,
208
+ Right ( percent) => Specified ( CSSPaddingPercentage ( percent) )
209
+ }
210
+ }
199
211
}
200
212
}
201
213
202
214
fn convert_net_width_value ( value : n:: v:: CssWidthValue ) -> CSSValue < CSSWidth > {
203
215
match value {
204
216
n:: v:: CssWidthInherit => Inherit ,
205
- n:: v:: CssWidthSet ( length) => Specified ( CSSWidthLength ( convert_net_unit_to_length ( length) ) ) ,
217
+ n:: v:: CssWidthSet ( value) => {
218
+ let length = convert_net_unit_to_length_or_percent ( value) ;
219
+ match length {
220
+ Left ( abs) => Specified ( CSSWidthLength ( abs) ) ,
221
+ Right ( percent) => Specified ( CSSWidthPercentage ( percent) )
222
+ }
223
+ }
206
224
n:: v:: CssWidthAuto => Specified ( CSSWidthAuto )
207
225
}
208
226
}
209
227
210
228
fn convert_net_height_value ( value : n:: v:: CssHeightValue ) -> CSSValue < CSSHeight > {
211
229
match value {
212
230
n:: v:: CssHeightInherit => Inherit ,
213
- n:: v:: CssHeightSet ( length) => Specified ( CSSHeightLength ( convert_net_unit_to_length ( length) ) ) ,
231
+ n:: v:: CssHeightSet ( value) => {
232
+ let length = convert_net_unit_to_length_or_percent ( value) ;
233
+ match length {
234
+ Left ( abs) => Specified ( CSSHeightLength ( abs) ) ,
235
+ Right ( percent) => Specified ( CSSHeightPercentage ( percent) )
236
+ }
237
+ }
214
238
n:: v:: CssHeightAuto => Specified ( CSSHeightAuto )
215
239
}
216
240
}
@@ -364,7 +388,7 @@ fn convert_net_line_height_value(value: n::v::CssLineHeightValue) -> CSSValue<CS
364
388
fn convert_net_unit_to_length( unit : n:: t:: CssUnit ) -> Length {
365
389
match convert_net_unit_to_length_or_percent ( unit) {
366
390
Left ( v) => v,
367
- Right ( * ) => Px ( 100.0 ) , // FIXME(pcwalton): fill this in.
391
+ Right ( * ) => fail ! ( ~"unexpected percentage unit "),
368
392
}
369
393
}
370
394
0 commit comments