mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Inline ThreadSafeLayoutNode::get_style.
This commit is contained in:
parent
3984e39011
commit
cf793a8813
2 changed files with 7 additions and 11 deletions
|
@ -1247,9 +1247,9 @@ impl<'a> FlowConstructor<'a> {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut style = node.style().clone();
|
||||||
let mut layout_data_ref = node.mutate_layout_data();
|
let mut layout_data_ref = node.mutate_layout_data();
|
||||||
let layout_data = layout_data_ref.as_mut().expect("no layout data");
|
let layout_data = layout_data_ref.as_mut().expect("no layout data");
|
||||||
let mut style = (*node.get_style(&layout_data)).clone();
|
|
||||||
let damage = layout_data.data.restyle_damage;
|
let damage = layout_data.data.restyle_damage;
|
||||||
match node.construction_result_mut(layout_data) {
|
match node.construction_result_mut(layout_data) {
|
||||||
&mut ConstructionResult::None => true,
|
&mut ConstructionResult::None => true,
|
||||||
|
|
|
@ -743,22 +743,18 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
||||||
self.node.mutate_layout_data()
|
self.node.mutate_layout_data()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn get_style<'a>(&self, layout_data_ref: &'a LayoutDataWrapper) -> &'a Arc<ComputedValues> {
|
|
||||||
match self.get_pseudo_element_type() {
|
|
||||||
PseudoElementType::Before(_) => layout_data_ref.data.before_style.as_ref().unwrap(),
|
|
||||||
PseudoElementType::After(_) => layout_data_ref.data.after_style.as_ref().unwrap(),
|
|
||||||
PseudoElementType::Normal => layout_data_ref.shared_data.style.as_ref().unwrap(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the style results for the given node. If CSS selector matching
|
/// Returns the style results for the given node. If CSS selector matching
|
||||||
/// has not yet been performed, fails.
|
/// has not yet been performed, fails.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn style<'a>(&'a self) -> Ref<'a, Arc<ComputedValues>> {
|
pub fn style<'a>(&'a self) -> Ref<'a, Arc<ComputedValues>> {
|
||||||
Ref::map(self.borrow_layout_data(), |layout_data_ref| {
|
Ref::map(self.borrow_layout_data(), |layout_data_ref| {
|
||||||
let layout_data = layout_data_ref.as_ref().expect("no layout data");
|
let layout_data = layout_data_ref.as_ref().expect("no layout data");
|
||||||
self.get_style(layout_data)
|
let style = match self.get_pseudo_element_type() {
|
||||||
|
PseudoElementType::Before(_) => &layout_data.data.before_style,
|
||||||
|
PseudoElementType::After(_) => &layout_data.data.after_style,
|
||||||
|
PseudoElementType::Normal => &layout_data.shared_data.style,
|
||||||
|
};
|
||||||
|
style.as_ref().unwrap()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue