Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFix handling of borders and padding for empty/stripped inline flows #10643
Conversation
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| pub fn meld_with_prev_inline_fragment(&mut self, prev_fragment: &Fragment) { | ||
| if let Some(ref mut inline_context_of_this_fragment) = self.inline_context { | ||
| if let Some(ref inline_context_of_prev_fragment) = prev_fragment.inline_context { |
This comment has been minimized.
This comment has been minimized.
pcwalton
Apr 16, 2016
Contributor
nit: You could remove a level of indentation here by matching on a tuple, if you like. Up to you.
This comment has been minimized.
This comment has been minimized.
mbrubeck
Apr 16, 2016
Author
Contributor
Tried out this suggestion, but ended up making the code less readable because of explicit reborrows needed to avoid moving from borrowed content into the tuple.
| padding.padding_top != LengthOrPercentage::Length(Au(0)) || | ||
| padding.padding_right != LengthOrPercentage::Length(Au(0)) || | ||
| padding.padding_bottom != LengthOrPercentage::Length(Au(0)) || | ||
| padding.padding_left != LengthOrPercentage::Length(Au(0)) || |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
notriddle
Apr 16, 2016
Contributor
If that's going to be a thing we do, we should probably add an is_zero() method to LengthOrPercentage or something.
This comment has been minimized.
This comment has been minimized.
…ment Factor out a new `meld_with_prev_inline_fragment` method that mirrors the existing `meld_with_next_inline_fragment`. This also fixes a bug in `meld_with_next` that was already fixed in the `meld_with_prev` by @notriddle in #10419. The bug is that it was traversing the inline context nodes in the wrong order. It should start at the outermost enclosing node, since the fragments might be at different nesting levels under some common ancestor.
This fixes two problems that could cause scanned text fragments to end up with incorrect LAST_FRAGMENT_OF_ELEMENT or FIRST_FRAGMENT_OF_ELEMENT flags: 1. If a single unscanned fragment was split into multiple scanned fragments, then all of them would inherit its flags. We need to clear these flags, except for the first and last scanned fragment. 2. When an unscanned fragment generated zero scanned fragments, we correctly called `meld_with_next_inline_fragment` to transfer LAST_FRAGMENT flags to the preceding fragment, but we didn't do anything to transfer FIRST_FRAGMENT flags to the following fragment. We can fix this by calling `meld_with_prev_inline_fragment` on the following fragment.
|
Addressed review comments. |
|
@bors-servo: r+ |
|
|
Fix handling of borders and padding for empty/stripped inline flows This forces fragment generation for empty inline flows, if they have borders or padding. Fixes #10533 and #2001. Also includes fixes for other bugs that were uncovered by this change; see the individual commit messages for detailed explanations. r? @pcwalton <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10643) <!-- Reviewable:end -->
|
|
|
Empty fragments may need to be layed out to draw borders, padding/background, and insertion points. (Fragments that consist of discardable whitespace and control characters, on the other hand, can still be discarded.) This ends up preserving some useless empty fragments. It's possible we could avoid this by storing some sort of flag on "important" empty fragments, so we can discard the rest.
|
@bors-servo r=pcwalton
|
|
|
Fix handling of borders and padding for empty/stripped inline flows This forces fragment generation for empty inline flows, if they have borders or padding. Fixes #10533 and #2001. Also includes fixes for other bugs that were uncovered by this change; see the individual commit messages for detailed explanations. r? @pcwalton <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10643) <!-- Reviewable:end -->
|
|
|
I don't think this is related to my changes:
|
|
@bors-servo retry
|
Fix handling of borders and padding for empty/stripped inline flows This forces fragment generation for empty inline flows, if they have borders or padding. Fixes #10533 and #2001. Also includes fixes for other bugs that were uncovered by this change; see the individual commit messages for detailed explanations. r? @pcwalton <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10643) <!-- Reviewable:end -->
|
Yeah, those are the temperamental new WebGL tests that were just enabled after a long fight in #10373. |
|
|
mbrubeck commentedApr 16, 2016
This forces fragment generation for empty inline flows, if they have borders or padding. Fixes #10533 and #2001. Also includes fixes for other bugs that were uncovered by this change; see the individual commit messages for detailed explanations. r? @pcwalton
This change is