servo: Merge #10391 - Inlined content_changed (from autrilla:inline-content-changed); r=Ms2ger

cc @Ms2ger

Source-Repo: https://github.com/servo/servo
Source-Revision: b568b72d760623462fe1a19544e1ad59f98e4480
This commit is contained in:
Adrian Utrilla 2016-04-05 01:08:55 +05:01
parent cfdb9792b3
commit 340cfcacf8
6 changed files with 13 additions and 22 deletions

View File

@ -65,7 +65,7 @@ impl CharacterData {
fn content_changed(&self) {
let node = self.upcast::<Node>();
node.owner_doc().content_changed(node, NodeDamage::OtherNodeDamage);
node.dirty(NodeDamage::OtherNodeDamage);
}
}

View File

@ -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, NodeDamage, document_from_node, window_from_node};
use dom::node::{Node, NodeDamage, window_from_node};
use dom::window::Window;
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
@ -257,9 +257,8 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
element.update_inline_style(decl, priority);
}
let document = document_from_node(element);
let node = element.upcast();
document.content_changed(node, NodeDamage::NodeStyleDamaged);
let node = element.upcast::<Node>();
node.dirty(NodeDamage::NodeStyleDamaged);
Ok(())
}
@ -292,9 +291,8 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
None => element.set_inline_style_property_priority(&[&*property], priority),
}
let document = document_from_node(element);
let node = element.upcast();
document.content_changed(node, NodeDamage::NodeStyleDamaged);
let node = element.upcast::<Node>();
node.dirty(NodeDamage::NodeStyleDamaged);
Ok(())
}
@ -329,9 +327,8 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
None => elem.remove_inline_style_property(&property),
}
let document = document_from_node(elem);
let node = elem.upcast();
document.content_changed(node, NodeDamage::NodeStyleDamaged);
let node = elem.upcast::<Node>();
node.dirty(NodeDamage::NodeStyleDamaged);
// Step 6
Ok(value)

View File

@ -400,10 +400,6 @@ impl Document {
self.encoding.set(encoding);
}
pub fn content_changed(&self, node: &Node, damage: NodeDamage) {
node.dirty(damage);
}
pub fn content_and_heritage_changed(&self, node: &Node, damage: NodeDamage) {
node.force_dirty_ancestors(damage);
}

View File

@ -1690,7 +1690,7 @@ impl VirtualMethods for Element {
parse_style_attribute(&value, &doc.base_url(), win.css_error_reporter())
});
if node.is_in_doc() {
doc.content_changed(node, NodeDamage::NodeStyleDamaged);
node.dirty(NodeDamage::NodeStyleDamaged);
}
},
&atom!("id") => {
@ -1728,7 +1728,7 @@ impl VirtualMethods for Element {
common_style_affecting_attributes().iter().any(|a| &a.atom == attr.local_name()) ||
rare_style_affecting_attributes().iter().any(|a| a == attr.local_name())
{
doc.content_changed(node, NodeDamage::OtherNodeDamage);
node.dirty(NodeDamage::OtherNodeDamage);
}
},
_ => {},
@ -2111,8 +2111,7 @@ impl Element {
pub fn set_focus_state(&self, value: bool) {
self.set_state(IN_FOCUS_STATE, value);
let doc = document_from_node(self);
doc.content_changed(self.upcast(), NodeDamage::OtherNodeDamage);
self.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
}
pub fn get_hover_state(&self) -> bool {

View File

@ -81,7 +81,7 @@ impl Runnable for ImageResponseHandlerRunnable {
// Mark the node dirty
let document = document_from_node(&*element);
document.content_changed(element.upcast(), NodeDamage::OtherNodeDamage);
element.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
// Fire image.onload
if trigger_image_load {

View File

@ -2117,8 +2117,7 @@ impl ScriptThread {
// Kick off the initial reflow of the page.
debug!("kicking off initial reflow of {:?}", final_url);
document.disarm_reflow_timeout();
document.content_changed(document.upcast(),
NodeDamage::OtherNodeDamage);
document.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
let window = window_from_node(document.r());
window.reflow(ReflowGoal::ForDisplay, ReflowQueryType::NoQuery, ReflowReason::FirstLoad);