mirror of
https://github.com/servo/servo.git
synced 2025-08-02 04:00:32 +01:00
Add support for text-decoration-style
This commit is contained in:
parent
928bd0d1d2
commit
689b413bde
3 changed files with 22 additions and 3 deletions
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
use crate::geom::{PhysicalPoint, PhysicalRect, PhysicalSides, PhysicalSize};
|
use crate::geom::{PhysicalPoint, PhysicalRect, PhysicalSides, PhysicalSize};
|
||||||
use style::computed_values::mix_blend_mode::T as ComputedMixBlendMode;
|
use style::computed_values::mix_blend_mode::T as ComputedMixBlendMode;
|
||||||
|
use style::computed_values::text_decoration_style::T as ComputedTextDecorationStyle;
|
||||||
use style::computed_values::transform_style::T as ComputedTransformStyle;
|
use style::computed_values::transform_style::T as ComputedTransformStyle;
|
||||||
use style::values::computed::Filter as ComputedFilter;
|
use style::values::computed::Filter as ComputedFilter;
|
||||||
use style::values::computed::Length;
|
use style::values::computed::Length;
|
||||||
|
@ -100,3 +101,16 @@ impl ToWebRender for PhysicalSides<Length> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ToWebRender for ComputedTextDecorationStyle {
|
||||||
|
type Type = webrender_api::LineStyle;
|
||||||
|
fn to_webrender(&self) -> Self::Type {
|
||||||
|
match *self {
|
||||||
|
ComputedTextDecorationStyle::Solid => wr::LineStyle::Solid,
|
||||||
|
ComputedTextDecorationStyle::Dotted => wr::LineStyle::Dotted,
|
||||||
|
ComputedTextDecorationStyle::Dashed => wr::LineStyle::Dashed,
|
||||||
|
ComputedTextDecorationStyle::Wavy => wr::LineStyle::Wavy,
|
||||||
|
_ => wr::LineStyle::Solid,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -13,9 +13,9 @@ use gfx::text::glyph::GlyphStore;
|
||||||
use mitochondria::OnceCell;
|
use mitochondria::OnceCell;
|
||||||
use net_traits::image_cache::UsePlaceholder;
|
use net_traits::image_cache::UsePlaceholder;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use style::computed_values::text_decoration_style::T as ComputedTextDecorationStyle;
|
||||||
use style::dom::OpaqueNode;
|
use style::dom::OpaqueNode;
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
|
|
||||||
use style::values::computed::{BorderStyle, Length, LengthPercentage};
|
use style::values::computed::{BorderStyle, Length, LengthPercentage};
|
||||||
use style::values::specified::ui::CursorKind;
|
use style::values::specified::ui::CursorKind;
|
||||||
use webrender_api::{self as wr, units};
|
use webrender_api::{self as wr, units};
|
||||||
|
@ -182,14 +182,19 @@ impl Fragment {
|
||||||
.parent_style
|
.parent_style
|
||||||
.clone_text_decoration_color()
|
.clone_text_decoration_color()
|
||||||
.to_rgba(color);
|
.to_rgba(color);
|
||||||
|
let text_decoration_style = fragment.parent_style.clone_text_decoration_style();
|
||||||
|
if text_decoration_style == ComputedTextDecorationStyle::MozNone {
|
||||||
|
return;
|
||||||
|
}
|
||||||
builder.wr.push_line(
|
builder.wr.push_line(
|
||||||
&builder.common_properties(rect),
|
&builder.common_properties(rect),
|
||||||
&rect,
|
&rect,
|
||||||
wavy_line_thickness,
|
wavy_line_thickness,
|
||||||
wr::LineOrientation::Horizontal,
|
wr::LineOrientation::Horizontal,
|
||||||
&rgba(text_decoration_color),
|
&rgba(text_decoration_color),
|
||||||
wr::LineStyle::Solid,
|
text_decoration_style.to_webrender(),
|
||||||
);
|
);
|
||||||
|
// XXX(ferjm) support text-decoration-style: double
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ ${helpers.predefined_type(
|
||||||
${helpers.single_keyword(
|
${helpers.single_keyword(
|
||||||
"text-decoration-style",
|
"text-decoration-style",
|
||||||
"solid double dotted dashed wavy -moz-none",
|
"solid double dotted dashed wavy -moz-none",
|
||||||
engines="gecko",
|
engines="gecko servo-2020",
|
||||||
animation_value_type="discrete",
|
animation_value_type="discrete",
|
||||||
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-style",
|
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-style",
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue