Propagate text decoration where needed

This commit is contained in:
Fernando Jiménez Moreno 2020-03-11 17:11:05 +01:00
parent 83fc9943d3
commit 17948f3b39
9 changed files with 75 additions and 40 deletions

View file

@ -123,7 +123,7 @@ pub(crate) struct TextFragment {
pub font_key: FontInstanceKey,
pub glyphs: Vec<Arc<GlyphStore>>,
/// A flag that represents the _used_ value of the text-decoration property.
pub text_decorations_in_effect: TextDecorationLine,
pub text_decoration_line: TextDecorationLine,
}
#[derive(Serialize)]
@ -195,23 +195,6 @@ impl AbsoluteOrFixedPositionedFragment {
pub fn print(&self, tree: &mut PrintTree) {
tree.add_item(format!("AbsoluteOrFixedPositionedFragment({:?})", self.0));
}
pub fn set_text_decorations_in_effect(&mut self, text_decorations: TextDecorationLine) {
match self {
Fragment::Text(fragment) => fragment.text_decorations_in_effect = text_decorations,
Fragment::Box(fragment) => {
for child in &mut fragment.children {
child.set_text_decorations_in_effect(text_decorations);
}
},
Fragment::Anonymous(fragment) => {
for child in &mut fragment.children {
child.set_text_decorations_in_effect(text_decorations);
}
},
_ => (),
}
}
}
impl AnonymousFragment {