mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Owned ServoArc<ComputedValues>
in TraversalHandler
This commit is contained in:
parent
29005e1626
commit
fff5cd5142
3 changed files with 19 additions and 29 deletions
|
@ -64,14 +64,14 @@ where
|
|||
&mut self,
|
||||
node: Node,
|
||||
text: Cow<'dom, str>,
|
||||
parent_style: &ServoArc<ComputedValues>,
|
||||
parent_style: ServoArc<ComputedValues>,
|
||||
);
|
||||
|
||||
/// Or pseudo-element
|
||||
fn handle_element(
|
||||
&mut self,
|
||||
node: Node,
|
||||
style: &ServoArc<ComputedValues>,
|
||||
style: ServoArc<ComputedValues>,
|
||||
display: DisplayGeneratingBox,
|
||||
contents: Contents,
|
||||
box_slot: BoxSlot<'dom>,
|
||||
|
@ -89,7 +89,7 @@ fn traverse_children_of<'dom, Node>(
|
|||
|
||||
for child in iter_child_nodes(parent_element) {
|
||||
if let Some(contents) = child.as_text() {
|
||||
handler.handle_text(child, contents, &child.style(context));
|
||||
handler.handle_text(child, contents, child.style(context));
|
||||
} else if child.is_element() {
|
||||
traverse_element(child, context, handler);
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ fn traverse_element<'dom, Node>(
|
|||
Display::GeneratingBox(display) => {
|
||||
let contents = replaced.map_or(Contents::OfElement, Contents::Replaced);
|
||||
let box_slot = element.element_box_slot();
|
||||
handler.handle_element(element, &style, display, contents, box_slot);
|
||||
handler.handle_element(element, style, display, contents, box_slot);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ fn traverse_pseudo_element<'dom, Node>(
|
|||
let items = generate_pseudo_element_content(&style, element, context);
|
||||
let box_slot = element.pseudo_element_box_slot(which);
|
||||
let contents = Contents::OfPseudoElement(items);
|
||||
handler.handle_element(element, &style, display, contents, box_slot);
|
||||
handler.handle_element(element, style, display, contents, box_slot);
|
||||
},
|
||||
}
|
||||
} else {
|
||||
|
@ -169,7 +169,7 @@ fn traverse_pseudo_element_contents<'dom, Node>(
|
|||
for item in items {
|
||||
match item {
|
||||
PseudoElementContentItem::Text(text) => {
|
||||
handler.handle_text(node, text.into(), pseudo_element_style)
|
||||
handler.handle_text(node, text.into(), pseudo_element_style.clone())
|
||||
},
|
||||
PseudoElementContentItem::Replaced(contents) => {
|
||||
let item_style = anonymous_style.get_or_insert_with(|| {
|
||||
|
@ -193,7 +193,7 @@ fn traverse_pseudo_element_contents<'dom, Node>(
|
|||
);
|
||||
handler.handle_element(
|
||||
node,
|
||||
item_style,
|
||||
item_style.clone(),
|
||||
display_inline,
|
||||
Contents::Replaced(contents),
|
||||
// We don’t keep pointers to boxes generated by contents of pseudo-elements
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue