mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
script: Move the layout_wrapper outside of script.
This allows us to have ensure_data() and clear_data() functions on the TElement trait, instead of hacking around it adding methods in random traits. This also allows us to do some further cleanup, which I'd rather do in a followup.
This commit is contained in:
parent
f9642b36bd
commit
bf9369b29d
17 changed files with 128 additions and 166 deletions
|
@ -4,10 +4,8 @@
|
|||
|
||||
//! Gecko-specific bits for the styling DOM traversal.
|
||||
|
||||
use atomic_refcell::AtomicRefCell;
|
||||
use context::{SharedStyleContext, StyleContext};
|
||||
use data::ElementData;
|
||||
use dom::{NodeInfo, TNode};
|
||||
use dom::{NodeInfo, TNode, TElement};
|
||||
use gecko::wrapper::{GeckoElement, GeckoNode};
|
||||
use traversal::{DomTraversal, PerLevelTraversalData, TraversalDriver, recalc_style_at};
|
||||
|
||||
|
@ -36,7 +34,7 @@ impl<'recalc, 'le> DomTraversal<GeckoElement<'le>> for RecalcStyleOnly<'recalc>
|
|||
{
|
||||
if node.is_element() {
|
||||
let el = node.as_element().unwrap();
|
||||
let mut data = unsafe { el.ensure_data() }.borrow_mut();
|
||||
let mut data = unsafe { el.ensure_data() };
|
||||
recalc_style_at(self, traversal_data, context, el, &mut data);
|
||||
}
|
||||
}
|
||||
|
@ -48,14 +46,6 @@ impl<'recalc, 'le> DomTraversal<GeckoElement<'le>> for RecalcStyleOnly<'recalc>
|
|||
/// We don't use the post-order traversal for anything.
|
||||
fn needs_postorder_traversal() -> bool { false }
|
||||
|
||||
unsafe fn ensure_element_data<'a>(element: &'a GeckoElement<'le>) -> &'a AtomicRefCell<ElementData> {
|
||||
element.ensure_data()
|
||||
}
|
||||
|
||||
unsafe fn clear_element_data<'a>(element: &'a GeckoElement<'le>) {
|
||||
element.clear_data()
|
||||
}
|
||||
|
||||
fn shared_context(&self) -> &SharedStyleContext {
|
||||
&self.shared
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue