diff options
author | Michael Howell <michael@notriddle.com> | 2017-01-12 18:34:36 +0000 |
---|---|---|
committer | Michael Howell <michael@notriddle.com> | 2017-01-12 22:02:53 +0000 |
commit | cef4ebed2088ea5e4c457eba34fbd48f00fefaff (patch) | |
tree | 16978898357bdbe99abe8fbe923a534e27b95974 /components/layout/inline.rs | |
parent | 8a90cda09f3bcb7ffc40eb456aefddb2495f1ff6 (diff) | |
download | servo-cef4ebed2088ea5e4c457eba34fbd48f00fefaff.tar.gz servo-cef4ebed2088ea5e4c457eba34fbd48f00fefaff.zip |
Preserve the un-truncated version of fragments
Fixes #14952
Diffstat (limited to 'components/layout/inline.rs')
-rw-r--r-- | components/layout/inline.rs | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 47e1da7b2bb..8a086d34320 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -332,16 +332,15 @@ impl LineBreaker { None => break, Some(fragment) => fragment, }; - - // If ellipsis are still needed, then they were already needed for the previous fragment. - if fragment.flags.contains(IS_ELLIPSIS) { - continue - } - // If ellipsis are still needed, then they were already needed for the previous fragment. - if fragment.flags.contains(IS_ELLIPSIS) { + // Do not reflow truncated fragments. Reflow the original fragment only. + let fragment = if fragment.flags.contains(IS_ELLIPSIS) { continue - } + } else if let SpecificFragmentInfo::TruncatedFragment(info) = fragment.specific { + info.full + } else { + fragment + }; // Try to append the fragment. self.reflow_fragment(fragment, flow, layout_context); @@ -718,13 +717,9 @@ impl LineBreaker { if let Some(string) = ellipsis { let ellipsis = fragment.transform_into_ellipsis(layout_context, string); - if let Some(truncation_info) = - fragment.truncate_to_inline_size(available_inline_size - - ellipsis.margin_box_inline_size()) { - let fragment = fragment.transform_with_split_info(&truncation_info.split, - truncation_info.text_run); - self.push_fragment_to_line_ignoring_text_overflow(fragment, layout_context); - } + let truncated = fragment.truncate_to_inline_size(available_inline_size - + ellipsis.margin_box_inline_size()); + self.push_fragment_to_line_ignoring_text_overflow(truncated, layout_context); self.push_fragment_to_line_ignoring_text_overflow(ellipsis, layout_context); } else { self.push_fragment_to_line_ignoring_text_overflow(fragment, layout_context); |