File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 5
5
//! Element nodes.
6
6
7
7
use app_units:: Au ;
8
+ use core:: ops:: Deref ;
8
9
use cssparser:: Color ;
9
10
use devtools_traits:: AttrInfo ;
10
11
use dom:: activation:: Activatable ;
@@ -670,6 +671,30 @@ impl Element {
670
671
pub fn update_inline_style ( & self ,
671
672
property_decl : PropertyDeclaration ,
672
673
style_priority : StylePriority ) {
674
+
675
+ let style_to_append = format ! ( "{}: {}; " , property_decl. name( ) , property_decl. value( ) ) ;
676
+ if let Some ( style_attr) = self . attrs . borrow ( ) . iter ( ) . find ( |a| a. name ( ) == & atom ! ( "style" ) ) {
677
+ let mut style_string = DOMString :: from ( style_attr. deref ( ) . value ( ) . deref ( ) . deref ( ) ) ;
678
+ style_string. push_str ( & style_to_append) ;
679
+
680
+ let new_value = AttrValue :: String ( style_string) ;
681
+ style_attr. set_value ( new_value, self ) ;
682
+ }
683
+ else {
684
+ let style_string = DOMString :: from_string ( style_to_append) ;
685
+ let window = window_from_node ( self ) ;
686
+
687
+ let attr = Attr :: new ( & window,
688
+ atom ! ( "style" ) ,
689
+ AttrValue :: String ( style_string) ,
690
+ atom ! ( "style" ) ,
691
+ ns ! ( ) ,
692
+ Some ( atom ! ( "style" ) ) ,
693
+ Some ( self ) ) ;
694
+
695
+ self . attrs . borrow_mut ( ) . push ( JS :: from_rooted ( & attr) ) ;
696
+ }
697
+
673
698
let mut inline_declarations = self . style_attribute ( ) . borrow_mut ( ) ;
674
699
if let & mut Some ( ref mut declarations) = & mut * inline_declarations {
675
700
let existing_declarations = if style_priority == StylePriority :: Important {
You can’t perform that action at this time.
0 commit comments