mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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.
This commit is contained in:
commit
5c506f7a98
3 changed files with 31 additions and 5 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue