@@ -12,7 +12,8 @@ use crate::media_queries::Device;
1212use crate :: parser:: { Parse , ParserContext } ;
1313use crate :: values:: computed:: { Color as ComputedColor , Context , ToComputedValue } ;
1414use crate :: values:: generics:: color:: {
15- ColorMixFlags , GenericCaretColor , GenericColorMix , GenericColorOrAuto , GenericLightDark ,
15+ ColorMixFlags , GenericCaretColor , GenericColorMix , GenericColorMixItem , GenericColorOrAuto ,
16+ GenericLightDark ,
1617} ;
1718use crate :: values:: specified:: Percentage ;
1819use crate :: values:: { normalize, CustomIdent } ;
@@ -83,10 +84,14 @@ impl ColorMix {
8384 // to preserve floating point precision.
8485 Ok ( ColorMix {
8586 interpolation,
86- left,
87- left_percentage,
88- right,
89- right_percentage,
87+ left : GenericColorMixItem {
88+ color : left,
89+ percentage : left_percentage,
90+ } ,
91+ right : GenericColorMixItem {
92+ color : right,
93+ percentage : right_percentage,
94+ } ,
9095 flags : ColorMixFlags :: NORMALIZE_WEIGHTS | ColorMixFlags :: RESULT_IN_MODERN_SYNTAX ,
9196 } )
9297 } )
@@ -586,8 +591,13 @@ impl Color {
586591 && ld. dark . honored_in_forced_colors_mode ( allow_transparent)
587592 } ,
588593 Self :: ColorMix ( ref mix) => {
589- mix. left . honored_in_forced_colors_mode ( allow_transparent)
590- && mix. right . honored_in_forced_colors_mode ( allow_transparent)
594+ mix. left
595+ . color
596+ . honored_in_forced_colors_mode ( allow_transparent)
597+ && mix
598+ . right
599+ . color
600+ . honored_in_forced_colors_mode ( allow_transparent)
591601 } ,
592602 Self :: ContrastColor ( ref c) => c. honored_in_forced_colors_mode ( allow_transparent) ,
593603 }
@@ -625,14 +635,17 @@ impl Color {
625635 Self :: Absolute ( c) => Some ( c. color ) ,
626636 Self :: ColorFunction ( ref color_function) => color_function. resolve_to_absolute ( ) . ok ( ) ,
627637 Self :: ColorMix ( ref mix) => {
628- let left = mix. left . resolve_to_absolute ( ) ?;
629- let right = mix. right . resolve_to_absolute ( ) ?;
630- Some ( crate :: color:: mix:: mix (
638+ use crate :: color:: mix;
639+
640+ let left = mix. left . color . resolve_to_absolute ( ) ?;
641+ let right = mix. right . color . resolve_to_absolute ( ) ?;
642+
643+ Some ( mix:: mix_many (
631644 mix. interpolation ,
632- & left ,
633- mix. left_percentage . to_percentage ( ) ,
634- & right,
635- mix . right_percentage . to_percentage ( ) ,
645+ [
646+ mix:: ColorMixItem :: new ( left , mix . left . percentage . to_percentage ( ) ) ,
647+ mix :: ColorMixItem :: new ( right, mix . right . percentage . to_percentage ( ) ) ,
648+ ] ,
636649 mix. flags ,
637650 ) )
638651 } ,
@@ -783,15 +796,19 @@ impl Color {
783796 Color :: ColorMix ( ref mix) => {
784797 use crate :: values:: computed:: percentage:: Percentage ;
785798
786- let left = mix. left . to_computed_color ( context) ?;
787- let right = mix. right . to_computed_color ( context) ?;
799+ let left = mix. left . color . to_computed_color ( context) ?;
800+ let right = mix. right . color . to_computed_color ( context) ?;
788801
789802 ComputedColor :: from_color_mix ( GenericColorMix {
790803 interpolation : mix. interpolation ,
791- left,
792- left_percentage : Percentage ( mix. left_percentage . get ( ) ) ,
793- right,
794- right_percentage : Percentage ( mix. right_percentage . get ( ) ) ,
804+ left : GenericColorMixItem {
805+ color : left,
806+ percentage : Percentage ( mix. left . percentage . get ( ) ) ,
807+ } ,
808+ right : GenericColorMixItem {
809+ color : right,
810+ percentage : Percentage ( mix. right . percentage . get ( ) ) ,
811+ } ,
795812 flags : mix. flags ,
796813 } )
797814 } ,
0 commit comments