mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Auto merge of #12760 - splav:inline_split_fixes#12699, r=notriddle
Inline split fixes#12699 <!-- 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. --> <!-- 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/12760) <!-- Reviewable:end -->
This commit is contained in:
commit
2420dc4a3e
8 changed files with 78 additions and 9 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue