mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Make RecalcStyleAndConstructFlows generic over the LayoutNode implementation.
This commit is contained in:
parent
a8bb3d8d22
commit
0c726cfe6b
1 changed files with 11 additions and 4 deletions
|
@ -14,19 +14,26 @@ use script_layout_interface::restyle_damage::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_
|
|||
use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
|
||||
use std::mem;
|
||||
use style::context::StyleContext;
|
||||
use style::dom::TNode;
|
||||
use style::matching::MatchMethods;
|
||||
use style::properties::ServoComputedValues;
|
||||
use style::selector_impl::ServoSelectorImpl;
|
||||
use style::traversal::{DomTraversalContext, STYLE_BLOOM};
|
||||
use style::traversal::{put_thread_local_bloom_filter, recalc_style_at};
|
||||
use util::opts;
|
||||
use util::tid::tid;
|
||||
use wrapper::{LayoutNodeLayoutData, ServoLayoutNode, ThreadSafeLayoutNodeHelpers};
|
||||
use wrapper::{LayoutNodeLayoutData, ThreadSafeLayoutNodeHelpers};
|
||||
|
||||
pub struct RecalcStyleAndConstructFlows<'lc> {
|
||||
context: LayoutContext<'lc>,
|
||||
root: OpaqueNode,
|
||||
}
|
||||
|
||||
impl<'lc, 'ln> DomTraversalContext<ServoLayoutNode<'ln>> for RecalcStyleAndConstructFlows<'lc> {
|
||||
impl<'lc, N> DomTraversalContext<N> for RecalcStyleAndConstructFlows<'lc>
|
||||
where N: LayoutNode + TNode<ConcreteComputedValues=ServoComputedValues>,
|
||||
N::ConcreteElement: ::selectors::Element<Impl=ServoSelectorImpl>
|
||||
|
||||
{
|
||||
type SharedContext = SharedLayoutContext;
|
||||
#[allow(unsafe_code)]
|
||||
fn new<'a>(shared: &'a Self::SharedContext, root: OpaqueNode) -> Self {
|
||||
|
@ -66,7 +73,7 @@ impl<'lc, 'ln> DomTraversalContext<ServoLayoutNode<'ln>> for RecalcStyleAndConst
|
|||
}
|
||||
}
|
||||
|
||||
fn process_preorder(&self, node: ServoLayoutNode<'ln>) {
|
||||
fn process_preorder(&self, node: N) {
|
||||
// FIXME(pcwalton): Stop allocating here. Ideally this should just be done by the HTML
|
||||
// parser.
|
||||
node.initialize_data();
|
||||
|
@ -74,7 +81,7 @@ impl<'lc, 'ln> DomTraversalContext<ServoLayoutNode<'ln>> for RecalcStyleAndConst
|
|||
recalc_style_at(&self.context, self.root, node);
|
||||
}
|
||||
|
||||
fn process_postorder(&self, node: ServoLayoutNode<'ln>) { construct_flows_at(&self.context, self.root, node); }
|
||||
fn process_postorder(&self, node: N) { construct_flows_at(&self.context, self.root, node); }
|
||||
}
|
||||
|
||||
/// A bottom-up, parallelizable traversal.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue