layout: text: Don't consider the REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES if the fragment can wrap text.

This was making us fall in a loop where the start split was empty, but we didn't
ignore it because the current fragment had this flag, but then we treated it
differently depending on the white_space property.

Not totally sure this is the proper fix, but it makes sense to me. In case it
is:

Fixes #12369.
This commit is contained in:
Emilio Cobos Álvarez 2016-07-10 00:53:37 -07:00
parent 8f13bb24f1
commit 383ba964ab
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 22 additions and 22 deletions

View file

@ -1541,12 +1541,11 @@ impl Fragment {
/// information are both optional due to the possibility of them being whitespace.
pub fn calculate_split_position(&self, max_inline_size: Au, starts_line: bool)
-> Option<SplitResult> {
let text_fragment_info =
if let SpecificFragmentInfo::ScannedText(ref text_fragment_info) = self.specific {
text_fragment_info
} else {
return None
};
let text_fragment_info = match self.specific {
SpecificFragmentInfo::ScannedText(ref text_fragment_info)
=> text_fragment_info,
_ => return None,
};
let mut flags = SplitOptions::empty();
if starts_line {
@ -1618,12 +1617,11 @@ impl Fragment {
flags: SplitOptions)
-> Option<SplitResult>
where I: Iterator<Item=TextRunSlice<'a>> {
let text_fragment_info =
if let SpecificFragmentInfo::ScannedText(ref text_fragment_info) = self.specific {
text_fragment_info
} else {
return None
};
let text_fragment_info = match self.specific {
SpecificFragmentInfo::ScannedText(ref text_fragment_info)
=> text_fragment_info,
_ => return None,
};
let mut remaining_inline_size = max_inline_size;
let mut inline_start_range = Range::new(text_fragment_info.range.begin(), ByteIndex(0));
@ -1661,7 +1659,8 @@ impl Fragment {
// see if we're going to overflow the line. If so, perform a best-effort split.
let mut remaining_range = slice.text_run_range();
let split_is_empty = inline_start_range.is_empty() &&
!self.requires_line_break_afterward_if_wrapping_on_newlines();
!(self.requires_line_break_afterward_if_wrapping_on_newlines() &&
!self.white_space().allow_wrap());
if split_is_empty {
// We're going to overflow the line.
overflowing = true;