servo: Merge #12760 - Inline split fixes#12699 (from splav:inline_split_fixes#12699); r=notriddle

<!-- Please describe your changes on the following line: -->
Fix fragment splitting algorithm to set FIRST/LAST_FRAGMENT_OF_ELEMENT flag correctly, account for border_padding for border_box and set zero border_padding between for new fragments.

---
<!-- 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 #12699 (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

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

Source-Repo: https://github.com/servo/servo
Source-Revision: 2420dc4a3e9338977e6f24184e65abff9749afb4
This commit is contained in:
Alexandrov Sergey 2016-08-09 11:05:57 -05:00
parent c069acc623
commit 3e310fec9b
2 changed files with 18 additions and 2 deletions

View File

@ -1644,7 +1644,7 @@ impl Fragment {
_ => return None,
};
let mut remaining_inline_size = max_inline_size;
let mut remaining_inline_size = max_inline_size - self.border_padding.inline_start_end();
let mut inline_start_range = Range::new(text_fragment_info.range.begin(), ByteIndex(0));
let mut inline_end_range = None;
let mut overflowing = false;

View File

@ -636,7 +636,23 @@ impl LineBreaker {
// Push the first fragment onto the line we're working on and start off the next line with
// the second fragment. If there's no second fragment, the next line will start off empty.
match (inline_start_fragment, inline_end_fragment) {
(Some(inline_start_fragment), Some(inline_end_fragment)) => {
(Some(mut inline_start_fragment), Some(mut inline_end_fragment)) => {
inline_start_fragment.border_padding.inline_end = Au(0);
if let Some(ref mut inline_context) = inline_start_fragment.inline_context {
for node in &mut inline_context.nodes {
node.flags.remove(LAST_FRAGMENT_OF_ELEMENT);
}
}
inline_start_fragment.border_box.size.inline += inline_start_fragment.border_padding.inline_start;
inline_end_fragment.border_padding.inline_start = Au(0);
if let Some(ref mut inline_context) = inline_end_fragment.inline_context {
for node in &mut inline_context.nodes {
node.flags.remove(FIRST_FRAGMENT_OF_ELEMENT);
}
}
inline_end_fragment.border_box.size.inline += inline_end_fragment.border_padding.inline_end;
self.push_fragment_to_line(layout_context,
inline_start_fragment,
LineFlushMode::Flush);