mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Define share_style_if_possible on LayoutElement.
This commit is contained in:
parent
e6e514c89a
commit
f3faaa6b01
2 changed files with 26 additions and 23 deletions
|
@ -165,10 +165,17 @@ impl<'a> PreorderDomTraversal for RecalcStyleForNode<'a> {
|
|||
// Check to see whether we can share a style with someone.
|
||||
let style_sharing_candidate_cache =
|
||||
&mut self.layout_context.style_sharing_candidate_cache();
|
||||
let sharing_result = unsafe {
|
||||
node.share_style_if_possible(style_sharing_candidate_cache,
|
||||
parent_opt.clone())
|
||||
|
||||
let sharing_result = match node.as_element() {
|
||||
Some(element) => {
|
||||
unsafe {
|
||||
element.share_style_if_possible(style_sharing_candidate_cache,
|
||||
parent_opt.clone())
|
||||
}
|
||||
},
|
||||
None => StyleSharingResult::CannotShare(false),
|
||||
};
|
||||
|
||||
// Otherwise, match and cascade selectors.
|
||||
match sharing_result {
|
||||
StyleSharingResult::CannotShare(mut shareable) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue