aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/document.rs
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2014-12-08 12:28:14 -0700
committerbors-servo <metajack+bors@gmail.com>2014-12-08 12:28:14 -0700
commit5c506f7a98368020c7936517f1d8e243c9556937 (patch)
tree315cf319f15a8ca92bc6807ee962443ad247ac8a /components/script/dom/document.rs
parentf18c18371d2bb5edde9d64e46b74bf01411afab3 (diff)
parentd3e4d293687d51504f68323228bfbab972aa0f2f (diff)
downloadservo-5c506f7a98368020c7936517f1d8e243c9556937.tar.gz
servo-5c506f7a98368020c7936517f1d8e243c9556937.zip
auto merge of #4194 : cgaebel/servo/incremental-reflow-fix, r=pcwalton
When inserting a node that was already dirtied, the dirtying logic would short circuit: "This node is already dirty? Great! Then its parents must be HAS_DIRTY_DESCENDANTS, too! Let's skip that step." This isn't appropriate when nodes move around the tree. In that case, the node may be marked HAS_CHANGED, but ancestors may not yet have the HAS_DIRTY_DESCENDANTS flag set. This patch adds a `content_and_heritage_changed` hook in the document, to deal with these cases appropriately.
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r--components/script/dom/document.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 174a43af664..84016cf75fa 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -177,6 +177,7 @@ pub trait DocumentHelpers<'a> {
fn set_last_modified(self, value: DOMString);
fn set_encoding_name(self, name: DOMString);
fn content_changed(self, node: JSRef<Node>);
+ fn content_and_heritage_changed(self, node: JSRef<Node>);
fn reflow(self);
fn wait_until_safe_to_modify_dom(self);
fn unregister_named_element(self, to_unregister: JSRef<Element>, id: Atom);
@@ -227,10 +228,17 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
}
fn content_changed(self, node: JSRef<Node>) {
+ debug!("content_changed on {}", node.debug_str());
node.dirty();
self.reflow();
}
+ fn content_and_heritage_changed(self, node: JSRef<Node>) {
+ debug!("content_and_heritage_changed on {}", node.debug_str());
+ node.force_dirty_ancestors();
+ self.reflow();
+ }
+
fn reflow(self) {
self.window.root().reflow();
}