mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Check modified event state from layout and dirty it there.
This adds some overhead, but also provides the small performance benefit of avoiding dirtying in the case where an event state is toggled an even number of times between reflows. The main benefit here though is that it sets us up to be smarter about what we mark as dirty using restyle hints.
This commit is contained in:
parent
441c84d75d
commit
069c40f788
6 changed files with 102 additions and 13 deletions
|
@ -957,16 +957,8 @@ impl Window {
|
|||
///
|
||||
/// TODO(pcwalton): Only wait for style recalc, since we have off-main-thread layout.
|
||||
pub fn reflow(&self, goal: ReflowGoal, query_type: ReflowQueryType, reason: ReflowReason) {
|
||||
let document = self.Document();
|
||||
let root = document.r().GetDocumentElement();
|
||||
let root = match root.r() {
|
||||
Some(root) => root,
|
||||
None => return,
|
||||
};
|
||||
|
||||
let root = root.upcast::<Node>();
|
||||
if query_type == ReflowQueryType::NoQuery && !root.get_has_dirty_descendants() {
|
||||
debug!("root has no dirty descendants; avoiding reflow (reason {:?})", reason);
|
||||
if query_type == ReflowQueryType::NoQuery && !self.Document().needs_reflow() {
|
||||
debug!("Document doesn't need reflow - skipping it (reason {:?})", reason);
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue