@@ -25,7 +25,7 @@ const COMBINED_CSS_PROPERTIES_KEY_MAP: [(CombinedCssPropertyType, &'static str);
25
25
] ;
26
26
27
27
/// Map between CSS keys and a statically typed enum
28
- const CSS_PROPERTY_KEY_MAP : [ ( CssPropertyType , & ' static str ) ; 72 ] = [
28
+ const CSS_PROPERTY_KEY_MAP : [ ( CssPropertyType , & ' static str ) ; 70 ] = [
29
29
30
30
( CssPropertyType :: Display , "display" ) ,
31
31
( CssPropertyType :: Float , "float" ) ,
@@ -76,9 +76,7 @@ const CSS_PROPERTY_KEY_MAP: [(CssPropertyType, &'static str);72] = [
76
76
( CssPropertyType :: MarginRight , "margin-right" ) ,
77
77
( CssPropertyType :: MarginBottom , "margin-bottom" ) ,
78
78
79
- ( CssPropertyType :: Background , "background" ) ,
80
- ( CssPropertyType :: BackgroundImage , "background-image" ) ,
81
- ( CssPropertyType :: BackgroundColor , "background-color" ) ,
79
+ ( CssPropertyType :: BackgroundContent , "background" ) ,
82
80
( CssPropertyType :: BackgroundPosition , "background-position" ) ,
83
81
( CssPropertyType :: BackgroundSize , "background-size" ) ,
84
82
( CssPropertyType :: BackgroundRepeat , "background-repeat" ) ,
@@ -103,12 +101,12 @@ const CSS_PROPERTY_KEY_MAP: [(CssPropertyType, &'static str);72] = [
103
101
( CssPropertyType :: BorderLeftWidth , "border-left-width" ) ,
104
102
( CssPropertyType :: BorderBottomWidth , "border-bottom-width" ) ,
105
103
106
- ( CssPropertyType :: BoxShadowTop , "box-shadow-top" ) ,
107
- ( CssPropertyType :: BoxShadowRight , "box-shadow-right" ) ,
108
- ( CssPropertyType :: BoxShadowLeft , "box-shadow-left" ) ,
109
- ( CssPropertyType :: BoxShadowBottom , "box-shadow-bottom" ) ,
104
+ ( CssPropertyType :: BoxShadowTop , "-azul- box-shadow-top" ) ,
105
+ ( CssPropertyType :: BoxShadowRight , "-azul- box-shadow-right" ) ,
106
+ ( CssPropertyType :: BoxShadowLeft , "-azul- box-shadow-left" ) ,
107
+ ( CssPropertyType :: BoxShadowBottom , "-azul- box-shadow-bottom" ) ,
110
108
111
- ( CssPropertyType :: ScrollbarStyle , "scrollbar-style" ) , // TODO: non-standard
109
+ ( CssPropertyType :: ScrollbarStyle , "-azul- scrollbar-style" ) ,
112
110
113
111
( CssPropertyType :: Opacity , "opacity" ) ,
114
112
( CssPropertyType :: Transform , "transform" ) ,
@@ -689,18 +687,15 @@ pub fn get_css_key_map() -> CssKeyMap {
689
687
#[ derive( Debug , Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
690
688
#[ repr( C ) ]
691
689
pub enum CssPropertyType {
692
-
693
690
TextColor ,
694
691
FontSize ,
695
692
FontFamily ,
696
693
TextAlign ,
697
-
698
694
LetterSpacing ,
699
695
LineHeight ,
700
696
WordSpacing ,
701
697
TabWidth ,
702
698
Cursor ,
703
-
704
699
Display ,
705
700
Float ,
706
701
BoxSizing ,
@@ -710,75 +705,58 @@ pub enum CssPropertyType {
710
705
MinHeight ,
711
706
MaxWidth ,
712
707
MaxHeight ,
713
-
714
708
Position ,
715
709
Top ,
716
710
Right ,
717
711
Left ,
718
712
Bottom ,
719
-
720
713
FlexWrap ,
721
714
FlexDirection ,
722
715
FlexGrow ,
723
716
FlexShrink ,
724
717
JustifyContent ,
725
718
AlignItems ,
726
719
AlignContent ,
727
-
720
+ BackgroundContent ,
721
+ BackgroundPosition ,
722
+ BackgroundSize ,
723
+ BackgroundRepeat ,
728
724
OverflowX ,
729
725
OverflowY ,
730
-
731
726
PaddingTop ,
732
727
PaddingLeft ,
733
728
PaddingRight ,
734
729
PaddingBottom ,
735
-
736
730
MarginTop ,
737
731
MarginLeft ,
738
732
MarginRight ,
739
733
MarginBottom ,
740
-
741
- Background ,
742
- BackgroundImage , // -> BackgroundContent::Image
743
- BackgroundColor , // -> BackgroundContent::Color
744
- BackgroundPosition ,
745
- BackgroundSize ,
746
- BackgroundRepeat ,
747
-
748
734
BorderTopLeftRadius ,
749
735
BorderTopRightRadius ,
750
736
BorderBottomLeftRadius ,
751
737
BorderBottomRightRadius ,
752
-
753
738
BorderTopColor ,
754
739
BorderRightColor ,
755
740
BorderLeftColor ,
756
741
BorderBottomColor ,
757
-
758
742
BorderTopStyle ,
759
743
BorderRightStyle ,
760
744
BorderLeftStyle ,
761
745
BorderBottomStyle ,
762
-
763
746
BorderTopWidth ,
764
747
BorderRightWidth ,
765
748
BorderLeftWidth ,
766
749
BorderBottomWidth ,
767
-
768
750
BoxShadowLeft ,
769
751
BoxShadowRight ,
770
752
BoxShadowTop ,
771
753
BoxShadowBottom ,
772
-
773
754
ScrollbarStyle ,
774
-
775
- // GPU properties:
776
755
Opacity ,
777
756
Transform ,
778
- PerspectiveOrigin ,
779
757
TransformOrigin ,
758
+ PerspectiveOrigin ,
780
759
BackfaceVisibility ,
781
- // Color? - update webrender to use GPU colors
782
760
}
783
761
784
762
impl CssPropertyType {
@@ -832,9 +810,7 @@ impl CssPropertyType {
832
810
CssPropertyType :: JustifyContent => "justify-content" ,
833
811
CssPropertyType :: AlignItems => "align-items" ,
834
812
CssPropertyType :: AlignContent => "align-content" ,
835
- CssPropertyType :: Background => "background" ,
836
- CssPropertyType :: BackgroundColor => "background" ,
837
- CssPropertyType :: BackgroundImage => "background" ,
813
+ CssPropertyType :: BackgroundContent => "background" ,
838
814
CssPropertyType :: BackgroundPosition => "background-position" ,
839
815
CssPropertyType :: BackgroundSize => "background-size" ,
840
816
CssPropertyType :: BackgroundRepeat => "background-repeat" ,
@@ -904,11 +880,10 @@ impl CssPropertyType {
904
880
match self {
905
881
| TextColor
906
882
| Cursor
907
- | Background
883
+ | BackgroundContent
908
884
| BackgroundPosition
909
885
| BackgroundSize
910
886
| BackgroundRepeat
911
- | BackgroundImage
912
887
| BorderTopLeftRadius
913
888
| BorderTopRightRadius
914
889
| BorderBottomLeftRadius
@@ -951,88 +926,71 @@ impl fmt::Display for CssPropertyType {
951
926
#[ derive( Debug , Clone , PartialEq , Eq , Hash , PartialOrd , Ord ) ]
952
927
#[ repr( C , u8 ) ]
953
928
pub enum CssProperty {
954
-
955
929
TextColor ( CssPropertyValue < StyleTextColor > ) ,
956
930
FontSize ( CssPropertyValue < StyleFontSize > ) ,
957
931
FontFamily ( CssPropertyValue < StyleFontFamily > ) ,
958
932
TextAlign ( CssPropertyValue < StyleTextAlignmentHorz > ) ,
959
-
960
933
LetterSpacing ( CssPropertyValue < StyleLetterSpacing > ) ,
961
934
LineHeight ( CssPropertyValue < StyleLineHeight > ) ,
962
935
WordSpacing ( CssPropertyValue < StyleWordSpacing > ) ,
963
936
TabWidth ( CssPropertyValue < StyleTabWidth > ) ,
964
937
Cursor ( CssPropertyValue < StyleCursor > ) ,
965
-
966
938
Display ( CssPropertyValue < LayoutDisplay > ) ,
967
939
Float ( CssPropertyValue < LayoutFloat > ) ,
968
940
BoxSizing ( CssPropertyValue < LayoutBoxSizing > ) ,
969
-
970
941
Width ( CssPropertyValue < LayoutWidth > ) ,
971
942
Height ( CssPropertyValue < LayoutHeight > ) ,
972
943
MinWidth ( CssPropertyValue < LayoutMinWidth > ) ,
973
944
MinHeight ( CssPropertyValue < LayoutMinHeight > ) ,
974
945
MaxWidth ( CssPropertyValue < LayoutMaxWidth > ) ,
975
946
MaxHeight ( CssPropertyValue < LayoutMaxHeight > ) ,
976
-
977
947
Position ( CssPropertyValue < LayoutPosition > ) ,
978
948
Top ( CssPropertyValue < LayoutTop > ) ,
979
949
Right ( CssPropertyValue < LayoutRight > ) ,
980
950
Left ( CssPropertyValue < LayoutLeft > ) ,
981
951
Bottom ( CssPropertyValue < LayoutBottom > ) ,
982
-
983
952
FlexWrap ( CssPropertyValue < LayoutFlexWrap > ) ,
984
953
FlexDirection ( CssPropertyValue < LayoutFlexDirection > ) ,
985
954
FlexGrow ( CssPropertyValue < LayoutFlexGrow > ) ,
986
955
FlexShrink ( CssPropertyValue < LayoutFlexShrink > ) ,
987
956
JustifyContent ( CssPropertyValue < LayoutJustifyContent > ) ,
988
957
AlignItems ( CssPropertyValue < LayoutAlignItems > ) ,
989
958
AlignContent ( CssPropertyValue < LayoutAlignContent > ) ,
990
-
991
959
BackgroundContent ( CssPropertyValue < StyleBackgroundContentVec > ) ,
992
960
BackgroundPosition ( CssPropertyValue < StyleBackgroundPositionVec > ) ,
993
961
BackgroundSize ( CssPropertyValue < StyleBackgroundSizeVec > ) ,
994
962
BackgroundRepeat ( CssPropertyValue < StyleBackgroundRepeatVec > ) ,
995
-
996
963
OverflowX ( CssPropertyValue < LayoutOverflow > ) ,
997
964
OverflowY ( CssPropertyValue < LayoutOverflow > ) ,
998
-
999
965
PaddingTop ( CssPropertyValue < LayoutPaddingTop > ) ,
1000
966
PaddingLeft ( CssPropertyValue < LayoutPaddingLeft > ) ,
1001
967
PaddingRight ( CssPropertyValue < LayoutPaddingRight > ) ,
1002
968
PaddingBottom ( CssPropertyValue < LayoutPaddingBottom > ) ,
1003
-
1004
969
MarginTop ( CssPropertyValue < LayoutMarginTop > ) ,
1005
970
MarginLeft ( CssPropertyValue < LayoutMarginLeft > ) ,
1006
971
MarginRight ( CssPropertyValue < LayoutMarginRight > ) ,
1007
972
MarginBottom ( CssPropertyValue < LayoutMarginBottom > ) ,
1008
-
1009
973
BorderTopLeftRadius ( CssPropertyValue < StyleBorderTopLeftRadius > ) ,
1010
974
BorderTopRightRadius ( CssPropertyValue < StyleBorderTopRightRadius > ) ,
1011
975
BorderBottomLeftRadius ( CssPropertyValue < StyleBorderBottomLeftRadius > ) ,
1012
976
BorderBottomRightRadius ( CssPropertyValue < StyleBorderBottomRightRadius > ) ,
1013
-
1014
977
BorderTopColor ( CssPropertyValue < StyleBorderTopColor > ) ,
1015
978
BorderRightColor ( CssPropertyValue < StyleBorderRightColor > ) ,
1016
979
BorderLeftColor ( CssPropertyValue < StyleBorderLeftColor > ) ,
1017
980
BorderBottomColor ( CssPropertyValue < StyleBorderBottomColor > ) ,
1018
-
1019
981
BorderTopStyle ( CssPropertyValue < StyleBorderTopStyle > ) ,
1020
982
BorderRightStyle ( CssPropertyValue < StyleBorderRightStyle > ) ,
1021
983
BorderLeftStyle ( CssPropertyValue < StyleBorderLeftStyle > ) ,
1022
984
BorderBottomStyle ( CssPropertyValue < StyleBorderBottomStyle > ) ,
1023
-
1024
985
BorderTopWidth ( CssPropertyValue < LayoutBorderTopWidth > ) ,
1025
986
BorderRightWidth ( CssPropertyValue < LayoutBorderRightWidth > ) ,
1026
987
BorderLeftWidth ( CssPropertyValue < LayoutBorderLeftWidth > ) ,
1027
988
BorderBottomWidth ( CssPropertyValue < LayoutBorderBottomWidth > ) ,
1028
-
1029
989
BoxShadowLeft ( CssPropertyValue < StyleBoxShadow > ) ,
1030
990
BoxShadowRight ( CssPropertyValue < StyleBoxShadow > ) ,
1031
991
BoxShadowTop ( CssPropertyValue < StyleBoxShadow > ) ,
1032
992
BoxShadowBottom ( CssPropertyValue < StyleBoxShadow > ) ,
1033
-
1034
993
ScrollbarStyle ( CssPropertyValue < ScrollbarStyle > ) ,
1035
-
1036
994
Opacity ( CssPropertyValue < StyleOpacity > ) ,
1037
995
Transform ( CssPropertyValue < StyleTransformVec > ) ,
1038
996
TransformOrigin ( CssPropertyValue < StyleTransformOrigin > ) ,
@@ -1176,9 +1134,7 @@ macro_rules! css_property_from_type {($prop_type:expr, $content_type:ident) => (
1176
1134
CssPropertyType :: MarginLeft => CssProperty :: MarginLeft ( CssPropertyValue :: $content_type) ,
1177
1135
CssPropertyType :: MarginRight => CssProperty :: MarginRight ( CssPropertyValue :: $content_type) ,
1178
1136
CssPropertyType :: MarginBottom => CssProperty :: MarginBottom ( CssPropertyValue :: $content_type) ,
1179
- CssPropertyType :: Background => CssProperty :: BackgroundContent ( CssPropertyValue :: $content_type) ,
1180
- CssPropertyType :: BackgroundImage => CssProperty :: BackgroundContent ( CssPropertyValue :: $content_type) , // -> BackgroundContent::Image
1181
- CssPropertyType :: BackgroundColor => CssProperty :: BackgroundContent ( CssPropertyValue :: $content_type) , // -> BackgroundContent::Color
1137
+ CssPropertyType :: BackgroundContent => CssProperty :: BackgroundContent ( CssPropertyValue :: $content_type) ,
1182
1138
CssPropertyType :: BackgroundPosition => CssProperty :: BackgroundPosition ( CssPropertyValue :: $content_type) ,
1183
1139
CssPropertyType :: BackgroundSize => CssProperty :: BackgroundSize ( CssPropertyValue :: $content_type) ,
1184
1140
CssPropertyType :: BackgroundRepeat => CssProperty :: BackgroundRepeat ( CssPropertyValue :: $content_type) ,
@@ -1246,7 +1202,7 @@ impl CssProperty {
1246
1202
CssProperty :: JustifyContent ( _) => CssPropertyType :: JustifyContent ,
1247
1203
CssProperty :: AlignItems ( _) => CssPropertyType :: AlignItems ,
1248
1204
CssProperty :: AlignContent ( _) => CssPropertyType :: AlignContent ,
1249
- CssProperty :: BackgroundContent ( _) => CssPropertyType :: BackgroundImage , // TODO: wrong!
1205
+ CssProperty :: BackgroundContent ( _) => CssPropertyType :: BackgroundContent ,
1250
1206
CssProperty :: BackgroundPosition ( _) => CssPropertyType :: BackgroundPosition ,
1251
1207
CssProperty :: BackgroundSize ( _) => CssPropertyType :: BackgroundSize ,
1252
1208
CssProperty :: BackgroundRepeat ( _) => CssPropertyType :: BackgroundRepeat ,
@@ -1368,7 +1324,7 @@ impl CssProperty {
1368
1324
1369
1325
// functions that downcast to the concrete CSS type (style)
1370
1326
1371
- pub const fn as_background ( & self ) -> Option < & StyleBackgroundContentVecValue > { match self { CssProperty :: BackgroundContent ( f) => Some ( f) , _ => None , } }
1327
+ pub const fn as_background_content ( & self ) -> Option < & StyleBackgroundContentVecValue > { match self { CssProperty :: BackgroundContent ( f) => Some ( f) , _ => None , } }
1372
1328
pub const fn as_background_position ( & self ) -> Option < & StyleBackgroundPositionVecValue > { match self { CssProperty :: BackgroundPosition ( f) => Some ( f) , _ => None , } }
1373
1329
pub const fn as_background_size ( & self ) -> Option < & StyleBackgroundSizeVecValue > { match self { CssProperty :: BackgroundSize ( f) => Some ( f) , _ => None , } }
1374
1330
pub const fn as_background_repeat ( & self ) -> Option < & StyleBackgroundRepeatVecValue > { match self { CssProperty :: BackgroundRepeat ( f) => Some ( f) , _ => None , } }
0 commit comments