Generalize the rest of layout to operate on generic Layout*.

There wasn't a good way to split this up, unfortunately.

With this change, the only remaining usage of the Servo-specific structures is
in layout_task, where the root node is received from the script task. \o/
This commit is contained in:
Bobby Holley 2015-11-20 09:51:05 -08:00
parent 77a8091996
commit cf33f00018
10 changed files with 198 additions and 156 deletions

View file

@ -19,11 +19,15 @@ use traversal::{BuildDisplayList, ComputeAbsolutePositions};
use traversal::{PostorderDomTraversal, PreorderDomTraversal};
use util::geometry::ZERO_POINT;
use util::opts;
use wrapper::{LayoutNode, ServoLayoutNode};
use wrapper::LayoutNode;
pub fn traverse_dom_preorder(root: ServoLayoutNode,
shared_layout_context: &SharedLayoutContext) {
fn doit(node: ServoLayoutNode, recalc_style: RecalcStyleForNode, construct_flows: ConstructFlows) {
pub fn traverse_dom_preorder<'le, N>(root: N,
shared_layout_context: &SharedLayoutContext)
where N: LayoutNode<'le> {
fn doit<'le, N>(node: N,
recalc_style: RecalcStyleForNode,
construct_flows: ConstructFlows)
where N: LayoutNode<'le> {
recalc_style.process(node);
for kid in node.children() {
@ -43,7 +47,7 @@ pub fn traverse_dom_preorder(root: ServoLayoutNode,
root: root.opaque(),
};
doit(root, recalc_style, construct_flows);
doit::<'le, N>(root, recalc_style, construct_flows);
}
pub fn resolve_generated_content(root: &mut FlowRef, shared_layout_context: &SharedLayoutContext) {