1use alloc::{string::String, vec::Vec};
2
3use crate::{css::PrintAsCssValue, css_properties::*};
4
5impl PrintAsCssValue for StyleFilter {
6 fn print_as_css_value(&self) -> String {
7 match self {
8 StyleFilter::Blend(mode) => format!("blend({})", mode.print_as_css_value()),
9 StyleFilter::Flood(c) => format!("flood({})", c),
10 StyleFilter::Blur(c) => format!("blur({} {})", c.width, c.height),
11 StyleFilter::Opacity(c) => format!("opacity({})", c),
12 StyleFilter::ColorMatrix(c) => format!(
13 "color-matrix({})",
14 c.matrix
15 .iter()
16 .map(|s| format!("{}", s))
17 .collect::<Vec<_>>()
18 .join(", ")
19 ),
20 StyleFilter::DropShadow(shadow) => {
21 format!("drop-shadow({})", shadow.print_as_css_value())
22 }
23 StyleFilter::ComponentTransfer => format!("component-transfer"),
24 StyleFilter::Offset(o) => format!("offset({}, {})", o.x, o.y),
25 StyleFilter::Composite(c) => format!("composite({})", c.print_as_css_value()),
26 }
27 }
28}
29
30impl PrintAsCssValue for StyleCompositeFilter {
31 fn print_as_css_value(&self) -> String {
32 match self {
33 StyleCompositeFilter::Over => format!("over"),
34 StyleCompositeFilter::In => format!("in"),
35 StyleCompositeFilter::Atop => format!("atop"),
36 StyleCompositeFilter::Out => format!("out"),
37 StyleCompositeFilter::Xor => format!("xor"),
38 StyleCompositeFilter::Lighter => format!("lighter"),
39 StyleCompositeFilter::Arithmetic(fv) => format!(
40 "arithmetic({})",
41 fv.iter()
42 .map(|s| format!("{}", s))
43 .collect::<Vec<_>>()
44 .join(", ")
45 ),
46 }
47 }
48}
49
50impl PrintAsCssValue for StyleMixBlendMode {
51 fn print_as_css_value(&self) -> String {
52 format!("{}", self)
53 }
54}
55
56impl PrintAsCssValue for StyleTextColor {
57 fn print_as_css_value(&self) -> String {
58 self.inner.to_hash()
59 }
60}
61
62impl PrintAsCssValue for StyleFontSize {
63 fn print_as_css_value(&self) -> String {
64 format!("{}", self.inner)
65 }
66}
67
68impl PrintAsCssValue for StyleFontFamilyVec {
69 fn print_as_css_value(&self) -> String {
70 self.iter()
71 .map(|f| f.as_string())
72 .collect::<Vec<_>>()
73 .join(", ")
74 }
75}
76
77impl PrintAsCssValue for StyleTextAlign {
78 fn print_as_css_value(&self) -> String {
79 String::from(match self {
80 StyleTextAlign::Left => "left",
81 StyleTextAlign::Center => "center",
82 StyleTextAlign::Right => "right",
83 })
84 }
85}
86
87impl PrintAsCssValue for StyleLetterSpacing {
88 fn print_as_css_value(&self) -> String {
89 format!("{}", self.inner)
90 }
91}
92
93impl PrintAsCssValue for StyleLineHeight {
94 fn print_as_css_value(&self) -> String {
95 format!("{}", self.inner)
96 }
97}
98
99impl PrintAsCssValue for StyleWordSpacing {
100 fn print_as_css_value(&self) -> String {
101 format!("{}", self.inner)
102 }
103}
104
105impl PrintAsCssValue for StyleTabWidth {
106 fn print_as_css_value(&self) -> String {
107 format!("{}", self.inner)
108 }
109}
110
111impl PrintAsCssValue for StyleCursor {
112 fn print_as_css_value(&self) -> String {
113 String::from(match self {
114 StyleCursor::Alias => "alias",
115 StyleCursor::AllScroll => "all-scroll",
116 StyleCursor::Cell => "cell",
117 StyleCursor::ColResize => "col-resize",
118 StyleCursor::ContextMenu => "context-menu",
119 StyleCursor::Copy => "copy",
120 StyleCursor::Crosshair => "crosshair",
121 StyleCursor::Default => "default",
122 StyleCursor::EResize => "e-resize",
123 StyleCursor::EwResize => "ew-resize",
124 StyleCursor::Grab => "grab",
125 StyleCursor::Grabbing => "grabbing",
126 StyleCursor::Help => "help",
127 StyleCursor::Move => "move",
128 StyleCursor::NResize => "n-resize",
129 StyleCursor::NsResize => "ns-resize",
130 StyleCursor::NeswResize => "nesw-resize",
131 StyleCursor::NwseResize => "nwse-resize",
132 StyleCursor::Pointer => "pointer",
133 StyleCursor::Progress => "progress",
134 StyleCursor::RowResize => "row-resize",
135 StyleCursor::SResize => "s-resize",
136 StyleCursor::SeResize => "se-resize",
137 StyleCursor::Text => "text",
138 StyleCursor::Unset => "unset",
139 StyleCursor::VerticalText => "vertical-text",
140 StyleCursor::WResize => "w-resize",
141 StyleCursor::Wait => "wait",
142 StyleCursor::ZoomIn => "zoom-in",
143 StyleCursor::ZoomOut => "zoom-out",
144 })
145 }
146}
147
148impl PrintAsCssValue for LayoutDisplay {
149 fn print_as_css_value(&self) -> String {
150 String::from(match self {
151 LayoutDisplay::None => "none",
152 LayoutDisplay::Flex => "flex",
153 LayoutDisplay::Block => "block",
154 LayoutDisplay::InlineBlock => "inline-block",
155 })
156 }
157}
158
159impl PrintAsCssValue for LayoutFloat {
160 fn print_as_css_value(&self) -> String {
161 String::from(match self {
162 LayoutFloat::Left => "left",
163 LayoutFloat::Right => "right",
164 })
165 }
166}
167
168impl PrintAsCssValue for LayoutBoxSizing {
169 fn print_as_css_value(&self) -> String {
170 String::from(match self {
171 LayoutBoxSizing::ContentBox => "content-box",
172 LayoutBoxSizing::BorderBox => "border-box",
173 })
174 }
175}
176
177impl PrintAsCssValue for LayoutWidth {
178 fn print_as_css_value(&self) -> String {
179 format!("{}", self.inner)
180 }
181}
182
183impl PrintAsCssValue for LayoutHeight {
184 fn print_as_css_value(&self) -> String {
185 format!("{}", self.inner)
186 }
187}
188
189impl PrintAsCssValue for LayoutMinWidth {
190 fn print_as_css_value(&self) -> String {
191 format!("{}", self.inner)
192 }
193}
194
195impl PrintAsCssValue for LayoutMinHeight {
196 fn print_as_css_value(&self) -> String {
197 format!("{}", self.inner)
198 }
199}
200
201impl PrintAsCssValue for LayoutMaxWidth {
202 fn print_as_css_value(&self) -> String {
203 format!("{}", self.inner)
204 }
205}
206
207impl PrintAsCssValue for LayoutMaxHeight {
208 fn print_as_css_value(&self) -> String {
209 format!("{}", self.inner)
210 }
211}
212
213impl PrintAsCssValue for LayoutPosition {
214 fn print_as_css_value(&self) -> String {
215 String::from(match self {
216 LayoutPosition::Static => "static",
217 LayoutPosition::Relative => "relative",
218 LayoutPosition::Absolute => "absolute",
219 LayoutPosition::Fixed => "fixed",
220 })
221 }
222}
223
224impl PrintAsCssValue for LayoutTop {
225 fn print_as_css_value(&self) -> String {
226 format!("{}", self.inner)
227 }
228}
229
230impl PrintAsCssValue for LayoutRight {
231 fn print_as_css_value(&self) -> String {
232 format!("{}", self.inner)
233 }
234}
235
236impl PrintAsCssValue for LayoutLeft {
237 fn print_as_css_value(&self) -> String {
238 format!("{}", self.inner)
239 }
240}
241
242impl PrintAsCssValue for LayoutBottom {
243 fn print_as_css_value(&self) -> String {
244 format!("{}", self.inner)
245 }
246}
247
248impl PrintAsCssValue for LayoutFlexWrap {
249 fn print_as_css_value(&self) -> String {
250 String::from(match self {
251 LayoutFlexWrap::Wrap => "wrap",
252 LayoutFlexWrap::NoWrap => "nowrap",
253 })
254 }
255}
256
257impl PrintAsCssValue for LayoutFlexDirection {
258 fn print_as_css_value(&self) -> String {
259 String::from(match self {
260 LayoutFlexDirection::Row => "row",
261 LayoutFlexDirection::RowReverse => "row-reverse",
262 LayoutFlexDirection::Column => "column",
263 LayoutFlexDirection::ColumnReverse => "column-reverse",
264 })
265 }
266}
267
268impl PrintAsCssValue for LayoutFlexGrow {
269 fn print_as_css_value(&self) -> String {
270 format!("{}", self.inner)
271 }
272}
273
274impl PrintAsCssValue for LayoutFlexShrink {
275 fn print_as_css_value(&self) -> String {
276 format!("{}", self.inner)
277 }
278}
279
280impl PrintAsCssValue for LayoutJustifyContent {
281 fn print_as_css_value(&self) -> String {
282 String::from(match self {
283 LayoutJustifyContent::Start => "start",
284 LayoutJustifyContent::End => "end",
285 LayoutJustifyContent::Center => "center",
286 LayoutJustifyContent::SpaceBetween => "space-between",
287 LayoutJustifyContent::SpaceAround => "space-around",
288 LayoutJustifyContent::SpaceEvenly => "space-evenly",
289 })
290 }
291}
292
293impl PrintAsCssValue for LayoutAlignItems {
294 fn print_as_css_value(&self) -> String {
295 String::from(match self {
296 LayoutAlignItems::Stretch => "stretch",
297 LayoutAlignItems::Center => "center",
298 LayoutAlignItems::FlexStart => "flex-start",
299 LayoutAlignItems::FlexEnd => "flex-end",
300 })
301 }
302}
303
304impl PrintAsCssValue for LayoutAlignContent {
305 fn print_as_css_value(&self) -> String {
306 String::from(match self {
307 LayoutAlignContent::Stretch => "stretch",
308 LayoutAlignContent::Center => "center",
309 LayoutAlignContent::Start => "start",
310 LayoutAlignContent::End => "end",
311 LayoutAlignContent::SpaceBetween => "space-between",
312 LayoutAlignContent::SpaceAround => "space-around",
313 })
314 }
315}
316
317impl PrintAsCssValue for StyleFilterVec {
318 fn print_as_css_value(&self) -> String {
319 self.as_ref()
320 .iter()
321 .map(|f| f.print_as_css_value())
322 .collect::<Vec<_>>()
323 .join(", ")
324 }
325}
326
327impl PrintAsCssValue for StyleBackgroundContentVec {
328 fn print_as_css_value(&self) -> String {
329 self.as_ref()
330 .iter()
331 .map(|f| f.print_as_css_value())
332 .collect::<Vec<_>>()
333 .join(", ")
334 }
335}
336
337impl PrintAsCssValue for StyleBackgroundPositionVec {
338 fn print_as_css_value(&self) -> String {
339 self.as_ref()
340 .iter()
341 .map(|f| f.print_as_css_value())
342 .collect::<Vec<_>>()
343 .join(", ")
344 }
345}
346
347impl PrintAsCssValue for StyleBackgroundSizeVec {
348 fn print_as_css_value(&self) -> String {
349 self.as_ref()
350 .iter()
351 .map(|f| f.print_as_css_value())
352 .collect::<Vec<_>>()
353 .join(", ")
354 }
355}
356
357impl PrintAsCssValue for StyleBackgroundRepeatVec {
358 fn print_as_css_value(&self) -> String {
359 self.as_ref()
360 .iter()
361 .map(|f| f.print_as_css_value())
362 .collect::<Vec<_>>()
363 .join(", ")
364 }
365}
366
367impl PrintAsCssValue for LayoutOverflow {
368 fn print_as_css_value(&self) -> String {
369 String::from(match self {
370 LayoutOverflow::Scroll => "scroll",
371 LayoutOverflow::Auto => "auto",
372 LayoutOverflow::Hidden => "hidden",
373 LayoutOverflow::Visible => "visible",
374 })
375 }
376}
377
378impl PrintAsCssValue for LayoutPaddingTop {
379 fn print_as_css_value(&self) -> String {
380 format!("{}", self.inner)
381 }
382}
383
384impl PrintAsCssValue for LayoutPaddingLeft {
385 fn print_as_css_value(&self) -> String {
386 format!("{}", self.inner)
387 }
388}
389
390impl PrintAsCssValue for LayoutPaddingRight {
391 fn print_as_css_value(&self) -> String {
392 format!("{}", self.inner)
393 }
394}
395
396impl PrintAsCssValue for LayoutPaddingBottom {
397 fn print_as_css_value(&self) -> String {
398 format!("{}", self.inner)
399 }
400}
401
402impl PrintAsCssValue for LayoutMarginTop {
403 fn print_as_css_value(&self) -> String {
404 format!("{}", self.inner)
405 }
406}
407
408impl PrintAsCssValue for LayoutMarginLeft {
409 fn print_as_css_value(&self) -> String {
410 format!("{}", self.inner)
411 }
412}
413
414impl PrintAsCssValue for LayoutMarginRight {
415 fn print_as_css_value(&self) -> String {
416 format!("{}", self.inner)
417 }
418}
419
420impl PrintAsCssValue for LayoutMarginBottom {
421 fn print_as_css_value(&self) -> String {
422 format!("{}", self.inner)
423 }
424}
425
426impl PrintAsCssValue for StyleBorderTopLeftRadius {
427 fn print_as_css_value(&self) -> String {
428 format!("{}", self.inner)
429 }
430}
431
432impl PrintAsCssValue for StyleBorderTopRightRadius {
433 fn print_as_css_value(&self) -> String {
434 format!("{}", self.inner)
435 }
436}
437
438impl PrintAsCssValue for StyleBorderBottomLeftRadius {
439 fn print_as_css_value(&self) -> String {
440 format!("{}", self.inner)
441 }
442}
443
444impl PrintAsCssValue for StyleBorderBottomRightRadius {
445 fn print_as_css_value(&self) -> String {
446 format!("{}", self.inner)
447 }
448}
449
450impl PrintAsCssValue for StyleBorderTopColor {
451 fn print_as_css_value(&self) -> String {
452 self.inner.to_hash()
453 }
454}
455
456impl PrintAsCssValue for StyleBorderRightColor {
457 fn print_as_css_value(&self) -> String {
458 self.inner.to_hash()
459 }
460}
461
462impl PrintAsCssValue for StyleBorderLeftColor {
463 fn print_as_css_value(&self) -> String {
464 self.inner.to_hash()
465 }
466}
467
468impl PrintAsCssValue for StyleBorderBottomColor {
469 fn print_as_css_value(&self) -> String {
470 self.inner.to_hash()
471 }
472}
473
474impl PrintAsCssValue for StyleBorderTopStyle {
475 fn print_as_css_value(&self) -> String {
476 format!("{}", self.inner)
477 }
478}
479
480impl PrintAsCssValue for StyleBorderRightStyle {
481 fn print_as_css_value(&self) -> String {
482 format!("{}", self.inner)
483 }
484}
485
486impl PrintAsCssValue for StyleBorderLeftStyle {
487 fn print_as_css_value(&self) -> String {
488 format!("{}", self.inner)
489 }
490}
491
492impl PrintAsCssValue for StyleBorderBottomStyle {
493 fn print_as_css_value(&self) -> String {
494 format!("{}", self.inner)
495 }
496}
497
498impl PrintAsCssValue for LayoutBorderTopWidth {
499 fn print_as_css_value(&self) -> String {
500 format!("{}", self.inner)
501 }
502}
503
504impl PrintAsCssValue for LayoutBorderRightWidth {
505 fn print_as_css_value(&self) -> String {
506 format!("{}", self.inner)
507 }
508}
509
510impl PrintAsCssValue for LayoutBorderLeftWidth {
511 fn print_as_css_value(&self) -> String {
512 format!("{}", self.inner)
513 }
514}
515
516impl PrintAsCssValue for LayoutBorderBottomWidth {
517 fn print_as_css_value(&self) -> String {
518 format!("{}", self.inner)
519 }
520}
521
522impl PrintAsCssValue for StyleBoxShadow {
523 fn print_as_css_value(&self) -> String {
524 format!(
525 "{} {} {} {} {} {}",
526 self.offset[0],
527 self.offset[1],
528 self.blur_radius,
529 self.spread_radius,
530 self.color.to_hash(),
531 if self.clip_mode == BoxShadowClipMode::Outset {
532 ""
533 } else {
534 "inset"
535 },
536 )
537 }
538}
539
540impl PrintAsCssValue for ScrollbarStyle {
541 fn print_as_css_value(&self) -> String {
542 format!(
543 "horz({}), vert({})",
544 self.horizontal.print_as_css_value(),
545 self.vertical.print_as_css_value()
546 )
547 }
548}
549
550impl PrintAsCssValue for StyleOpacity {
551 fn print_as_css_value(&self) -> String {
552 format!("{}", self.inner)
553 }
554}
555
556impl PrintAsCssValue for StyleTransformVec {
557 fn print_as_css_value(&self) -> String {
558 self.as_ref()
559 .iter()
560 .map(|f| f.print_as_css_value())
561 .collect::<Vec<_>>()
562 .join(", ")
563 }
564}
565
566impl PrintAsCssValue for StyleTransformOrigin {
567 fn print_as_css_value(&self) -> String {
568 format!("{} {}", self.x, self.y)
569 }
570}
571
572impl PrintAsCssValue for StylePerspectiveOrigin {
573 fn print_as_css_value(&self) -> String {
574 format!("{} {}", self.x, self.y)
575 }
576}
577
578impl PrintAsCssValue for StyleBackfaceVisibility {
579 fn print_as_css_value(&self) -> String {
580 String::from(match self {
581 StyleBackfaceVisibility::Hidden => "hidden",
582 StyleBackfaceVisibility::Visible => "visible",
583 })
584 }
585}
586
587impl PrintAsCssValue for StyleTransform {
590 fn print_as_css_value(&self) -> String {
591 match self {
592 StyleTransform::Matrix(m) => format!(
593 "matrix({}, {}, {}, {}, {}, {})",
594 m.a, m.b, m.c, m.d, m.tx, m.ty
595 ),
596 StyleTransform::Matrix3D(m) => format!(
597 "matrix3d({}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {})",
598 m.m11,
599 m.m12,
600 m.m13,
601 m.m14,
602 m.m21,
603 m.m22,
604 m.m23,
605 m.m24,
606 m.m31,
607 m.m32,
608 m.m33,
609 m.m34,
610 m.m41,
611 m.m42,
612 m.m43,
613 m.m44
614 ),
615 StyleTransform::Translate(t) => format!("translate({}, {})", t.x, t.y),
616 StyleTransform::Translate3D(t) => format!("translate3d({}, {}, {})", t.x, t.y, t.z),
617 StyleTransform::TranslateX(x) => format!("translateX({})", x),
618 StyleTransform::TranslateY(y) => format!("translateY({})", y),
619 StyleTransform::TranslateZ(z) => format!("translateZ({})", z),
620 StyleTransform::Rotate(r) => format!("rotate({})", r),
621 StyleTransform::Rotate3D(r) => {
622 format!("rotate3d({}, {}, {}, {})", r.x, r.y, r.z, r.angle)
623 }
624 StyleTransform::RotateX(x) => format!("rotateX({})", x),
625 StyleTransform::RotateY(y) => format!("rotateY({})", y),
626 StyleTransform::RotateZ(z) => format!("rotateZ({})", z),
627 StyleTransform::Scale(s) => format!("scale({}, {})", s.x, s.y),
628 StyleTransform::Scale3D(s) => format!("scale3d({}, {}, {})", s.x, s.y, s.z),
629 StyleTransform::ScaleX(x) => format!("scaleX({})", x),
630 StyleTransform::ScaleY(y) => format!("scaleY({})", y),
631 StyleTransform::ScaleZ(z) => format!("scaleZ({})", z),
632 StyleTransform::Skew(sk) => format!("skew({}, {})", sk.x, sk.y),
633 StyleTransform::SkewX(x) => format!("skewX({})", x),
634 StyleTransform::SkewY(y) => format!("skewY({})", y),
635 StyleTransform::Perspective(dist) => format!("perspective({})", dist),
636 }
637 }
638}
639
640impl PrintAsCssValue for StyleBackgroundContent {
641 fn print_as_css_value(&self) -> String {
642 match self {
643 StyleBackgroundContent::LinearGradient(lg) => {
644 if lg.extend_mode == ExtendMode::Repeat {
645 format!("repeating-linear-gradient({})", lg.print_as_css_value())
646 } else {
647 format!("linear-gradient({})", lg.print_as_css_value())
648 }
649 }
650 StyleBackgroundContent::RadialGradient(rg) => {
651 if rg.extend_mode == ExtendMode::Repeat {
652 format!("repeating-radial-gradient({})", rg.print_as_css_value())
653 } else {
654 format!("radial-gradient({})", rg.print_as_css_value())
655 }
656 }
657 StyleBackgroundContent::ConicGradient(cg) => {
658 if cg.extend_mode == ExtendMode::Repeat {
659 format!("repeating-conic-gradient({})", cg.print_as_css_value())
660 } else {
661 format!("conic-gradient({})", cg.print_as_css_value())
662 }
663 }
664 StyleBackgroundContent::Image(id) => format!("url(\"{}\")", id.as_str()),
665 StyleBackgroundContent::Color(c) => c.to_hash(),
666 }
667 }
668}
669
670impl PrintAsCssValue for LinearGradient {
671 fn print_as_css_value(&self) -> String {
672 let t = if self.stops.is_empty() { "" } else { ", " };
673 format!(
674 "{}{}{}",
675 match self.direction {
676 Direction::Angle(a) => format!("{}", a),
677 Direction::FromTo(d) => format!("from {} to {}", d.from, d.to),
678 },
679 t,
680 self.stops
681 .iter()
682 .map(|s| s.print_as_css_value())
683 .collect::<Vec<_>>()
684 .join(", ")
685 )
686 }
687}
688
689impl PrintAsCssValue for NormalizedLinearColorStop {
690 fn print_as_css_value(&self) -> String {
691 format!("{}{}", self.offset, self.color.to_hash())
692 }
693}
694
695impl PrintAsCssValue for RadialGradient {
696 fn print_as_css_value(&self) -> String {
697 format!(
698 "{} {} at {}, {}",
699 match self.shape {
700 Shape::Ellipse => "ellipse",
701 Shape::Circle => "circle",
702 },
703 match self.size {
704 RadialGradientSize::ClosestSide => "closest-side",
705 RadialGradientSize::ClosestCorner => "closest-corner",
706 RadialGradientSize::FarthestSide => "farthest-side",
707 RadialGradientSize::FarthestCorner => "farthest-corner",
708 },
709 self.position.print_as_css_value(),
710 self.stops
711 .iter()
712 .map(|s| s.print_as_css_value())
713 .collect::<Vec<_>>()
714 .join(", ")
715 )
716 }
717}
718
719impl PrintAsCssValue for StyleBackgroundPosition {
720 fn print_as_css_value(&self) -> String {
721 format!(
722 "{} {}",
723 match self.horizontal {
724 BackgroundPositionHorizontal::Left => format!("left"),
725 BackgroundPositionHorizontal::Center => format!("center"),
726 BackgroundPositionHorizontal::Right => format!("right"),
727 BackgroundPositionHorizontal::Exact(px) => format!("{}", px),
728 },
729 match self.vertical {
730 BackgroundPositionVertical::Top => format!("top"),
731 BackgroundPositionVertical::Center => format!("center"),
732 BackgroundPositionVertical::Bottom => format!("bottom"),
733 BackgroundPositionVertical::Exact(px) => format!("{}", px),
734 }
735 )
736 }
737}
738
739impl PrintAsCssValue for StyleBackgroundSize {
740 fn print_as_css_value(&self) -> String {
741 match self {
742 StyleBackgroundSize::ExactSize(p) => format!("{} {}", p[0], p[1]),
743 StyleBackgroundSize::Contain => format!("contain"),
744 StyleBackgroundSize::Cover => format!("cover"),
745 }
746 }
747}
748
749impl PrintAsCssValue for NormalizedRadialColorStop {
750 fn print_as_css_value(&self) -> String {
751 format!("{}{}", self.angle, self.color.to_hash())
752 }
753}
754
755impl PrintAsCssValue for ConicGradient {
756 fn print_as_css_value(&self) -> String {
757 format!(
758 "from {} at {}, {}",
759 self.angle,
760 self.center.print_as_css_value(),
761 self.stops
762 .iter()
763 .map(|s| s.print_as_css_value())
764 .collect::<Vec<_>>()
765 .join(", ")
766 )
767 }
768}
769
770impl PrintAsCssValue for StyleBackgroundRepeat {
771 fn print_as_css_value(&self) -> String {
772 String::from(match self {
773 StyleBackgroundRepeat::NoRepeat => "no-repeat",
774 StyleBackgroundRepeat::Repeat => "repeat",
775 StyleBackgroundRepeat::RepeatX => "repeat-x",
776 StyleBackgroundRepeat::RepeatY => "repeat-y",
777 })
778 }
779}
780
781impl PrintAsCssValue for ScrollbarInfo {
782 fn print_as_css_value(&self) -> String {
783 format!(
784 "{} {} {} {} {} {} {} {}",
785 self.width,
786 self.padding_left,
787 self.padding_right,
788 self.track.print_as_css_value(),
789 self.thumb.print_as_css_value(),
790 self.button.print_as_css_value(),
791 self.corner.print_as_css_value(),
792 self.resizer.print_as_css_value(),
793 )
794 }
795}