Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding sync method to update atrr from inline style updates #9410

Closed
wants to merge 15 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Restoring node dirty calls after properties are set to trigger mutations

  • Loading branch information
craftytrickster committed May 19, 2016
commit b40e0972827765bf95b8dfbd3da47660b3038c33
@@ -9,7 +9,7 @@ use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, Root};
use dom::bindings::reflector::{Reflector, reflect_dom_object};
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 std::ascii::AsciiExt;
use std::cell::Ref;
@@ -243,6 +243,8 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
// Step 9
element.update_inline_style(declarations, priority);

let node = element.upcast::<Node>();
node.dirty(NodeDamage::NodeStyleDamaged);
Ok(())
}

@@ -275,6 +277,8 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
None => element.set_inline_style_property_priority(&[&*property], priority),
}

let node = element.upcast::<Node>();
node.dirty(NodeDamage::NodeStyleDamaged);
Ok(())
}

@@ -296,19 +300,22 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
// Step 3
let value = self.GetPropertyValue(property.clone());

let elem = self.owner.upcast::<Element>();
let element = self.owner.upcast::<Element>();

match Shorthand::from_name(&property) {
// Step 4
Some(shorthand) => {
for longhand in shorthand.longhands() {
elem.remove_inline_style_property(longhand)
element.remove_inline_style_property(longhand)
}
}
// 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
Ok(value)
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.