Do not use buggy text_decorations_in_effect

This commit is contained in:
Fernando Jiménez Moreno 2020-03-04 16:52:49 +01:00
parent 689b413bde
commit 83fc9943d3
4 changed files with 48 additions and 8 deletions

View file

@ -19,6 +19,7 @@ use style::dom::OpaqueNode;
use style::logical_geometry::WritingMode;
use style::properties::ComputedValues;
use style::values::computed::Length;
use style::values::specified::text::TextDecorationLine;
use style::Zero;
use webrender_api::{FontInstanceKey, ImageKey};
@ -121,6 +122,8 @@ pub(crate) struct TextFragment {
#[serde(skip_serializing)]
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,
}
#[derive(Serialize)]
@ -192,6 +195,23 @@ 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 {