@@ -54,19 +54,19 @@ pub fn calc() {
5454 // "margin-left",
5555 // "calc(10px + 20vh + 30px)",
5656 // Length::new_calc_expr(CalcExpr::Plus(
57- // Box::new(CalcExpr::Length(Box::new( Length::Px(40.)))),
58- // Box::new(CalcExpr::Length(Box::new( Length::Vh(20.))))
57+ // Box::new(CalcExpr::Length(Length::Px(40.)))),
58+ // Box::new(CalcExpr::Length(Length::Vh(20.))))
5959 // )))
6060 // );
6161 test_parse_property ! (
6262 margin_left,
6363 "margin-left" ,
6464 "calc(10rpx + (20vh + 30px))" ,
6565 Length :: new_calc_expr( Box :: new( CalcExpr :: Plus (
66- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Rpx ( 10. ) ) ) ) ,
66+ Box :: new( CalcExpr :: Length ( Length :: Rpx ( 10. ) ) ) ,
6767 Box :: new( CalcExpr :: Plus (
68- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Vh ( 20. ) ) ) ) ,
69- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( 30. ) ) ) )
68+ Box :: new( CalcExpr :: Length ( Length :: Vh ( 20. ) ) ) ,
69+ Box :: new( CalcExpr :: Length ( Length :: Px ( 30. ) ) )
7070 ) )
7171 ) ) )
7272 ) ;
@@ -178,12 +178,12 @@ pub fn calc_ch_ex_lang() {
178178 Length :: new_calc_expr( Box :: new( CalcExpr :: Plus (
179179 Box :: new( CalcExpr :: Plus (
180180 Box :: new( CalcExpr :: Plus (
181- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Vh ( 1. ) ) ) ) ,
182- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Vw ( 5. ) ) ) )
181+ Box :: new( CalcExpr :: Length ( Length :: Vh ( 1. ) ) ) ,
182+ Box :: new( CalcExpr :: Length ( Length :: Vw ( 5. ) ) )
183183 ) ) ,
184- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( 10. ) ) ) )
184+ Box :: new( CalcExpr :: Length ( Length :: Px ( 10. ) ) )
185185 ) ) ,
186- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Rem ( 1. ) ) ) )
186+ Box :: new( CalcExpr :: Length ( Length :: Rem ( 1. ) ) )
187187 ) ) )
188188 ) ;
189189
@@ -193,8 +193,8 @@ pub fn calc_ch_ex_lang() {
193193 // "font-size",
194194 // "calc(17px + 0.5 * (1rem - 16px))",
195195 // Length::new_calc_expr(CalcExpr::Plus(
196- // Box::new(CalcExpr::Length(Box::new( Length::Px(9.)))),
197- // Box::new(CalcExpr::Length(Box::new( Length::Rem(0.5))))
196+ // Box::new(CalcExpr::Length(Length::Px(9.)))),
197+ // Box::new(CalcExpr::Length(Length::Rem(0.5))))
198198 // )))
199199 // );
200200}
@@ -208,8 +208,8 @@ pub fn calc_height_block_1() {
208208 "height" ,
209209 "calc(25px + 50%)" ,
210210 Length :: new_calc_expr( Box :: new( CalcExpr :: Plus (
211- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( 25. ) ) ) ) ,
212- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Ratio ( 0.5 ) ) ) ) ,
211+ Box :: new( CalcExpr :: Length ( Length :: Px ( 25. ) ) ) ,
212+ Box :: new( CalcExpr :: Length ( Length :: Ratio ( 0.5 ) ) ) ,
213213 ) ) )
214214 ) ;
215215
@@ -218,8 +218,8 @@ pub fn calc_height_block_1() {
218218 "height" ,
219219 "calc(150% / 2 - 30px)" ,
220220 Length :: new_calc_expr( Box :: new( CalcExpr :: Sub (
221- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Ratio ( 0.75 ) ) ) ) ,
222- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( 30. ) ) ) ) ,
221+ Box :: new( CalcExpr :: Length ( Length :: Ratio ( 0.75 ) ) ) ,
222+ Box :: new( CalcExpr :: Length ( Length :: Px ( 30. ) ) ) ,
223223 ) ) )
224224 ) ;
225225
@@ -236,8 +236,8 @@ pub fn calc_height_block_1() {
236236 "height" ,
237237 "calc(40px - 10%)" ,
238238 Length :: new_calc_expr( Box :: new( CalcExpr :: Sub (
239- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( 40. ) ) ) ) ,
240- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Ratio ( 0.1 ) ) ) ) ,
239+ Box :: new( CalcExpr :: Length ( Length :: Px ( 40. ) ) ) ,
240+ Box :: new( CalcExpr :: Length ( Length :: Ratio ( 0.1 ) ) ) ,
241241 ) ) )
242242 ) ;
243243}
@@ -257,10 +257,10 @@ pub fn calc_in_calc() {
257257 "calc(calc(10px + 10%) + 10px)" ,
258258 Length :: new_calc_expr( Box :: new( CalcExpr :: Plus (
259259 Box :: new( CalcExpr :: Plus (
260- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( 10. ) ) ) ) ,
261- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Ratio ( 0.1 ) ) ) )
260+ Box :: new( CalcExpr :: Length ( Length :: Px ( 10. ) ) ) ,
261+ Box :: new( CalcExpr :: Length ( Length :: Ratio ( 0.1 ) ) )
262262 ) ) ,
263- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( 10. ) ) ) )
263+ Box :: new( CalcExpr :: Length ( Length :: Px ( 10. ) ) )
264264 ) ) )
265265 ) ;
266266}
@@ -272,53 +272,53 @@ pub fn calc_margin_block_1() {
272272 "margin" ,
273273 "calc(10px + 1%) 0 0 0" ,
274274 Length :: new_calc_expr( Box :: new( CalcExpr :: Plus (
275- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( 10. ) ) ) ) ,
276- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Ratio ( 0.01 ) ) ) ) ,
275+ Box :: new( CalcExpr :: Length ( Length :: Px ( 10. ) ) ) ,
276+ Box :: new( CalcExpr :: Length ( Length :: Ratio ( 0.01 ) ) ) ,
277277 ) ) )
278278 ) ;
279279 test_parse_property ! (
280280 margin_right,
281281 "margin" ,
282282 "0 calc(10px + 1%) 0 0" ,
283283 Length :: new_calc_expr( Box :: new( CalcExpr :: Plus (
284- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( 10. ) ) ) ) ,
285- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Ratio ( 0.01 ) ) ) ) ,
284+ Box :: new( CalcExpr :: Length ( Length :: Px ( 10. ) ) ) ,
285+ Box :: new( CalcExpr :: Length ( Length :: Ratio ( 0.01 ) ) ) ,
286286 ) ) )
287287 ) ;
288288 test_parse_property ! (
289289 margin_bottom,
290290 "margin" ,
291291 "0 0 calc(10px + 1%) 0" ,
292292 Length :: new_calc_expr( Box :: new( CalcExpr :: Plus (
293- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( 10. ) ) ) ) ,
294- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Ratio ( 0.01 ) ) ) ) ,
293+ Box :: new( CalcExpr :: Length ( Length :: Px ( 10. ) ) ) ,
294+ Box :: new( CalcExpr :: Length ( Length :: Ratio ( 0.01 ) ) ) ,
295295 ) ) )
296296 ) ;
297297 test_parse_property ! (
298298 margin_left,
299299 "margin" ,
300300 "0 0 0 calc(10px + 1%)" ,
301301 Length :: new_calc_expr( Box :: new( CalcExpr :: Plus (
302- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( 10. ) ) ) ) ,
303- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Ratio ( 0.01 ) ) ) ) ,
302+ Box :: new( CalcExpr :: Length ( Length :: Px ( 10. ) ) ) ,
303+ Box :: new( CalcExpr :: Length ( Length :: Ratio ( 0.01 ) ) ) ,
304304 ) ) )
305305 ) ;
306306 test_parse_property ! (
307307 margin_left,
308308 "margin" ,
309309 "calc(10px + 1%)" ,
310310 Length :: new_calc_expr( Box :: new( CalcExpr :: Plus (
311- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( 10. ) ) ) ) ,
312- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Ratio ( 0.01 ) ) ) ) ,
311+ Box :: new( CalcExpr :: Length ( Length :: Px ( 10. ) ) ) ,
312+ Box :: new( CalcExpr :: Length ( Length :: Ratio ( 0.01 ) ) ) ,
313313 ) ) )
314314 ) ;
315315 test_parse_property ! (
316316 margin_bottom,
317317 "margin" ,
318318 "calc(10px + 1%)" ,
319319 Length :: new_calc_expr( Box :: new( CalcExpr :: Plus (
320- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( 10. ) ) ) ) ,
321- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Ratio ( 0.01 ) ) ) ) ,
320+ Box :: new( CalcExpr :: Length ( Length :: Px ( 10. ) ) ) ,
321+ Box :: new( CalcExpr :: Length ( Length :: Ratio ( 0.01 ) ) ) ,
322322 ) ) )
323323 ) ;
324324}
@@ -332,17 +332,17 @@ pub fn calc_max_height_block_1() {
332332 "max-height" ,
333333 "calc(25px + 50%)" ,
334334 Length :: new_calc_expr( Box :: new( CalcExpr :: Plus (
335- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( 25. ) ) ) ) ,
336- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Ratio ( 0.5 ) ) ) ) ,
335+ Box :: new( CalcExpr :: Length ( Length :: Px ( 25. ) ) ) ,
336+ Box :: new( CalcExpr :: Length ( Length :: Ratio ( 0.5 ) ) ) ,
337337 ) ) )
338338 ) ;
339339 test_parse_property ! (
340340 max_height,
341341 "max-height" ,
342342 "calc(150% / 2 - 30px)" ,
343343 Length :: new_calc_expr( Box :: new( CalcExpr :: Sub (
344- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Ratio ( 0.75 ) ) ) ) ,
345- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( 30. ) ) ) ) ,
344+ Box :: new( CalcExpr :: Length ( Length :: Ratio ( 0.75 ) ) ) ,
345+ Box :: new( CalcExpr :: Length ( Length :: Px ( 30. ) ) ) ,
346346 ) ) )
347347 ) ;
348348 // FIXME
@@ -357,8 +357,8 @@ pub fn calc_max_height_block_1() {
357357 "max-height" ,
358358 "calc(40px - 10%)" ,
359359 Length :: new_calc_expr( Box :: new( CalcExpr :: Sub (
360- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( 40. ) ) ) ) ,
361- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Ratio ( 0.1 ) ) ) ) ,
360+ Box :: new( CalcExpr :: Length ( Length :: Px ( 40. ) ) ) ,
361+ Box :: new( CalcExpr :: Length ( Length :: Ratio ( 0.1 ) ) ) ,
362362 ) ) )
363363 ) ;
364364}
@@ -370,8 +370,8 @@ pub fn calc_max_width_block_1() {
370370 "max-width" ,
371371 "calc(50% - 3px)" ,
372372 Length :: new_calc_expr( Box :: new( CalcExpr :: Sub (
373- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Ratio ( 0.5 ) ) ) ) ,
374- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( 3. ) ) ) ) ,
373+ Box :: new( CalcExpr :: Length ( Length :: Ratio ( 0.5 ) ) ) ,
374+ Box :: new( CalcExpr :: Length ( Length :: Px ( 3. ) ) ) ,
375375 ) ) )
376376 ) ;
377377
@@ -381,8 +381,8 @@ pub fn calc_max_width_block_1() {
381381 // "max-width",
382382 // "calc(25% - 3px + 25%)",
383383 // Length::new_calc_expr(CalcExpr::Sub(
384- // Box::new(CalcExpr::Length(Box::new( Length::Ratio(0.5) ))),
385- // Box::new(CalcExpr::Length(Box::new( Length::Px(3.) ))),
384+ // Box::new(CalcExpr::Length(Length::Ratio(0.5))),
385+ // Box::new(CalcExpr::Length(Length::Px(3.))),
386386 // )))
387387 // );
388388
@@ -392,8 +392,8 @@ pub fn calc_max_width_block_1() {
392392 // "max-width",
393393 // "calc(25% - 3px + 12.5% * 2)",
394394 // Length::new_calc_expr(CalcExpr::Sub(
395- // Box::new(CalcExpr::Length(Box::new( Length::Ratio(0.5) ))),
396- // Box::new(CalcExpr::Length(Box::new( Length::Px(3.) ))),
395+ // Box::new(CalcExpr::Length(Length::Ratio(0.5))),
396+ // Box::new(CalcExpr::Length(Length::Px(3.))),
397397 // )))
398398 // );
399399
@@ -403,8 +403,8 @@ pub fn calc_max_width_block_1() {
403403 // "max-width",
404404 // "calc(25% - 3px + 12.5%*2)",
405405 // Length::new_calc_expr(CalcExpr::Sub(
406- // Box::new(CalcExpr::Length(Box::new( Length::Ratio(0.5) ))),
407- // Box::new(CalcExpr::Length(Box::new( Length::Px(3.) ))),
406+ // Box::new(CalcExpr::Length(Length::Ratio(0.5))),
407+ // Box::new(CalcExpr::Length(Length::Px(3.))),
408408 // )))
409409 // );
410410
@@ -414,8 +414,8 @@ pub fn calc_max_width_block_1() {
414414 // "max-width",
415415 // "calc(25% - 3px + 2*12.5%)",
416416 // Length::new_calc_expr(CalcExpr::Sub(
417- // Box::new(CalcExpr::Length(Box::new( Length::Ratio(0.5) ))),
418- // Box::new(CalcExpr::Length(Box::new( Length::Px(3.) ))),
417+ // Box::new(CalcExpr::Length(Length::Ratio(0.5))),
418+ // Box::new(CalcExpr::Length(Length::Px(3.))),
419419 // )))
420420 // );
421421
@@ -425,8 +425,8 @@ pub fn calc_max_width_block_1() {
425425 // "max-width",
426426 // "calc(25% - 3px + 2 * 12.5%)",
427427 // Length::new_calc_expr(CalcExpr::Sub(
428- // Box::new(CalcExpr::Length(Box::new( Length::Ratio(0.5) ))),
429- // Box::new(CalcExpr::Length(Box::new( Length::Px(3.) ))),
428+ // Box::new(CalcExpr::Length(Length::Ratio(0.5))),
429+ // Box::new(CalcExpr::Length(Length::Px(3.))),
430430 // )))
431431 // );
432432
@@ -447,17 +447,17 @@ pub fn calc_offset_absolute_left_1() {
447447 "left" ,
448448 "calc(-25px - 50%)" ,
449449 Length :: new_calc_expr( Box :: new( CalcExpr :: Sub (
450- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( -25. ) ) ) ) ,
451- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Ratio ( 0.5 ) ) ) ) ,
450+ Box :: new( CalcExpr :: Length ( Length :: Px ( -25. ) ) ) ,
451+ Box :: new( CalcExpr :: Length ( Length :: Ratio ( 0.5 ) ) ) ,
452452 ) ) )
453453 ) ;
454454 test_parse_property ! (
455455 left,
456456 "left" ,
457457 "calc(-150% / 2 - 30px)" ,
458458 Length :: new_calc_expr( Box :: new( CalcExpr :: Sub (
459- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Ratio ( -0.75 ) ) ) ) ,
460- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( 30. ) ) ) ) ,
459+ Box :: new( CalcExpr :: Length ( Length :: Ratio ( -0.75 ) ) ) ,
460+ Box :: new( CalcExpr :: Length ( Length :: Px ( 30. ) ) ) ,
461461 ) ) )
462462 ) ;
463463 // FIXME
@@ -472,8 +472,8 @@ pub fn calc_offset_absolute_left_1() {
472472 "left" ,
473473 "calc(-40px - 10%)" ,
474474 Length :: new_calc_expr( Box :: new( CalcExpr :: Sub (
475- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Px ( -40. ) ) ) ) ,
476- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Ratio ( 0.1 ) ) ) ) ,
475+ Box :: new( CalcExpr :: Length ( Length :: Px ( -40. ) ) ) ,
476+ Box :: new( CalcExpr :: Length ( Length :: Ratio ( 0.1 ) ) ) ,
477477 ) ) )
478478 ) ;
479479}
@@ -487,8 +487,8 @@ pub fn calc_rem_lang() {
487487 "left" ,
488488 "calc(1rem + 1em)" ,
489489 Length :: new_calc_expr( Box :: new( CalcExpr :: Plus (
490- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Rem ( 1. ) ) ) ) ,
491- Box :: new( CalcExpr :: Length ( Box :: new ( Length :: Em ( 1. ) ) ) ) ,
490+ Box :: new( CalcExpr :: Length ( Length :: Rem ( 1. ) ) ) ,
491+ Box :: new( CalcExpr :: Length ( Length :: Em ( 1. ) ) ) ,
492492 ) ) )
493493 ) ;
494494}
0 commit comments