mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
remove @ from ScannedTextBox.run
This commit is contained in:
parent
f7cc49c30f
commit
2865ab4e29
4 changed files with 41 additions and 42 deletions
|
@ -87,7 +87,7 @@ pub struct SolidColorDisplayItem<E> {
|
|||
/// Renders text.
|
||||
pub struct TextDisplayItem<E> {
|
||||
base: BaseDisplayItem<E>,
|
||||
text_run: ~TextRun,
|
||||
text_run: Arc<~TextRun>,
|
||||
range: Range,
|
||||
color: Color,
|
||||
}
|
||||
|
@ -142,7 +142,8 @@ impl<E> DisplayItem<E> {
|
|||
debug!("Drawing text at {:?}.", text.base.bounds);
|
||||
|
||||
// FIXME(pcwalton): Allocating? Why?
|
||||
let font = render_context.font_ctx.get_font_by_descriptor(&text.text_run.font_descriptor).unwrap();
|
||||
let text_run = text.text_run.get();
|
||||
let font = render_context.font_ctx.get_font_by_descriptor(&text_run.font_descriptor).unwrap();
|
||||
|
||||
let font_metrics = font.with_borrow( |font| {
|
||||
font.metrics.clone()
|
||||
|
@ -151,7 +152,7 @@ impl<E> DisplayItem<E> {
|
|||
let baseline_origin = Point2D(origin.x, origin.y + font_metrics.ascent);
|
||||
font.with_mut_borrow( |font| {
|
||||
font.draw_text_into_context(render_context,
|
||||
&text.text_run,
|
||||
text.text_run.get(),
|
||||
&text.range,
|
||||
baseline_origin,
|
||||
text.color);
|
||||
|
@ -162,18 +163,18 @@ impl<E> DisplayItem<E> {
|
|||
let strikeout_size = font_metrics.strikeout_size;
|
||||
let strikeout_offset = font_metrics.strikeout_offset;
|
||||
|
||||
if text.text_run.decoration.underline {
|
||||
if text_run.decoration.underline {
|
||||
let underline_y = baseline_origin.y - underline_offset;
|
||||
let underline_bounds = Rect(Point2D(baseline_origin.x, underline_y),
|
||||
Size2D(width, underline_size));
|
||||
render_context.draw_solid_color(&underline_bounds, text.color);
|
||||
}
|
||||
if text.text_run.decoration.overline {
|
||||
if text_run.decoration.overline {
|
||||
let overline_bounds = Rect(Point2D(baseline_origin.x, origin.y),
|
||||
Size2D(width, underline_size));
|
||||
render_context.draw_solid_color(&overline_bounds, text.color);
|
||||
}
|
||||
if text.text_run.decoration.line_through {
|
||||
if text_run.decoration.line_through {
|
||||
let strikeout_y = baseline_origin.y - strikeout_offset;
|
||||
let strikeout_bounds = Rect(Point2D(baseline_origin.x, strikeout_y),
|
||||
Size2D(width, strikeout_size));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue