mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Use empty pseudo to cascade only inheritable properties for text
Since for nested inline elements non-inheritable properties are properly stored in the inline context of an inline fragment, so get rid of them on the style.
This commit is contained in:
parent
1677d479f6
commit
951c050690
8 changed files with 84 additions and 191 deletions
|
@ -176,7 +176,7 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + Debug + GetLayoutData + NodeInfo
|
|||
/// it can be used to reach siblings and cousins. A simple immutable borrow
|
||||
/// of the parent data is fine, since the bottom-up traversal will not process
|
||||
/// the parent until all the children have been processed.
|
||||
fn style_for_text_node(&self) -> Arc<ServoComputedValues>;
|
||||
fn parent_style(&self) -> Arc<ServoComputedValues>;
|
||||
|
||||
#[inline]
|
||||
fn is_element_or_elements_pseudo(&self) -> bool {
|
||||
|
@ -222,8 +222,10 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + Debug + GetLayoutData + NodeInfo
|
|||
if let Some(el) = self.as_element() {
|
||||
el.style(context)
|
||||
} else {
|
||||
// Text nodes are not styled during traversal,instead we simply
|
||||
// return parent style here and do cascading during layout.
|
||||
debug_assert!(self.is_text_node());
|
||||
self.style_for_text_node()
|
||||
self.parent_style()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -232,7 +234,8 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + Debug + GetLayoutData + NodeInfo
|
|||
el.selected_style()
|
||||
} else {
|
||||
debug_assert!(self.is_text_node());
|
||||
self.style_for_text_node()
|
||||
// TODO(stshine): What should the selected style be for text?
|
||||
self.parent_style()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue