implemented string-valued text-overflow

This commit is contained in:
Nikhil Shagrithaya 2016-10-19 00:06:19 +05:30
parent c4bd2027b7
commit 4b2737606d
7 changed files with 100 additions and 49 deletions

View file

@ -1029,12 +1029,15 @@ impl Fragment {
}
/// Transforms this fragment into an ellipsis fragment, preserving all the other data.
pub fn transform_into_ellipsis(&self, layout_context: &LayoutContext) -> Fragment {
pub fn transform_into_ellipsis(&self,
layout_context: &LayoutContext,
text_overflow_string: String)
-> Fragment {
let mut unscanned_ellipsis_fragments = LinkedList::new();
unscanned_ellipsis_fragments.push_back(self.transform(
self.border_box.size,
SpecificFragmentInfo::UnscannedText(
box UnscannedTextFragmentInfo::new("".to_owned(), None))));
box UnscannedTextFragmentInfo::new(text_overflow_string, None))));
let ellipsis_fragments = TextRunScanner::new().scan_for_runs(&mut layout_context.font_context(),
unscanned_ellipsis_fragments);
debug_assert!(ellipsis_fragments.len() == 1);