Auto merge of #13924 - cynicaldevil:text-overflow, r=emilio

implemented string-valued text-overflow

<!-- Please describe your changes on the following line: -->
---

<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #13709

<!-- Either: -->
- [x] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

cc @Manishearth
The lorem-ipsum example from MDN works as expected.

<!-- Reviewable:start -->
---

This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13924)

<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-11-09 16:36:45 -06:00 committed by GitHub
commit a91f48ee05
7 changed files with 100 additions and 49 deletions

View file

@ -1037,12 +1037,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);