Skip to content

Commit

Permalink
Auto merge of #13192 - notriddle:master, r=pcwalton,emilio
Browse files Browse the repository at this point in the history
Account for percentages in fixed table layout

Don't just use the minimum length all the time.

---

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #13166 (github issue number if applicable).
- [X] There are tests for these changes

<!-- 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/13192)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Sep 7, 2016
2 parents bba3eef + ff5aa87 commit 1815802
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
7 changes: 7 additions & 0 deletions components/layout/table.rs
Expand Up @@ -381,6 +381,13 @@ impl Flow for TableFlow {
self.column_computed_inline_sizes.push(ColumnComputedInlineSize {
size: extra_column_inline_size / num_unspecified_inline_sizes,
});
} else if column_inline_size.percentage != 0.0 {
self.column_computed_inline_sizes.push(ColumnComputedInlineSize {
size: cmp::max(
extra_column_inline_size.scale_by(column_inline_size.percentage),
column_inline_size.minimum_length,
)
});
} else {
self.column_computed_inline_sizes.push(ColumnComputedInlineSize {
size: column_inline_size.minimum_length,
Expand Down
24 changes: 24 additions & 0 deletions tests/wpt/mozilla/meta/MANIFEST.json
Expand Up @@ -1500,6 +1500,18 @@
"url": "/_mozilla/css/first_of_type_pseudo_a.html"
}
],
"css/fixed_percent.html": [
{
"path": "css/fixed_percent.html",
"references": [
[
"/_mozilla/css/fixed_percent_ref.html",
"=="
]
],
"url": "/_mozilla/css/fixed_percent.html"
}
],
"css/fixed_width_overrides_child_intrinsic_width_a.html": [
{
"path": "css/fixed_width_overrides_child_intrinsic_width_a.html",
Expand Down Expand Up @@ -10894,6 +10906,18 @@
"url": "/_mozilla/css/first_of_type_pseudo_a.html"
}
],
"css/fixed_percent.html": [
{
"path": "css/fixed_percent.html",
"references": [
[
"/_mozilla/css/fixed_percent_ref.html",
"=="
]
],
"url": "/_mozilla/css/fixed_percent.html"
}
],
"css/fixed_width_overrides_child_intrinsic_width_a.html": [
{
"path": "css/fixed_width_overrides_child_intrinsic_width_a.html",
Expand Down
15 changes: 15 additions & 0 deletions tests/wpt/mozilla/tests/css/fixed_percent.html
@@ -0,0 +1,15 @@
<!doctype html>
<meta charset="utf-8">
<title>Table with fixed layout gives according to percentages</title>
<link rel="match" href="fixed_percent_ref.html">
<style>
#c {
display: table;
width: 100%;
table-layout: fixed;
}
#d {
width: 100%;
}
</style>
<div id=c><div id=d>Test text</div></div>
4 changes: 4 additions & 0 deletions tests/wpt/mozilla/tests/css/fixed_percent_ref.html
@@ -0,0 +1,4 @@
<!DOCTYPE html>
<title>Table with fixed layout gives according to percentages</title>
Test text

0 comments on commit 1815802

Please sign in to comment.