mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +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;
|
let mut rect = rect;
|
||||||
rect.origin.y = rect.origin.y + font_metrics.ascent - font_metrics.underline_offset;
|
rect.origin.y = rect.origin.y + font_metrics.ascent - font_metrics.underline_offset;
|
||||||
rect.size.height = font_metrics.underline_size;
|
rect.size.height = font_metrics.underline_size;
|
||||||
let rect = rect.to_webrender();
|
self.build_display_list_for_text_decoration(builder, &rect, color);
|
||||||
let wavy_line_thickness = (0.33 * rect.size.height).ceil();
|
}
|
||||||
builder.wr.push_line(
|
|
||||||
&common,
|
// Overline.
|
||||||
&rect,
|
if text_decorations.overline {
|
||||||
wavy_line_thickness,
|
let mut rect = rect;
|
||||||
wr::LineOrientation::Horizontal,
|
rect.size.height = font_metrics.underline_size;
|
||||||
&rgba(color),
|
self.build_display_list_for_text_decoration(builder, &rect, color);
|
||||||
wr::LineStyle::Solid,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text.
|
// Text.
|
||||||
|
@ -162,6 +160,24 @@ impl Fragment {
|
||||||
None,
|
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> {
|
struct BuilderForBoxFragment<'a> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue