Restoring node dirty calls after properties are set to trigger mutations

This commit is contained in:
David Raifaizen 2016-05-18 22:23:06 -04:00 committed by Simon Sapin
parent 8b39260793
commit ff5cfb12a0

View file

@ -10,7 +10,7 @@ use dom::bindings::js::{JS, Root};
use dom::bindings::reflector::{Reflector, reflect_dom_object}; use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::str::DOMString; use dom::bindings::str::DOMString;
use dom::element::{Element, StylePriority}; use dom::element::{Element, StylePriority};
use dom::node::{Node, window_from_node}; use dom::node::{Node, NodeDamage, window_from_node};
use dom::window::Window; use dom::window::Window;
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use std::cell::Ref; use std::cell::Ref;
@ -246,6 +246,8 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
// Step 9 // Step 9
element.update_inline_style(declarations, priority); element.update_inline_style(declarations, priority);
let node = element.upcast::<Node>();
node.dirty(NodeDamage::NodeStyleDamaged);
Ok(()) Ok(())
} }
@ -278,6 +280,8 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
None => element.set_inline_style_property_priority(&[&*property], priority), None => element.set_inline_style_property_priority(&[&*property], priority),
} }
let node = element.upcast::<Node>();
node.dirty(NodeDamage::NodeStyleDamaged);
Ok(()) Ok(())
} }
@ -299,19 +303,22 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
// Step 3 // Step 3
let value = self.GetPropertyValue(property.clone()); let value = self.GetPropertyValue(property.clone());
let elem = self.owner.upcast::<Element>(); let element = self.owner.upcast::<Element>();
match Shorthand::from_name(&property) { match Shorthand::from_name(&property) {
// Step 4 // Step 4
Some(shorthand) => { Some(shorthand) => {
for longhand in shorthand.longhands() { for longhand in shorthand.longhands() {
elem.remove_inline_style_property(longhand) element.remove_inline_style_property(longhand)
} }
} }
// Step 5 // Step 5
None => elem.remove_inline_style_property(&property), None => element.remove_inline_style_property(&property),
} }
let node = element.upcast::<Node>();
node.dirty(NodeDamage::NodeStyleDamaged);
// Step 6 // Step 6
Ok(value) Ok(value)
} }