mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
parent
47744d95ad
commit
7fa7936657
9 changed files with 237 additions and 101 deletions
|
@ -1145,10 +1145,8 @@ impl LayoutTask {
|
|||
|
||||
let modified_elements = document.drain_modified_elements();
|
||||
if !needs_dirtying {
|
||||
for &(el, old_state) in modified_elements.iter() {
|
||||
let hint = rw_data.stylist.restyle_hint_for_state_change(&el,
|
||||
el.get_state(),
|
||||
old_state);
|
||||
for (el, snapshot) in modified_elements {
|
||||
let hint = rw_data.stylist.compute_restyle_hint(&el, &snapshot, el.get_state());
|
||||
el.note_restyle_hint(hint);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@ use selectors::states::*;
|
|||
use smallvec::VecLike;
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::{Ref, RefMut};
|
||||
use std::iter::FromIterator;
|
||||
use std::marker::PhantomData;
|
||||
use std::mem;
|
||||
use std::sync::Arc;
|
||||
|
@ -69,7 +68,7 @@ use style::legacy::UnsignedIntegerAttribute;
|
|||
use style::node::TElementAttributes;
|
||||
use style::properties::ComputedValues;
|
||||
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock};
|
||||
use style::restyle_hints::{RESTYLE_DESCENDANTS, RESTYLE_LATER_SIBLINGS, RESTYLE_SELF, RestyleHint};
|
||||
use style::restyle_hints::{ElementSnapshot, RESTYLE_DESCENDANTS, RESTYLE_LATER_SIBLINGS, RESTYLE_SELF, RestyleHint};
|
||||
use url::Url;
|
||||
use util::str::{is_whitespace, search_index};
|
||||
|
||||
|
@ -375,15 +374,13 @@ impl<'le> LayoutDocument<'le> {
|
|||
self.as_node().children().find(LayoutNode::is_element)
|
||||
}
|
||||
|
||||
pub fn drain_modified_elements(&self) -> Vec<(LayoutElement, ElementState)> {
|
||||
unsafe {
|
||||
let elements = self.document.drain_modified_elements();
|
||||
Vec::from_iter(elements.iter().map(|&(el, state)|
|
||||
(LayoutElement {
|
||||
element: el,
|
||||
chain: PhantomData,
|
||||
}, state)))
|
||||
}
|
||||
pub fn drain_modified_elements(&self) -> Vec<(LayoutElement, ElementSnapshot)> {
|
||||
let elements = unsafe { self.document.drain_modified_elements() };
|
||||
elements.into_iter().map(|(el, snapshot)|
|
||||
(LayoutElement {
|
||||
element: el,
|
||||
chain: PhantomData,
|
||||
}, snapshot)).collect()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue