mirror of
https://github.com/servo/servo.git
synced 2025-07-31 11:10:22 +01:00
Render text-decoration: overline on layout 2020
This commit is contained in:
parent
48517bd61a
commit
4fd5484e1a
1 changed files with 26 additions and 10 deletions
|
@ -140,16 +140,14 @@ impl Fragment {
|
|||
let mut rect = rect;
|
||||
rect.origin.y = rect.origin.y + font_metrics.ascent - font_metrics.underline_offset;
|
||||
rect.size.height = font_metrics.underline_size;
|
||||
let rect = rect.to_webrender();
|
||||
let wavy_line_thickness = (0.33 * rect.size.height).ceil();
|
||||
builder.wr.push_line(
|
||||
&common,
|
||||
&rect,
|
||||
wavy_line_thickness,
|
||||
wr::LineOrientation::Horizontal,
|
||||
&rgba(color),
|
||||
wr::LineStyle::Solid,
|
||||
);
|
||||
self.build_display_list_for_text_decoration(builder, &rect, color);
|
||||
}
|
||||
|
||||
// Overline.
|
||||
if text_decorations.overline {
|
||||
let mut rect = rect;
|
||||
rect.size.height = font_metrics.underline_size;
|
||||
self.build_display_list_for_text_decoration(builder, &rect, color);
|
||||
}
|
||||
|
||||
// Text.
|
||||
|
@ -162,6 +160,24 @@ impl Fragment {
|
|||
None,
|
||||
);
|
||||
}
|
||||
|
||||
fn build_display_list_for_text_decoration(
|
||||
&self,
|
||||
builder: &mut DisplayListBuilder,
|
||||
rect: &PhysicalRect<Length>,
|
||||
color: cssparser::RGBA,
|
||||
) {
|
||||
let rect = rect.to_webrender();
|
||||
let wavy_line_thickness = (0.33 * rect.size.height).ceil();
|
||||
builder.wr.push_line(
|
||||
&builder.common_properties(rect),
|
||||
&rect,
|
||||
wavy_line_thickness,
|
||||
wr::LineOrientation::Horizontal,
|
||||
&rgba(color),
|
||||
wr::LineStyle::Solid,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
struct BuilderForBoxFragment<'a> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue