diff options
author | Pyfisch <pyfisch@gmail.com> | 2018-02-11 21:00:32 +0100 |
---|---|---|
committer | Pyfisch <pyfisch@gmail.com> | 2018-02-24 10:36:10 +0100 |
commit | 2d74bcfea5f74a8ba130615b2b5b5bd571623b4d (patch) | |
tree | a1496c8dc05b802d18e9e30bb2ee0f0f50d9adf1 /components/gfx/text | |
parent | a5115139baca2d2a15831916d83964a4d374fae1 (diff) | |
download | servo-2d74bcfea5f74a8ba130615b2b5b5bd571623b4d.tar.gz servo-2d74bcfea5f74a8ba130615b2b5b5bd571623b4d.zip |
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.
Diffstat (limited to 'components/gfx/text')
-rw-r--r-- | components/gfx/text/text_run.rs | 4 |
1 files changed, 2 insertions, 2 deletions
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<ByteIndex>, advance: f32) -> usize { + pub fn range_index_of_advance(&self, range: &Range<ByteIndex>, 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) = |