diff options
author | bors-servo <metajack+bors@gmail.com> | 2014-12-13 14:06:47 -0700 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2014-12-13 14:06:47 -0700 |
commit | 68ab18876bf4e210da26590420b9844b9cb0c92d (patch) | |
tree | c62ceaff3d1d55385a5f253a88e10816470b7a15 /components/layout/inline.rs | |
parent | 1be7d7ccedec170016243bc5924239ef02b0b76f (diff) | |
parent | 6943ddb93e7b269bf7a6045a69ab5e78f37b0ea3 (diff) | |
download | servo-68ab18876bf4e210da26590420b9844b9cb0c92d.tar.gz servo-68ab18876bf4e210da26590420b9844b9cb0c92d.zip |
auto merge of #4361 : pcwalton/servo/overflow-wrap, r=glennw
This property is used by approximately 55% of page loads.
To implement the line breaking behavior, the "breaking strategy" has
been cleaned up and abstracted. This should allow us to easily support
other similar properties in the future, such as `text-overflow` and
`word-break`.
r? @glennw
Diffstat (limited to 'components/layout/inline.rs')
-rw-r--r-- | components/layout/inline.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/components/layout/inline.rs b/components/layout/inline.rs index f7e7441ebbc..89b65b22fb6 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -512,18 +512,17 @@ impl LineBreaker { let available_inline_size = green_zone.inline - self.pending_line.bounds.size.inline - indentation; let (inline_start_fragment, inline_end_fragment) = - match fragment.find_split_info_for_inline_size(CharIndex(0), - available_inline_size, - self.pending_line_is_empty()) { + match fragment.calculate_split_position(available_inline_size, + self.pending_line_is_empty()) { None => { debug!("LineBreaker: fragment was unsplittable; deferring to next line: {}", fragment); self.work_list.push_front(fragment); return false } - Some((start_split_info, end_split_info, run)) => { + Some(split_result) => { let split_fragment = |split: SplitInfo| { - let info = box ScannedTextFragmentInfo::new(run.clone(), + let info = box ScannedTextFragmentInfo::new(split_result.text_run.clone(), split.range, Vec::new(), fragment.border_box.size); @@ -532,8 +531,8 @@ impl LineBreaker { fragment.border_box.size.block); fragment.transform(size, info) }; - (start_split_info.map(|x| split_fragment(x)), - end_split_info.map(|x| split_fragment(x))) + (split_result.inline_start.map(|x| split_fragment(x)), + split_result.inline_end.map(|x| split_fragment(x))) } }; |