Remove the dead `links` field from TextLayout (#686)

cc for awareness @mwcampbell.

That field was dead code left behind when we removed previous links
support. On that struct is probably not the right field for links to
live, since `Label` also uses `TextLayout`, but can't meaningfully
support links as part of a different interactive widget.
This commit is contained in:
Daniel McNab 2024-10-18 13:41:31 +01:00 committed by GitHub
parent 86604b7a74
commit 2832766eff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 12 deletions

View File

@ -4,7 +4,6 @@
//! A type for laying out, drawing, and interacting with text.
use std::collections::{HashMap, HashSet};
use std::rc::Rc;
use accesskit::{NodeBuilder, NodeId, Role, TreeUpdate};
use parley::context::RangedBuilder;
@ -13,7 +12,7 @@ use parley::layout::{Alignment, Cursor};
use parley::style::{FontFamily, FontStack, GenericFamily, StyleProperty};
use parley::{FontContext, Layout, LayoutContext};
use unicode_segmentation::UnicodeSegmentation;
use vello::kurbo::{Affine, Line, Point, Rect, Size};
use vello::kurbo::{Affine, Line, Point, Size};
use vello::peniko::{self, Color, Gradient};
use vello::Scene;
@ -54,8 +53,6 @@ pub struct TextLayout {
alignment: Alignment,
max_advance: Option<f32>,
links: Rc<[(Rect, usize)]>,
needs_layout: bool,
needs_line_breaks: bool,
pub(crate) layout: Layout<TextBrush>,
@ -185,8 +182,6 @@ impl TextLayout {
max_advance: None,
alignment: Default::default(),
links: Rc::new([]),
needs_layout: true,
needs_line_breaks: true,
layout: Layout::new(),
@ -445,11 +440,6 @@ impl TextLayout {
self.needs_line_breaks = false;
self.layout
.break_all_lines(self.max_advance, self.alignment);
// TODO:
// self.links = text
// .links()
// ...
}
}
@ -586,7 +576,6 @@ impl std::fmt::Debug for TextLayout {
.field("outdated?", &self.needs_rebuild())
.field("width", &self.layout.width())
.field("height", &self.layout.height())
.field("links", &self.links)
.finish_non_exhaustive()
}
}