Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of borders and padding for empty/stripped inline flows #10643

Merged
merged 5 commits into from Apr 16, 2016

Conversation

@mbrubeck
Copy link
Contributor

mbrubeck commented Apr 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 Reviewable

}
}
}
}

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.

Copy link
@pcwalton

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.

Copy link
@mbrubeck

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.

Copy link
@pcwalton

pcwalton Apr 16, 2016

Contributor

Handle 0% maybe too?

This comment has been minimized.

Copy link
@notriddle

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.

Copy link
@mbrubeck

mbrubeck Apr 16, 2016

Author Contributor

Done

mbrubeck added 3 commits Apr 15, 2016
…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.
@mbrubeck mbrubeck force-pushed the mbrubeck:empty-span-border branch from 82201b7 to ec9afe9 Apr 16, 2016
@mbrubeck
Copy link
Contributor Author

mbrubeck commented Apr 16, 2016

Addressed review comments.

@mbrubeck mbrubeck force-pushed the mbrubeck:empty-span-border branch from ec9afe9 to 6431d74 Apr 16, 2016
@pcwalton
Copy link
Contributor

pcwalton commented Apr 16, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Apr 16, 2016

📌 Commit 6431d74 has been approved by pcwalton

@bors-servo
Copy link
Contributor

bors-servo commented Apr 16, 2016

Testing commit 6431d74 with merge b7c4404...

bors-servo added a commit that referenced this pull request Apr 16, 2016
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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Apr 16, 2016

💔 Test failed - linux-rel

@jdm
Copy link
Member

jdm commented Apr 16, 2016

  ▶ FAIL [expected PASS] /css21_dev/html4/run-in-listitem-between-002.htm
  └   → /css21_dev/html4/run-in-listitem-between-002.htm ef608dda75ea29fbec3a0a32f64cc80292e62d82
/css21_dev/html4/reference/run-in-text-ref.htm d068883ccfce1b3fdf24f9ea6b401c9a047b593c
Testing ef608dda75ea29fbec3a0a32f64cc80292e62d82 == d068883ccfce1b3fdf24f9ea6b401c9a047b593c

  ▶ FAIL [expected PASS] /css21_dev/html4/run-in-listitem-between-001.htm
  └   → /css21_dev/html4/run-in-listitem-between-001.htm ef608dda75ea29fbec3a0a32f64cc80292e62d82
/css21_dev/html4/reference/run-in-text-ref.htm d068883ccfce1b3fdf24f9ea6b401c9a047b593c
Testing ef608dda75ea29fbec3a0a32f64cc80292e62d82 == d068883ccfce1b3fdf24f9ea6b401c9a047b593c
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.
@mbrubeck mbrubeck force-pushed the mbrubeck:empty-span-border branch from 6431d74 to 1695d14 Apr 16, 2016
@mbrubeck
Copy link
Contributor Author

mbrubeck commented Apr 16, 2016

@bors-servo r=pcwalton

  • Reverted some of the metadata changes.
@bors-servo
Copy link
Contributor

bors-servo commented Apr 16, 2016

📌 Commit 1695d14 has been approved by pcwalton

@bors-servo
Copy link
Contributor

bors-servo commented Apr 16, 2016

Testing commit 1695d14 with merge 7cb0391...

bors-servo added a commit that referenced this pull request Apr 16, 2016
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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Apr 16, 2016

💔 Test failed - mac-rel-wpt

@mbrubeck
Copy link
Contributor Author

mbrubeck commented Apr 16, 2016

I don't think this is related to my changes:

Tests with unexpected results:
  ▶ CRASH [expected OK] /webgl/conformance-1.0.3/conformance/limits/gl-min-attribs.html

  ▶ OK [expected CRASH] /webgl/conformance-1.0.3/conformance/more/conformance/quickCheckAPI-G_I.html

  ▶ Unexpected subtest result in /webgl/conformance-1.0.3/conformance/more/conformance/quickCheckAPI-G_I.html:
  │ FAIL [expected PASS] WebGL test #0: testValidArgs

  ▶ CRASH [expected OK] /webgl/conformance-1.0.3/conformance/textures/texture-draw-with-2d-and-cube.html
@mbrubeck
Copy link
Contributor Author

mbrubeck commented Apr 16, 2016

@bors-servo retry

  • will file new issue if this turns out to be intermittent
@bors-servo
Copy link
Contributor

bors-servo commented Apr 16, 2016

Testing commit 1695d14 with merge 15e76eb...

bors-servo added a commit that referenced this pull request Apr 16, 2016
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 -->
@jdm
Copy link
Member

jdm commented Apr 16, 2016

Yeah, those are the temperamental new WebGL tests that were just enabled after a long fight in #10373.

@bors-servo
Copy link
Contributor

bors-servo commented Apr 16, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

6 participants
You can’t perform that action at this time.