mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Pass pending restyles instead of draining them from layout
This commit is contained in:
parent
400c7012b1
commit
60ca98b753
7 changed files with 26 additions and 42 deletions
|
@ -50,7 +50,6 @@ use script::layout_exports::{
|
|||
LayoutDom, LayoutElementHelpers, LayoutNodeHelpers, LayoutShadowRootHelpers,
|
||||
RawLayoutElementHelpers,
|
||||
};
|
||||
use script_layout_interface::message::PendingRestyle;
|
||||
use script_layout_interface::wrapper_traits::{
|
||||
DangerousThreadSafeLayoutNode, GetLayoutData, LayoutNode,
|
||||
};
|
||||
|
@ -405,14 +404,6 @@ impl<'ld> ServoLayoutDocument<'ld> {
|
|||
.next()
|
||||
}
|
||||
|
||||
pub fn drain_pending_restyles(&self) -> Vec<(ServoLayoutElement<'ld>, PendingRestyle)> {
|
||||
let elements = unsafe { self.document.drain_pending_restyles() };
|
||||
elements
|
||||
.into_iter()
|
||||
.map(|(el, snapshot)| (ServoLayoutElement::from_layout_js(el), snapshot))
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn needs_paint_from_layout(&self) {
|
||||
unsafe { self.document.needs_paint_from_layout() }
|
||||
}
|
||||
|
|
|
@ -1450,17 +1450,19 @@ impl LayoutThread {
|
|||
guards.author.clone(),
|
||||
);
|
||||
|
||||
let restyles = document.drain_pending_restyles();
|
||||
let restyles = std::mem::take(&mut data.pending_restyles);
|
||||
debug!("Draining restyles: {}", restyles.len());
|
||||
|
||||
let mut map = SnapshotMap::new();
|
||||
let elements_with_snapshot: Vec<_> = restyles
|
||||
.iter()
|
||||
.filter(|r| r.1.snapshot.is_some())
|
||||
.map(|r| r.0)
|
||||
.map(|r| unsafe { ServoLayoutNode::new(&r.0).as_element().unwrap() })
|
||||
.collect();
|
||||
|
||||
for (el, restyle) in restyles {
|
||||
let el = unsafe { ServoLayoutNode::new(&el).as_element().unwrap() };
|
||||
|
||||
// Propagate the descendant bit up the ancestors. Do this before
|
||||
// the restyle calculation so that we can also do it for new
|
||||
// unstyled nodes, which the descendants bit helps us find.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue