@@ -90,7 +90,10 @@ pub struct EditTextData<'gc> {
90
90
/// If this is a password input field
91
91
is_password : bool ,
92
92
93
- /// The color of the background fill. Only applied when has_border.
93
+ /// If the text field should have a background. Only applied when has_border.
94
+ has_background : bool ,
95
+
96
+ /// The color of the background fill. Only applied when has_border and has_background.
94
97
background_color : u32 ,
95
98
96
99
/// If the text field should have a border.
@@ -195,6 +198,7 @@ impl<'gc> EditText<'gc> {
195
198
swf_tag. is_device_font ,
196
199
) ;
197
200
201
+ let has_background = false ;
198
202
let background_color = 0xFFFFFF ; // Default is white
199
203
let has_border = swf_tag. has_border ;
200
204
let border_color = 0 ; // Default is black
@@ -252,6 +256,7 @@ impl<'gc> EditText<'gc> {
252
256
is_editable,
253
257
is_word_wrap,
254
258
is_password,
259
+ has_background,
255
260
background_color,
256
261
has_border,
257
262
border_color,
@@ -513,6 +518,15 @@ impl<'gc> EditText<'gc> {
513
518
self . relayout ( context) ;
514
519
}
515
520
521
+ pub fn has_background ( self ) -> bool {
522
+ self . 0 . read ( ) . has_background
523
+ }
524
+
525
+ pub fn set_has_background ( self , context : MutationContext < ' gc , ' _ > , has_background : bool ) {
526
+ self . 0 . write ( context) . has_background = has_background;
527
+ self . redraw_border ( context) ;
528
+ }
529
+
516
530
pub fn background_color ( self ) -> u32 {
517
531
self . 0 . read ( ) . background_color
518
532
}
@@ -673,12 +687,16 @@ impl<'gc> EditText<'gc> {
673
687
Twips :: new ( 1 ) ,
674
688
swf:: Color :: from_rgb ( border_color, 0xFF ) ,
675
689
) ) ) ;
676
- write
677
- . drawing
678
- . set_fill_style ( Some ( swf:: FillStyle :: Color ( swf:: Color :: from_rgb (
679
- background_color,
680
- 0xFF ,
681
- ) ) ) ) ;
690
+ if write. has_background {
691
+ write
692
+ . drawing
693
+ . set_fill_style ( Some ( swf:: FillStyle :: Color ( swf:: Color :: from_rgb (
694
+ background_color,
695
+ 0xFF ,
696
+ ) ) ) ) ;
697
+ } else {
698
+ write. drawing . set_fill_style ( None ) ;
699
+ }
682
700
write. drawing . draw_command ( DrawCommand :: MoveTo {
683
701
x : Twips :: new ( 0 ) ,
684
702
y : Twips :: new ( 0 ) ,
0 commit comments