Allow setting id, class, style without a full reflow

Instead we do selector matching again, then diff the style structs to set the
"restyle damage" bits which are used to prune reflow traversals.

Also don't force a reflow when timers finish, because individual DOM methods
should already take care of that.
This commit is contained in:
Keegan McAllister 2013-12-10 15:15:43 -08:00
parent 93e10eaf20
commit 0238410b47
4 changed files with 16 additions and 9 deletions

View file

@ -18,7 +18,8 @@ use dom::document;
use dom::namespace;
use dom::namespace::Namespace;
use layout_interface::{ContentBoxQuery, ContentBoxResponse, ContentBoxesQuery};
use layout_interface::{ContentBoxesResponse};
use layout_interface::{ContentBoxesResponse, ContentChangedDocumentDamage};
use layout_interface::{MatchSelectorsDocumentDamage};
use style;
use servo_util::tree::{TreeNodeRef, ElementLike};
@ -293,8 +294,12 @@ impl<'self> Element {
}
if abstract_self.is_in_doc() {
let damage = match local_name.as_slice() {
"style" | "id" | "class" => MatchSelectorsDocumentDamage,
_ => ContentChangedDocumentDamage
};
let document = self.node.owner_doc();
document.document().content_changed();
document.document().damage_and_reflow(damage);
}
}
}