From 2d74bcfea5f74a8ba130615b2b5b5bd571623b4d Mon Sep 17 00:00:00 2001 From: Pyfisch Date: Sun, 11 Feb 2018 21:00:32 +0100 Subject: Introduce a dedicated data structure for text queries Add an IndexableText structure for text queries. Instead of linear search for a node this now uses a HashMap. Remove the now irrelevant fields from TextDisplayItem. --- components/gfx/text/text_run.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'components/gfx/text') diff --git a/components/gfx/text/text_run.rs b/components/gfx/text/text_run.rs index a85c8aababd..62126ab838a 100644 --- a/components/gfx/text/text_run.rs +++ b/components/gfx/text/text_run.rs @@ -333,10 +333,10 @@ impl<'a> TextRun { } /// Returns the index in the range of the first glyph advancing over given advance - pub fn range_index_of_advance(&self, range: &Range, advance: f32) -> usize { + pub fn range_index_of_advance(&self, range: &Range, advance: Au) -> usize { // TODO(Issue #199): alter advance direction for RTL // TODO(Issue #98): using inter-char and inter-word spacing settings when measuring text - let mut remaining = Au::from_f32_px(advance); + let mut remaining = advance; self.natural_word_slices_in_range(range) .map(|slice| { let (slice_index, slice_advance) = -- cgit v1.2.3