mirror of
https://github.com/servo/servo.git
synced 2025-07-16 20:03:39 +01:00
Correct negative margins in centered table cells
Fixes @AelitaBot queue viewer page
This commit is contained in:
parent
4aaae7a4e6
commit
c11f85947e
4 changed files with 46 additions and 0 deletions
|
@ -80,8 +80,12 @@ impl TableCellFlow {
|
||||||
if !flow::base(self).restyle_damage.contains(REFLOW) {
|
if !flow::base(self).restyle_damage.contains(REFLOW) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Note to the reader: this code has been tested with negative margins.
|
||||||
|
// We end up with a "end" that's before the "start," but the math still works out.
|
||||||
let first_start = flow::base(self).children.front().map(|kid| {
|
let first_start = flow::base(self).children.front().map(|kid| {
|
||||||
|
let kid_base = flow::base(kid);
|
||||||
flow::base(kid).position.start.b
|
flow::base(kid).position.start.b
|
||||||
|
- kid_base.collapsible_margins.block_start_margin_for_noncollapsible_context()
|
||||||
});
|
});
|
||||||
if let Some(mut first_start) = first_start {
|
if let Some(mut first_start) = first_start {
|
||||||
let mut last_end = first_start;
|
let mut last_end = first_start;
|
||||||
|
|
|
@ -4960,6 +4960,18 @@
|
||||||
"url": "/_mozilla/css/table_specified_width_a.html"
|
"url": "/_mozilla/css/table_specified_width_a.html"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"css/table_vertical_align_margin_padding.html": [
|
||||||
|
{
|
||||||
|
"path": "css/table_vertical_align_margin_padding.html",
|
||||||
|
"references": [
|
||||||
|
[
|
||||||
|
"/_mozilla/css/table_vertical_align_margin_padding_ref.html",
|
||||||
|
"=="
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"url": "/_mozilla/css/table_vertical_align_margin_padding.html"
|
||||||
|
}
|
||||||
|
],
|
||||||
"css/table_width_attribute_a.html": [
|
"css/table_width_attribute_a.html": [
|
||||||
{
|
{
|
||||||
"path": "css/table_width_attribute_a.html",
|
"path": "css/table_width_attribute_a.html",
|
||||||
|
@ -12092,6 +12104,18 @@
|
||||||
"url": "/_mozilla/css/table_specified_width_a.html"
|
"url": "/_mozilla/css/table_specified_width_a.html"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"css/table_vertical_align_margin_padding.html": [
|
||||||
|
{
|
||||||
|
"path": "css/table_vertical_align_margin_padding.html",
|
||||||
|
"references": [
|
||||||
|
[
|
||||||
|
"/_mozilla/css/table_vertical_align_margin_padding_ref.html",
|
||||||
|
"=="
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"url": "/_mozilla/css/table_vertical_align_margin_padding.html"
|
||||||
|
}
|
||||||
|
],
|
||||||
"css/table_width_attribute_a.html": [
|
"css/table_width_attribute_a.html": [
|
||||||
{
|
{
|
||||||
"path": "css/table_width_attribute_a.html",
|
"path": "css/table_width_attribute_a.html",
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Negative margins in a table with middle alignment</title>
|
||||||
|
<link rel="match" href="table_vertical_align_margin_padding_ref.html">
|
||||||
|
<style>table,tr,td{margin:0;padding:0;vertical-align:middle}</style>
|
||||||
|
<h1>Test passes if there is a single green box</h1>
|
||||||
|
<table><tr><td style="background:red">
|
||||||
|
<div style="margin:-40px;padding:40px"><div style="background:green;width:40px;height:40px"></div></div>
|
||||||
|
</td></tr></table>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Negative margins in table reference</title>
|
||||||
|
<Style>table,tr,td{margin:0;padding:0;vertical-align:middle}</style>
|
||||||
|
<h1>Test passes if there is a single green box</h1>
|
||||||
|
<table><tr><td style="background:red">
|
||||||
|
<div style="background:green;width:40px;height:40px"></div>
|
||||||
|
</td></tr></table>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue