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 upHandle row borders in border collapsing logic. #12437
Conversation
highfive
commented
Jul 13, 2016
|
Layout code is usually tested using reference tests. We have documentation on creating them. |
|
@jdm thanks! Sorry for missing that, I'll provide a test soon. |
|
That's a good question. Is there some way to reproduce the problem that doesn't trigger the other bug? |
|
Actually there is, I can put borders in all rows except the topmost. Then with this PR the output is pretty much the same as the one Chrome and Firefox give: <!doctype html>
<html><body>
<style>
table {
border-collapse: collapse;
}
.b {
border: 1px solid black;
}
</style>
<table>
<tr><td>Lorem</td><td>Ipsum</td><td>Sit</td><td>Dolor</td></tr>
<tr class="b"><td>Lorem</td><td>Ipsum</td><td>Sit</td><td>Dolor</td></tr>
<tr class="b"><td>Lorem</td><td>Ipsum</td><td>Sit</td><td>Dolor</td></tr>
<tr class="b"><td>Lorem</td><td>Ipsum</td><td>Sit</td><td>Dolor</td></tr>
</table>
</body>
</html>I can make a ref test with this, then. |
|
r? @pcwalton |
|
@bors-servo: r+ |
|
|
|
|
Handle row borders in border collapsing logic.
<!-- Please describe your changes on the following line: -->
Handle table row border when collapsing borders for a table row. The row border is combined with the cell's border using the already implemented conflict resolution logic.
This is a screenshot of the following test:
```html
<!doctype html>
<html><body>
<style>
table {
border-collapse: collapse;
}
tr {
border: 1px solid black;
}
</style>
<table>
<tr><td>Lorem</td><td>Ipsum</td><td>Sit</td><td>Dolor</td></tr>
<tr><td>Lorem</td><td>Ipsum</td><td>Sit</td><td>Dolor</td></tr>
<tr><td>Lorem</td><td>Ipsum</td><td>Sit</td><td>Dolor</td></tr>
<tr><td>Lorem</td><td>Ipsum</td><td>Sit</td><td>Dolor</td></tr>
</table>
</body>
</html>
```
<img src="https://dl.dropboxusercontent.com/u/10962672/Screenshots%20Servo/servo_tr_border_collapse.png"/>
The top border is missing, but I think that's a different bug, since it also does not show up when the border is in the cells, and not the rows. Also, when debugging the border collapsing structures, they seem ok (the top border seems to be there). I can look at that bug in a separate issue (or in this one too if you prefer).
---
<!-- 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 #11527 (github issue number if applicable).
<!-- Either: -->
- [X] These changes do not require tests because I didn't find how to automatically test it (will be happy to provide a test if there's infrastructure for this kind of test already in place).
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Fixes #11527.
<!-- 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/12437)
<!-- Reviewable:end -->
|
|
highfive
commented
Jul 26, 2016
|
|
Just needs a few test expectations updates. 11 new passes :) |
|
Done :) |
|
@bors-servo: r=pcwalton |
Handle row borders in border collapsing logic.
<!-- Please describe your changes on the following line: -->
Handle table row border when collapsing borders for a table row. The row border is combined with the cell's border using the already implemented conflict resolution logic.
This is a screenshot of the following test:
```html
<!doctype html>
<html><body>
<style>
table {
border-collapse: collapse;
}
tr {
border: 1px solid black;
}
</style>
<table>
<tr><td>Lorem</td><td>Ipsum</td><td>Sit</td><td>Dolor</td></tr>
<tr><td>Lorem</td><td>Ipsum</td><td>Sit</td><td>Dolor</td></tr>
<tr><td>Lorem</td><td>Ipsum</td><td>Sit</td><td>Dolor</td></tr>
<tr><td>Lorem</td><td>Ipsum</td><td>Sit</td><td>Dolor</td></tr>
</table>
</body>
</html>
```
<img src="https://dl.dropboxusercontent.com/u/10962672/Screenshots%20Servo/servo_tr_border_collapse.png"/>
The top border is missing, but I think that's a different bug, since it also does not show up when the border is in the cells, and not the rows. Also, when debugging the border collapsing structures, they seem ok (the top border seems to be there). I can look at that bug in a separate issue (or in this one too if you prefer).
---
<!-- 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 #11527 (github issue number if applicable).
<!-- Either: -->
- [X] These changes do not require tests because I didn't find how to automatically test it (will be happy to provide a test if there's infrastructure for this kind of test already in place).
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Fixes #11527.
<!-- 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/12437)
<!-- Reviewable:end -->
|
|
|
This failure looks suspicious:
The other one is #12580. |
|
Hmm, @pcwalton do you know if the FIXME in that test is related to this PR? <!DOCTYPE html>
<html>
<head>
<!--
Tests that border collapse override and border collapse positioning works. All border widths
are even numbers to avoid subpixel rounding issues (the handling of which is not spec'd).
FIXME(pcwalton): This is currently offset by -2px in block and inline directions because we
don't correctly handle collapsed borders when calculating `table_border_padding` in
`table_wrapper.rs`.
-->
<link rel=match href=border_collapse_simple_ref.html>
<style>
html, body {
margin: 0;
}
html {
padding: 0;
}
body {
/* See `FIXME` above. */
padding: 2px;
}
...It looks like the difference is indeed a small padding added by the PR. I'll take a look. |
|
@gpoesia If you can fix the test by removing the 2px, then feel free to do that. |
|
Came back from vacations and started looking deeper into this. There are some problems which are not related to the padding. The left border width ( |
|
I think I've fixed one of the issues, but a second one remains: the cells in the left column apparently have a slightly larger width than they should (2px). Still not sure why this is so. As another note, I've noticed that even if I remove the 2px padding, the @pcwalton: any idea of what might be going on? |
|
If the test is failing in Firefox as well, feel free to just rewrite the test to test it some other way. |
|
I've modified the test and it passes now, but it diverges slightly from Firefox (one cell's width in the block direction is 2px smaller; the widths in the inline direction are all identical, differently from the previous version of the test). @pcwalton what do you think would be the most appropriate to do? I can keep debugging why the collapsing in the block direction is still a little different from Firefox. Do you have any tips on what I could look for? |
|
Let's just file a FIXME and get this landed. |
|
All right, just did that. |
|
@bors-servo r=pcwalton |
|
|
Handle row borders in border collapsing logic.
<!-- Please describe your changes on the following line: -->
Handle table row border when collapsing borders for a table row. The row border is combined with the cell's border using the already implemented conflict resolution logic.
This is a screenshot of the following test:
```html
<!doctype html>
<html><body>
<style>
table {
border-collapse: collapse;
}
tr {
border: 1px solid black;
}
</style>
<table>
<tr><td>Lorem</td><td>Ipsum</td><td>Sit</td><td>Dolor</td></tr>
<tr><td>Lorem</td><td>Ipsum</td><td>Sit</td><td>Dolor</td></tr>
<tr><td>Lorem</td><td>Ipsum</td><td>Sit</td><td>Dolor</td></tr>
<tr><td>Lorem</td><td>Ipsum</td><td>Sit</td><td>Dolor</td></tr>
</table>
</body>
</html>
```
<img src="https://dl.dropboxusercontent.com/u/10962672/Screenshots%20Servo/servo_tr_border_collapse.png"/>
The top border is missing, but I think that's a different bug, since it also does not show up when the border is in the cells, and not the rows. Also, when debugging the border collapsing structures, they seem ok (the top border seems to be there). I can look at that bug in a separate issue (or in this one too if you prefer).
---
<!-- 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 #11527 (github issue number if applicable).
<!-- Either: -->
- [X] These changes do not require tests because I didn't find how to automatically test it (will be happy to provide a test if there's infrastructure for this kind of test already in place).
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Fixes #11527.
<!-- 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/12437)
<!-- Reviewable:end -->
|
|




gpoesia commentedJul 13, 2016
•
edited by larsbergstrom
Handle table row border when collapsing borders for a table row. The row border is combined with the cell's border using the already implemented conflict resolution logic.
This is a screenshot of the following test:
The top border is missing, but I think that's a different bug, since it also does not show up when the border is in the cells, and not the rows. Also, when debugging the border collapsing structures, they seem ok (the top border seems to be there). I can look at that bug in a separate issue (or in this one too if you prefer).
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsFixes #11527.
This change is