Skip to content

Commit

Permalink
Auto merge of servo#6118 - Ryman:gh5856, r=pcwalton
Browse files Browse the repository at this point in the history
Fixes servo#5856 

This stops the panic, but the empty fragments tend to be non-empty if extended by `info.range_end_including_stripped_whitespace`, so I'm unsure if it's a requirement to include that instead of skipping for correctness? Perhaps there's a testcase needed for this behaviour?

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6118)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed May 18, 2015
2 parents 90aacf0 + dcf91d9 commit 913c567
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions components/layout/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -959,14 +959,13 @@ impl InlineFlow {
let mut expansion_opportunities = 0i32;
for fragment_index in line.range.each_index() {
let fragment = fragments.get(fragment_index.to_usize());
let scanned_text_fragment_info =
if let SpecificFragmentInfo::ScannedText(ref info) = fragment.specific {
info
} else {
continue
};
for slice in scanned_text_fragment_info.run.character_slices_in_range(
&scanned_text_fragment_info.range) {
let scanned_text_fragment_info = match fragment.specific {
SpecificFragmentInfo::ScannedText(ref info) if !info.range.is_empty() => info,
_ => continue
};
let fragment_range = scanned_text_fragment_info.range;

for slice in scanned_text_fragment_info.run.character_slices_in_range(&fragment_range) {
expansion_opportunities += slice.glyphs.space_count_in_range(&slice.range) as i32
}
}
Expand All @@ -976,12 +975,10 @@ impl InlineFlow {
(expansion_opportunities as f64);
for fragment_index in line.range.each_index() {
let fragment = fragments.get_mut(fragment_index.to_usize());
let mut scanned_text_fragment_info =
if let SpecificFragmentInfo::ScannedText(ref mut info) = fragment.specific {
info
} else {
continue
};
let mut scanned_text_fragment_info = match fragment.specific {
SpecificFragmentInfo::ScannedText(ref mut info) if !info.range.is_empty() => info,
_ => continue
};
let fragment_range = scanned_text_fragment_info.range;

// FIXME(pcwalton): This is an awful lot of uniqueness making. I don't see any easy way
Expand Down

0 comments on commit 913c567

Please sign in to comment.