Add unsafe blocks to make_unique

See #6376
This commit is contained in:
Manish Goregaokar 2015-06-14 20:52:27 +05:30
parent 3cdc412a4c
commit 94fa868d2b
4 changed files with 84 additions and 68 deletions

View file

@ -950,6 +950,7 @@ impl InlineFlow {
fn justify_inline_fragments(fragments: &mut InlineFragments,
line: &Line,
slack_inline_size: Au) {
#![allow(unsafe_code)] // #6376
// Fast path.
if slack_inline_size == Au(0) {
return
@ -984,9 +985,9 @@ impl InlineFlow {
// FIXME(pcwalton): This is an awful lot of uniqueness making. I don't see any easy way
// to get rid of it without regressing the performance of the non-justified case,
// though.
let run = scanned_text_fragment_info.run.make_unique();
let run = unsafe { scanned_text_fragment_info.run.make_unique() };
{
let glyph_runs = run.glyphs.make_unique();
let glyph_runs = unsafe { run.glyphs.make_unique() };
for mut glyph_run in glyph_runs.iter_mut() {
let mut range = glyph_run.range.intersect(&fragment_range);
if range.is_empty() {
@ -994,7 +995,7 @@ impl InlineFlow {
}
range.shift_by(-glyph_run.range.begin());
let glyph_store = glyph_run.glyph_store.make_unique();
let glyph_store = unsafe { glyph_run.glyph_store.make_unique() };
glyph_store.distribute_extra_space_in_range(&range,
space_per_expansion_opportunity);
}